Skip to content

[audit] Tab-indent gap in scope guide; wrong enter flag in tmp float win - #346

Draft
stanfish06 wants to merge 1 commit into
masterfrom
audit/scopeline-tab-ui-enter-fix
Draft

stanfish06 wants to merge 1 commit into
masterfrom
audit/scopeline-tab-ui-enter-fix

Conversation

@stanfish06

Copy link
Copy Markdown
Owner

What

Two small, unrelated mechanical fixes found during this audit pass.

1. lua/config/scopeline.lua:50-52 — scope guide skips tab-indented lines

local char = char_at(i + 1, start_col + 1) -- treesitter is 0 based
if char == " " or char == "" then

char_at only overlays the guide (│/┌/└) when the character at the guide's column is a literal space or past end-of-line. A tab character fails both checks, so the vertical scope-guide never renders on any line whose indentation at that column is a tab — which hits Go (gofmt default), Makefiles, and any tab-indented C/C++, all explicitly listed in valid_scopes. Distinct from the already-open "snacks.nvim indent/scope chunks and scopeline.lua extmarks render on the same column" issue, which is about column collision with another plugin, not character-type detection.

Fix: match any whitespace (char:match("%s")) instead of only " ".

2. lua/lib/ui.lua:15 — nvim_open_win(buf, 0, opts) focuses the window instead of leaving it unfocused

vim.api.nvim_open_win(buf, 0, opts)

The second arg to nvim_open_win is enter (boolean). 0 reads like C-style "false", but Lua's truthiness only treats nil/false as falsy — 0 is truthy, so this call actually focuses the new floating window, the opposite of what's presumably wanted for a disposable scratch/preview window.

Fix: pass false explicitly.

Note: create_tmp_float_window is currently dead code — its only reference is a commented-out line in lua/config/image.lua:5 — so this has no live effect today, but it's latent and will resurface if image-preview work (already tracked by other open issues) revives this helper.

Why it matters

Both are one-line, behavior-preserving-except-for-the-bug fixes with no API/config shape changes. No nerd font/icon strings touched.

Recommended action

Merge directly.


🤖 Generated with Claude Code

https://claude.ai/code/session_01Wr1z5B5VfZPgBAw7mnan8i


Generated by Claude Code

…at win

scopeline.lua only treated a literal space or end-of-line as safe to
overlay the guide character on, so any line indented with a tab (Go,
Makefiles, tab-indented C/C++) broke the vertical guide. Match any
whitespace instead.

lib/ui.lua's create_tmp_float_window passed 0 for nvim_open_win's enter
arg; Lua only treats nil/false as falsy; 0 is truthy, so the window was
being focused. Pass false explicitly. Currently dead code (only called
from a commented-out line in image.lua) but worth fixing before it's
wired back up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wr1z5B5VfZPgBAw7mnan8i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants