silverbulletmd / silverbullet

The knowledge hacker's notebook
https://silverbullet.md
MIT License
2.32k stars 168 forks source link

Bug report: vim search mode would leak delete key #976

Open LumenYoung opened 1 month ago

LumenYoung commented 1 month ago

As suggested in the title, I find this potential bug, and it is easy to reproduce on my side

  1. enable vim mode
  2. type / to enter search mode
  3. enter random characters and then backspace to simulate a deletion

Expected behavior: the character in search should be delete

Current behavior: the searched content is not deleted, rather the character under the cursor is deleted.

SB Version: 0.8.1

erinsummer commented 1 month ago

I'm able to reproduce this in 0.9.0 as well.

I'm seeing the issue any time the cursor is supposed to be focused in the vim command line. I thought perhaps it was related to one of my (many) browser extensions, but after disabling them all the input focus shift persists.

Specifics:

  1. enable vim mode
  2. use a vim motion (select some text, start a search, anything to open the command editor). I was trying to do a find/replace using :s%, and kept making typing errors. Arrow keys, backspace, and maybe some other keys seem to be sent back to the editor rather than the vim command line
  3. Escaping out of the vim command leaves one with whatever changes were made by the keystrokes being passed through to their document instead of their vim command prompt

Expected: send the keystrokes to the (focused) vim command prompt rather than the main editor itself

meain commented 1 month ago

Probably related. I've had cases where when I press G to go to the last line in normal mode, it would just enter that into the editor.