Repository navigation
fix(vi): repaint whenever the mode changes - #1256
Conversation
5d989ff to
71d842d
Compare
|
Hmm, but i think the fix belongs one layer down. |
71d842d to
11a3d90
Compare
|
Thanks for the steer - a mode change not guaranteeing a repaint is the real bug here. I have moved the repaint into It now appends The per-command repaints for Tests now cover this at the dispatch level, including commands that stay in normal mode not gaining a spurious repaint. This is amended into the original commit as |
|
Thanks thats what I had in mind. |
a, A or I enter insert mode without moving the cursor|
I just updated the body and title so if one comes back to it, it reflects the new structure. Hope thats fine for you. |
|
Thanks a lot, Martin, for steering this one down to the dispatch layer! Pointing at how Helix wraps every I also appreciate you retitling the PR and reworking the description so the history reads right for whoever lands here next. It was a pleasure working through this with you on reedline 🚀 |
|
Sure, was a pleasure. |
## Description Bumps reedline to `c8d81b2`, five PRs past `39db5e3`: - nushell/reedline#1256 `fix(vi): repaint whenever the mode changes` - nushell/reedline#1244 `feat(hints): let hinters and highlighters handle hints before auto-pair closers` - nushell/reedline#1261 `fix(menu): take the partial completion across all suggestion spans` - nushell/reedline#1263 `fix(engine): treat Ctrl+J as a line ending when draining the input batch` - nushell/reedline#1257 `feat(external_printer): ungate the printer and commit messages in one frame` `#1244` replaces the unreleased `#1239` behavior with hooks that default to the last release, so hints before auto-pair closers come back with #19199 `#1261` only changes the partial reedline derives itself, and nushell passes its own, so `foo re<Tab>` keeps its current behavior until the nushell side follows ### User-facing changes (Release notes) - Fixed the vi prompt indicator not switching to insert on `a`, `A` or `I` when the cursor does not move. - Fixed piped input with several LF-terminated lines dropping every line after the first.
Summary
Pressing
aon an empty buffer switched Vi to insert mode, but theMoveRightit emits isInapplicablesince #1208.Only handled events trigger a repaint, so the prompt kept showing the normal-mode indicator until the next keystroke.
AandIhit the same path when the cursor is already at the line end or start.The real bug is that a mode change does not guarantee a repaint, so the fix sits in the Vi dispatch in
vi/mod.rs, wherechanges_modeis applied.Whenever the mode actually changes,
Repaintis appended to the event, mirroring helix'sMultiple([event, Repaint])onnext_mode.Events that already end in
Repaint(i,c<motion>) don't get a second one, and commands that reportNormalfromNormal(dw,yy) get none.Leaving Visual for Normal now repaints as well.
No public API change.
Before
Empty line, Esc shows
NORMAL>, thenastill showsNORMAL>until a character is typed.After
a,AandIshowINSERT>right away, as does every other mode switch.Additional notes
Dispatch tests cover entering insert, no duplicate
Repaint, and no spuriousRepaintwhen staying in Normal.Fixes #1255