vimium icon indicating copy to clipboard operation
vimium copied to clipboard

Cannot go to caret mode from normal mode

Open tuanbass opened this issue 3 years ago • 5 comments

In recent releases, I cannot go to the caret mode (by press "vc") from Normal mode. So I create this patch to have it back.

tuanbass avatar Aug 04 '21 03:08 tuanbass

Hi, thanks for fixing the caret mode. :)

But there's one little bug here: In caret mode, forward word jumping using w or e acts just like in visual mode, but the selection only jumps forward the first time the key is pressed and then stops there. While in visual mode w and e do act properly.

I suppose it's due to the altering below (starting from line 55):

    // Native word movements behave differently on Linux and Windows, see #1441.  So we implement some of them
    // character-by-character.
    if (granularity === vimword && direction === forward) {
      while (this.nextCharacterIsWordCharacter())
        if (this.extendByOneCharacter(forward) === 0)
          return;
      while (this.getNextForwardCharacter() && !this.nextCharacterIsWordCharacter())
        if (this.extendByOneCharacter(forward) === 0)
          return;
    } else if (granularity === vimword) {
      return this.selection.modify(this.alterMethod, backward, word);
    }

FYI: I'm using Chrome 96 on Mac 10.15

twio142 avatar Dec 12 '21 05:12 twio142

Would love to see his merged!

chuckmasucci avatar Jan 28 '22 17:01 chuckmasucci

@tuanbass Hello, you have pushed some new commits to the master branch of your repo, while it's about scrolling, but not VisualMode. This affects this PR because the PR is bound to tuanbass:master directly.

gdh1995 avatar May 30 '22 07:05 gdh1995

@tuanbass Hello, you have pushed some new commits to the master branch of your repo, while it's about scrolling, but not VisualMode. This affects this PR because the PR is bound to tuanbass:master directly.

Thanks for pointing out. As the PR was opened for a long time, I have nearly forgotten about it, and tried to fix another bug. Anyway, I reverted the last commit, and hope the PR will be merged soon.

tuanbass avatar Jul 11 '22 16:07 tuanbass

Any idea when this will be merged? Would really benefit from this functionality. Thank you.

roryfahy avatar Sep 08 '22 21:09 roryfahy

This is great; thanks for the cleanup and the fix @tuanbass !

philc avatar Oct 17 '22 06:10 philc

Just now I reviewed all my code in #3867, and I found this PR lacks a place: https://github.com/philc/vimium/blob/66adcdeaaf914f6ffc1c3c11e30c7f269ae15ac7/content_scripts/mode_visual.js#L380-L383

Here a following .init() for new VisualMode() is also necessary. @philc

gdh1995 avatar Oct 17 '22 06:10 gdh1995

Good catch @gdh1995; fixed in 5c00e2e029ed0f40a63054cdebfc75615721175a

philc avatar Oct 18 '22 01:10 philc