Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move(Big)WordRightEnd is off-by-1 in insert mode #766

Open
bew opened this issue Mar 9, 2024 · 1 comment
Open

Move(Big)WordRightEnd is off-by-1 in insert mode #766

bew opened this issue Mar 9, 2024 · 1 comment
Labels
A-ViKeybinding Area: Vi(m) keybinding support bug Something isn't working

Comments

@bew
Copy link
Contributor

bew commented Mar 9, 2024

Platform Linux (NixOS)
Terminal software Wezterm

Using nushell 0.91.0

Steps to reproduce

  1. In your nushell config, setup a keybind with:
     {
       name: move_to_end_word
       mode: [emacs vi_insert vi_normal]
       modifier: Alt keycode: Char_e
       event: {edit: MoveWordRightEnd}
     }
     {
       name: move_to_end_WORD
       mode: [emacs vi_insert vi_normal]
       modifier: Alt_Shift keycode: Char_E
       event: {edit: MoveBigWordRightEnd}
     }
  2. Write this is some/cmd in nushell
  3. Put cursor on s of some, make sure you are in insert mode:
    this is |some/cmd
  4. Do Alt-e, cursor is now between m & e instead of between e & /:
    this is som|e/cmd
  5. Do Alt-E, cursor is now between m & d instead of at the end of the input buffer:
    this is some/cm|d

Note that normal mode works okay, only insert mode isn't working correctly.

Screenshots/Screencaptures

nushell.move.word.end.broken.in.insert.mode.mov
@bew bew added the bug Something isn't working label Mar 9, 2024
@sholderbach sholderbach added the A-ViKeybinding Area: Vi(m) keybinding support label Mar 11, 2024
@sholderbach
Copy link
Member

Good catch!

This is another case where our vi emulation breaks down.

The Editor/LineBuffer don't know anything about the Vi mode and just get EditCommands we emit in the emulation layer.
The word moves where designed with the cursor position reflecting the normal mode but the shifted cursor in insert mode was not taken into account (see also the recent #699 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ViKeybinding Area: Vi(m) keybinding support bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants