vimium-c icon indicating copy to clipboard operation
vimium-c copied to clipboard

Movement bug of key "zero" in visual mode. 19 j works, but 20j works as j because 0 cancels 2 and j works singly

Open fish1968 opened this issue 1 year ago • 2 comments

Describe the bug When in cater mode and as 0-key is pressed, the hover element is moved to the head of its line. However, this zero-key action happens even after another number key has been pressed and waiting for movement. As an example, 9j works by moving the selection 9 lines down, while 10j works seperately as first 1 and 0 cancels 1's effect and j works by moving seletion one line down.

To Reproduce

Steps to reproduce the behavior:

  1. open a page where vimium-c works
  2. press ’y' and 'v' and select a text to highlight
  3. press '1' and '0'
  4. press 'j', you should find the highlighted position is moved by 1 line not 10.

Browser, OS and Vimium C versions

  • Browser name: Chrome
  • Browser version: Version 119.0.6045.212 (Official Build) (64-bit)
  • Vimium C version: 1.99.99.
  • OS name and version: Chrome OS and Version 119.0.6045.212 (Official Build) (64-bit)

fish1968 avatar Dec 30 '23 11:12 fish1968

this bug happens only in Visual Mode, it won't appear in normal mode

fish1968 avatar Dec 30 '23 11:12 fish1968

Well it's not a bug, but indeed a feature, which was not well-designed:

  • by default, VisualMode uses 0 to modify a current selection to select from line beginning to current caret
  • so 10 made Vimium C "create such a selection by 1 times"

I'll add a special check for this, to prevent 0 after a number prefix being triggered.

gdh1995 avatar Jan 01 '24 12:01 gdh1995