fix: editor [[-completion no longer opens on cursor navigation #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/editor-completer-nav"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The in-app editor's
[[completion strip is meant to be a typing affordance, butrefreshCompleterran after every forwarded key — arrows,Home/End,PageUp/PageDown, and on file open. So moving the caret onto a pre-existing unclosed[[name(or opening a file that ends in one) spuriously popped the strip open, often with a "+ Create" row.Root cause:
linkCompleter.refreshactivated whenever the caret sat to the right of an unclosed[[with no]]ahead, regardless of what triggered the refresh. (The old code comment even falsely claimed it ran "after every textarea-mutating key.")Fix: gate activation on an actual buffer mutation.
refreshgained anallowOpen bool;EditorView.Updatesets it by comparingta.Value()before/after the key. Mount, accept, andPageUp/PageDownpassfalse. An already-open strip still updates and closes as you navigate; only an edit can open a closed one.Found via reproduction harness, fixed with TDD (failing tests first), and given a code-quality review (approved).
Test Plan
go vet ./... && go test ./...greenUpdate/mount path: navigate onto unclosed[[stays closed; opening a file ending in[[stays closed; typing into an unclosed[[after navigating opens; dismiss-then-navigate stays closedlinkCompleterunit test for theallowOpengate (open-only-on-edit, update-and-close-on-nav)Ships in v1.4.0 (held release).