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

Feature/improved jump list #3028

Merged
merged 48 commits into from Sep 10, 2018

Conversation

Projects
None yet
6 participants
@shawnaxsom
Copy link
Contributor

shawnaxsom commented Sep 5, 2018

What this PR does / why we need it:

There have been several issues opened in the past that discuss the limitations of the current <C-o> and <C-i> jump list implementation, which relies on vscode internals.

The largest criticism is that small movements (such as j and k) are registered as jumps (vscode has an internal "jump" tracker, a history service, that is hard-coded with constant EDITOR_SELECTION_THRESHOLD to register a jump after moving 10 lines). The history was also limited. A common use case is to jump to definition in another file, navigate around that file to learn about how it works, and then to jump back. The user would have to jump back many times more than in vanilla Vim, and often would hit the start of history as old entries are truncated off.

This PR therefore implements our own jump list (or "Jump Tracker", in vein of the name of our "History Tracker" that is used for undo/redo). This gives us much more control of jump history, and I have also matched it with vanilla Vim behavior.

Motions and actions can now set an isJump flag to mark that they should be tracked as a jump. I have updated all of the existing motions and jumps to match vanilla Vim. Substitutes and some commands will also count jumps.

For testing, I enhanced testSimplifier to allow tracking jump position and jump entries. In the tests I wrote, I made sure to compare to vanilla Vim, matching the :jumps command in the expected jump results.

Which issue(s) this PR fixes

fixes #1933
fixes #2461

Special notes for your reviewer:

I ran into some issues trying to unit test, that I believe is unrelated to this PR. I tried to fix a few of the issues. I am still seeing this one:

error: ModeHandler: error handling key=d. err=TypeError: Cannot read property 'document' of undefined.

That seems to happen for the first test in the list if I run an individual test suite like this:

MOCHA_GREP='Can record jumps for actions the same as vanilla Vim' npm test

Anyway, here are some future enhancement ideas / limitations:

  • Add :jumps and :clearjumps commands, matching Vim's built-in commands
  • Neovim-based commands aren't tracked granularly, such as :substitute.
  • Jumps where files were deleted may show a benign error Unable to open...File not found.... Behavior works fine, and you can continue to jump to previous entries. I wonder if there is a way to detect the error and remove the jump after the fact in case they jump to that point again.
  • Split panes share the jump list. This seems similar to how vscode itself works with the built-in back functionality. I'm storing the JumpTracker in GlobalState. I don't know that we have per-pane state, so if we wanted to make it per-pane it would take a little more work.

shawnaxsom added some commits Aug 27, 2018

For now, check if file exists before jumping. Otherwise sometimes the…
…re are errors for files that don't exist, like extension-output-#4.
Make jumpTracker work more like standard Vim.
Existing jumps get pushed to the end.
No clearing of jumps after current position.
@TravisBuddy

This comment has been minimized.

Copy link

TravisBuddy commented Sep 6, 2018

Travis tests have failed

Hey @axs221,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 8

npm test --silent
### VS Code Extension Test Run ###
Current working directory: /home/travis/build/VSCodeVim/Vim
Downloading VS Code into "/home/travis/build/VSCodeVim/Vim/.vscode-test/stable" from: https://vscode-update.azurewebsites.net/1.27.0/linux-x64/stable
Running extension tests: /home/travis/build/VSCodeVim/Vim/.vscode-test/stable/VSCode-linux-x64/code /home/travis/build/VSCodeVim/Vim/out/test --extensionDevelopmentPath=/home/travis/build/VSCodeVim/Vim --extensionTestsPath=/home/travis/build/VSCodeVim/Vim/out/test
Xlib:  extension "RANDR" missing on display ":99.0".

[main 2:26:31 AM] update#setState idle

xdg-settings: unknown desktop environment

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

nvm is not compatible with the "npm_config_prefix" environment variable: currently set to "/home/travis/.nvm/versions/node/v8.11.4"
Run `unset npm_config_prefix` to unset it.





  base action

    ✓ compare key presses

    ✓ couldActionApply 1D keys positive

    ✓ couldActionApply 1D keys negative
    ✓ couldActionApply 2D keys positive
    ✓ couldActionApply 2D keys negative
    ✓ doesActionApply 1D keys positive
    ✓ doesActionApply 1D keys negative
    ✓ doesActionApply 2D keys positive
    ✓ doesActionApply 2D keys negative



  command-line history

    ✓ add command

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

    ✓ add empty command

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

    ✓ add command over configuration.history

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

    ✓ add command that exists in history

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

    ✓ load and save history

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

    ✓ change configuration.history



  command-line lexer

    ✓ can lex empty string

    ✓ can lex comma

    ✓ can lex percent

    ✓ can lex dollar

    ✓ can lex dot

    ✓ can lex one number

    ✓ can lex longer number

    ✓ can lex plus

    ✓ can lex minus

    ✓ can lex forward search

    ✓ can lex forward search escaping

    ✓ can lex reverse search

    ✓ can lex reverse search escaping

    ✓ can lex command name

    ✓ can lex command args

    ✓ can lex command args with leading whitespace

    ✓ can lex long command name and args

    ✓ can lex left and right line refs



  command-line parser

    ✓ can parse empty string

    ✓ can parse left - dot

    ✓ can parse left - dollar

    ✓ can parse left - percent

    ✓ can parse separator - comma

    ✓ can parse right - dollar



  command line scanner

    ✓ ctor

    ✓ can detect EOF with empty input

    ✓ next() returns EOF at EOF

    ✓ can scan

    ✓ can emit

    ✓ can ignore

    ✓ can skip whitespace

    ✓ can skip whitespace with one char before EOF

    ✓ can skip whitespace at EOF

    ✓ nextWord() return EOF at EOF

    ✓ nextWord() return word before trailing spaces

    ✓ nextWord() can skip whitespaces and return word 

    ✓ nextWord() return word before EOF

    ✓ can expect one of a set

    ✓ can expect only one of a set



  Basic sort

    ✓ Sort whole file, asc (192ms)

    ✓ Sort whole file, dsc (105ms)

rejected promise not handled within 1 second

rejected promise not handled within 1 second

rejected promise not handled within 1 second

rejected promise not handled within 1 second

    ✓ Sort range, asc (192ms)

rejected promise not handled within 1 second

    ✓ Sort range, dsc (134ms)



  :close args parser

    ✓ has all aliases
    ✓ can parse empty args
    ✓ ignores trailing white space
    ✓ can parse !
    ✓ throws if space before !

    ✓ ignores space after !

    ✓ throws if bad input



  :quit args parser

    ✓ has all aliases

    ✓ can parse empty args

    ✓ ignores trailing white space

    ✓ can parse !

    ✓ throws if space before !
    ✓ ignores space after !

    ✓ throws if bad input



  :substitute args parser

    ✓ can parse pattern, replace, and flags

    ✓ can parse count

    ✓ can parse custom delimiter

    ✓ can escape delimiter

    ✓ can parse flag KeepPreviousFlags



  :write args parser

    ✓ has all aliases

    ✓ can parse empty args

    ✓ can parse ++opt

    ✓ throws if bad ++opt name

    ✓ can parse bang

    ✓ can parse ' !cmd'

    ✓ can parse ' !cmd' when cmd is empty



  Basic substitute

    ✓ Replace single word once (85ms)

    ✓ Replace with `g` flag (92ms)

    ✓ Replace multiple lines (184ms)

    ✓ Replace across specific lines (171ms)

    ✓ Replace current line with no active selection (148ms)

    ✓ Replace text in selection (194ms)

    ✓ Substitute support marks (208ms)

    Effects of substituteGlobalFlag=true

      ✓ Replace all matches in the line (109ms)

      ✓ Replace with `g` flag inverts global flag (119ms)

      ✓ Replace multiple lines (171ms)

      ✓ Replace across specific lines (157ms)

      ✓ Replace current line with no active selection (149ms)

      ✓ Replace text in selection (222ms)

      ✓ Substitute support marks (457ms)

      ✓ Substitute with escaped delimiter (127ms)
    Substitute with empty search string should use previous search

      ✓ Substitute with previous search using * (410ms)

      ✓ Substitute with previous search using # (384ms)

      ✓ Substitute with previous search using / (367ms)

      ✓ Substitute with empty search string should use last searched pattern (388ms)



  cmd_line tab

    ✓ tabe with no arguments when not in workspace opens an untitled file (59ms)

    ✓ tabedit with no arguments when not in workspace opens an untitled file (38ms)

    ✓ tabe with absolute path when not in workspace opens file (84ms)

    ✓ tabe with current file path does nothing (53ms)



  Vertical split

    ✓ Run :vs (102ms)

    ✓ Run :vsp (66ms)



  Basic write-quit

    ✓ Run write and quit (108ms)



  Configuration

    ✓ remappings are normalized

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

    ✓ Can handle long key chords (78ms)

    ✓ whichwrap is parsed into wrapKeys

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.



  Notation

    ✓ Normalize



  Remapper

    ✓ getLongestedRemappedKeySequence

    ✓ getMatchingRemap

    1) jj -> <Esc> through modehandler

TextEditor is closed/disposed

TextEditor is closed/disposed

TextEditor is closed/disposed

TextEditor is closed/disposed

TextEditor is closed/disposed

    ✓ 0 -> :wq through modehandler (42ms)

    ✓ leader, w -> closeActiveEditor in normal mode through modehandler

    ✓ leader, c -> closeActiveEditor in visual mode through modehandler (40ms)

  Error
    ✓ error code has message

  package.json

    ✓ all keys have handlers

    ✓ all defined configurations in package.json have handlers



  Record and navigate jumps

    Jump Tracker unit tests

      ✓ Can record jumps between files

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

      ✓ Can record jumps between files after switching files

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

      ✓ Can handle jumps to the same file multiple times

rejected promise not handled within 1 second

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

      ✓ Can record up to 100 jumps, the fixed length in vanilla Vim

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.

    Can record jumps for actions the same as vanilla Vim
      Can track basic jumps

rejected promise not handled within 1 second

        ✓ Can track jumps for keys: Ggg (119ms)

        ✓ Can track jumps for keys: GggG (138ms)

        ✓ Can track jumps for keys: GggGgg (160ms)

rejected promise not handled within 1 second

rejected promise not handled within 1 second

        ✓ Can track jumps for keys: /b<CR>n (137ms)

rejected promise not handled within 1 second

rejected promise not handled within 1 second

        ✓ Can track jumps for keys: G?b<CR>ggG (105ms)

        ✓ Can track jumps for keys: j%% (122ms)

      Can track jumps with back/forward

        ✓ Can track jumps for keys: j%%<C-o> (116ms)

        ✓ Can track jumps for keys: j%%<C-o><C-i> (136ms)

        ✓ Can track jumps for keys: j%%<C-o>% (121ms)

        ✓ Can track jumps for keys: j%%<C-o>gg (122ms)

        ✓ Can track jumps for keys: j%%<C-o><C-o>gg (109ms)

        ✓ Can track jumps for keys: /^<CR>nnn<C-o><C-o><C-o><C-i>gg (188ms)

        ✓ Can enter number to jump back multiple times (149ms)

      Can shifts jump lines up after deleting a line

        ✓ Can track jumps for keys: /^<CR>nnnkkdd (283ms)

        ✓ Can track jumps for keys: /^<CR>nnnkdd (222ms)

        ✓ Can track jumps for keys: /^<CR>nnnnn<C-o><C-o><C-o><C-o>dd (179ms)

        ✓ Can track jumps for keys: /a4<CR>/a5<CR>kkkdd (233ms)

      Can shift jump lines down after inserting a line

        ✓ Can track jumps for keys: /^<CR>nnnkkoINSERTED<Esc>0 (326ms)

        ✓ Can track jumps for keys: /^<CR>nnnkoINSERTED<Esc>0 (217ms)

        ✓ Can track jumps for keys: /^<CR>nnnkOINSERTED<Esc>0 (251ms)

        ✓ Can track jumps for keys: /a4<CR>/a5<CR>kkkoINSERTED<Esc>0 (245ms)

      Can track jumps from substitutes

        ✓ Can track jumps for keys: :%s/a/b<CR> (134ms)

      Can track jumps from macros

        ✓ Can track jumps for keys: qq/^<CR>nq@q@q<C-o><C-o> (437ms)

      Can track jumps from marks

        ✓ Can track jumps for keys: maG`a (129ms)


  Record and execute a macro

    ✓ Can record and execute (235ms)

    ✓ Can repeat last invoked macro (373ms)

    ✓ Can play back with count (524ms)

    ✓ Can play back with count, abort when a motion fails (554ms)

    ✓ Repeat change on contiguous lines (419ms)

    ✓ Append command to a macro (421ms)

    ✓ Can record Ctrl Keys and repeat (383ms)

    ✓ Can execute macros with dot commands properly (313ms)


  Mode Handler

    ✓ ctor

    ✓ can set current mode



  Mode Handler Map

    ✓ getOrCreate



  Mode Insert

    ✓ can be activated (201ms)

    ✓ can handle key events (62ms)

    ✓ <Esc> should change cursor position (121ms)

    ✓ <C-c> can exit insert (186ms)

    ✓ <Esc> can exit insert (170ms)

    ✓ Stay in insert when entering characters (161ms)

    ✓ Can handle 'O' (126ms)

    ✓ Can handle 'i' (262ms)

    ✓ Can handle 'I' (172ms)

    ✓ Can handle 'a' (260ms)

    ✓ Can handle 'A' (140ms)

[main 2:27:01 AM] update#setState checking for updates

[main 2:27:01 AM] update#setState idle

    ✓ Can handle '<C-w>' (227ms)

    ✓ Can handle <C-w> on leading whitespace (123ms)

    ✓ Can handle <C-w> at beginning of line (117ms)

    ✓ Can handle <C-u> (229ms)

    ✓ Can handle <C-u> on leading characters (260ms)

    ✓ Can handle <C-u> on leading whitespace (168ms)

    ✓ Correctly places the cursor after deleting the previous line break (173ms)

    ✓ will not remove leading spaces input by user (58ms)

    ✓ will remove closing bracket (74ms)

    ✓ Backspace works on whitespace only lines (142ms)

    ✓ Backspace works on end of whitespace only lines (152ms)

    ✓ Backspace works at beginning of file (120ms)

    ✓ Can perform <ctrl+o> to exit and perform one command in normal (197ms)

    ✓ Can perform <ctrl+o> to exit and perform one command in normal at the beginning of a row (97ms)

    ✓ Can perform insert command prefixed with count (146ms)

    ✓ Can perform append command prefixed with count (147ms)

    ✓ Can perform insert at start of line command prefixed with count (95ms)

    ✓ Can perform append to end of line command prefixed with count (89ms)

    ✓ Can perform change char (s) command prefixed with count (164ms)

    ✓ Can perform command prefixed with count with <C-[> (106ms)

    ✓ Can handle 'o' with count (171ms)

    ✓ Can handle 'O' with count (101ms)



  Mode Normal

    ✓ Can be activated (41ms)

    ✓ Can handle dw (112ms)

    ✓ Can handle dw (66ms)

    ✓ Can handle dw (113ms)

    ✓ Can handle dw across lines (1) (97ms)

    ✓ Can handle dw across lines (2) (93ms)

    ✓ Can handle dd last line (149ms)

    ✓ Can handle dd single line (79ms)

    ✓ Can handle dd (63ms)

    ✓ Can handle 3dd (118ms)

    ✓ Can handle 3dd off end of document (107ms)

    ✓ Can handle d2d (126ms)

    ✓ Can handle dd empty line (132ms)

    ✓ Can handle ddp (115ms)

    ✓ Can handle 'de' (188ms)

    ✓ Can handle 'de' then 'de' again (232ms)

    ✓ Can handle 'db' (191ms)

    ✓ Can handle 'db then 'db' again (211ms)

    ✓ Can handle 'dl' at end of line (216ms)

    ✓ Can handle 'dF' (134ms)

    ✓ Can handle 'dT' (127ms)

    ✓ Can handle 'd3' then <enter> (99ms)

    ✓ Can handle 'dj' (94ms)

    ✓ Can handle 'dk' (179ms)

    ✓ Can handle 'd])' without deleting closing parenthesis (208ms)

    ✓ Can handle 'd]}' without deleting closing bracket (134ms)

    ✓ Can handle 'cw' (202ms)

    ✓ Can handle 'cw' without deleting following white spaces (99ms)

    ✓ Can handle 'c2w' (128ms)

    ✓ Can handle 'cw' without removing EOL (93ms)

    ✓ Can handle 'c])' without deleting closing parenthesis (150ms)

    ✓ Can handle 'c]}' without deleting closing bracket (135ms)

    ✓ Can handle 's' (139ms)

    ✓ Can handle 'yiw' with correct cursor ending position (94ms)

    ✓ Can handle 'ciw' (187ms)

    ✓ Can handle 'ciw' on blanks (317ms)

    ✓ Can handle 'caw' (215ms)

    ✓ Can handle 'caw' on first letter (189ms)

    ✓ Can handle 'caw' on blanks (211ms)

    ✓ Can handle 'caw' on blanks (156ms)

    ✓ Can handle 'ci(' on first parentheses (149ms)

    ✓ Can handle 'ci(' with nested parentheses (161ms)

    ✓ Can handle 'ci(' backwards through nested parens (161ms)

    ✓ Can handle 'cib' on first parentheses (115ms)

    ✓ Can handle 'ci(' across multiple lines with last character at beginning (94ms)

    ✓ Can handle count prefixed 'ci)' (151ms)

    ✓ Can handle count prefixed 'ca)' (151ms)

    ✓ Can handle 'ca(' spanning multiple lines (107ms)

    ✓ Can handle 'cab' spanning multiple lines (261ms)

    ✓ Can handle 'ci{' spanning multiple lines (155ms)

    ✓ Can handle 'ci{' spanning multiple lines and handle whitespaces correctly (109ms)

    ✓ Can handle 'ci{' spanning multiple lines and handle whitespaces correctly (89ms)

    ✓ Can handle 'ci(' on the closing bracket (106ms)

    ✓ Can handle 'ciB' spanning multiple lines (146ms)

    ✓ will fail when ca( with no () (64ms)

    ✓ will fail when ca{ with no {} (66ms)

    ✓ will fail when caB with no {} (114ms)

    ✓ Can handle 'ci[' spanning multiple lines (108ms)

    ✓ Can handle 'ci]' on first bracket (110ms)

    ✓ Can handle 'ca[' on first bracket (103ms)

    ✓ Can handle 'ca]' on first bracket (79ms)

    ✓ Can handle 'ci'' on first quote (137ms)

    ✓ Can handle 'ci'' inside quoted string (90ms)

    ✓ Can handle 'ci'' on closing quote (93ms)

    ✓ Can handle 'ci'' when string is ahead (97ms)

    ✓ Can handle 'ci"' on opening quote (78ms)

    ✓ Can handle 'ci"' starting behind the quoted word (88ms)

    ✓ Can handle 'ca"' starting behind the quoted word (92ms)

    ✓ Can handle 'ca"' starting on the opening quote (102ms)

    ✓ Can handle 'ci"' with escaped quotes (177ms)

    ✓ Can handle 'ci"' with a single escaped quote (76ms)

    ✓ Can handle 'ci"' with a single escaped quote behind (126ms)

    ✓ Can handle 'ci"' with an escaped backslash (163ms)

    ✓ Can handle 'ci"' with an escaped backslash on closing quote (80ms)

    ✓ Can handle 'ca"' starting on the closing quote (86ms)

    ✓ Can handle 'ci"' with complex escape sequences (91ms)

    ✓ Can pick the correct open quote between two strings for 'ci"' (106ms)

    ✓ will fail when ca" ahead of quoted string (113ms)

    ✓ Can handle 'ca`' inside word (142ms)

    ✓ Can handle 'daw' on word with cursor inside spaces (132ms)

    ✓ Can handle 'daw' on word with trailing spaces (122ms)

    ✓ Can handle 'daw' on word with leading spaces (140ms)

    ✓ Can handle 'daw' on word with numeric prefix (109ms)

    ✓ Can handle 'daw' on word with numeric prefix and across lines (253ms)

    ✓ Can handle 'daw' on word with numeric prefix and across lines (154ms)

    ✓ Can handle 'daw' on word with numeric prefix and across lines, containing words end with `.` (190ms)

    ✓ Can handle 'daw' on end of word (236ms)

    ✓ Can handle 'daw' on words at beginning of line with leading whitespace (123ms)

    ✓ Can handle 'daw' on words at ends of lines in the middle of whitespace (127ms)

    ✓ Can handle 'daw' on word at beginning of file (77ms)

    ✓ Can handle 'daw' on word at beginning of line (88ms)

    ✓ Can handle 'daw' on word at end of line with trailing whitespace (113ms)

    ✓ Can handle 'daw' around word at end of line (129ms)

    ✓ Can handle 'daW' on big word with cursor inside spaces (145ms)

    ✓ Can handle 'daW' around word at whitespace (138ms)

    ✓ Can handle 'daW' on word with trailing spaces (186ms)

    ✓ Can handle 'daW' on word with leading spaces (169ms)

    ✓ Can handle 'daW' on word with numeric prefix (85ms)

    ✓ Can handle 'daW' on word with numeric prefix and across lines (209ms)

    ✓ Can handle 'daW' on beginning of word (123ms)

    ✓ Can handle 'daW' on end of one line (93ms)

    ✓ Can handle 'daW' around word at the last WORD (t|wo) (131ms)

    ✓ Can handle 'daW' around word at the last WORD (tw|o) (137ms)

    ✓ Can handle 'daW' around word at the last WORD (class="btn"|>) (193ms)

    ✓ Can handle 'daW' around word at the last WORD of the end of document (class="btn"|>) (178ms)

    ✓ Can handle 'daW' around word at the last WORD (c|lass="btn">) (115ms)

    ✓ Can handle 'daW' around word at the last WORD of the end of document (c|lass="btn">) (166ms)

    ✓ Can handle 'diw' on word with cursor inside spaces (100ms)

    ✓ Can handle 'diw' on word (130ms)

    ✓ Can handle 'diw' on word with numeric prefix (154ms)

    ✓ Can handle 'diw' on trailing spaces at the end of line (203ms)

    ✓ Can handle 'diw' on word with numeric prefix and across lines (275ms)

    ✓ Can handle 'diw' on word with numeric prefix and across lines, containing words end with `.` (215ms)

    ✓ Can handle 'diW' on big word with cursor inside spaces (178ms)

    ✓ Can handle 'diW' on word with trailing spaces (130ms)

    ✓ Can handle 'diW' on word with leading spaces (178ms)

    ✓ Can handle 'diW' on word with numeric prefix (141ms)

    ✓ Can handle 'diW' on word with numeric prefix and across lines (150ms)

    ✓ Can handle 'diW' on beginning of word (131ms)

    ✓ Can handle d} (99ms)

    ✓ Can handle y} at beginning of line (172ms)

    ✓ Select sentence with trailing spaces (232ms)

    ✓ Select sentence with leading spaces (521ms)

    ✓ Select inner sentence with trailing spaces (360ms)

    ✓ Select inner sentence with leading spaces (482ms)

    ✓ Select spaces between sentences (332ms)

    ✓ Can handle 'df' (110ms)

    ✓ Can handle 'dt' (220ms)

    ✓ Can handle backspace (124ms)

    ✓ Can handle backspace across lines (136ms)

    ✓ Can handle A and backspace (100ms)

    ✓ Can handle 'yy' without changing cursor position (131ms)

    ✓ Can handle 'P' after 'yy' (175ms)

    ✓ Can handle 'p' after 'yy' (198ms)

    ✓ Can handle 'P' after 'Nyy' (186ms)

    ✓ Can handle 'p' after 'Nyy' (161ms)

    ✓ Can handle 'p' after 'yy' with correct cursor position (108ms)

    ✓ Can handle 'gp' after 'yy' (147ms)

    ✓ Can handle 'gp' after 'Nyy' (142ms)

    ✓ Can handle 'gp' after 'Nyy' if cursor is on the last line (170ms)

    ✓ Can handle 'gP' after 'yy' (150ms)

    ✓ Can handle 'gP' after 'Nyy' (140ms)

    ✓ Can handle ']p' after yy (194ms)

    ✓ Can handle ']p' after 'Nyy' (186ms)

    ✓ Can handle ']p' after 'Nyy' and indent with tabs first (150ms)

    ✓ Can handle ']p' after 'Nyy' and decrease indents if possible (201ms)

    ✓ Can handle '[p' after yy (160ms)

    ✓ Can handle '[p' after 'Nyy' (141ms)

    ✓ Can handle '[p' after 'Nyy' and indent with tabs first (130ms)

    ✓ Can handle '[p' after 'Nyy' and decrease indents if possible (124ms)

    ✓ Can handle 'p' after y'a (122ms)

    ✓ Can handle 'p' after 'y])' without including closing parenthesis (165ms)

    ✓ Can handle 'p' after 'y]}' without including closing bracket (133ms)

    ✓ Can handle pasting in visual mode over selection (148ms)

    ✓ Can repeat w (71ms)

    ✓ Can repeat p (99ms)

    ✓ I works correctly (120ms)

    ✓ gI works correctly (135ms)

    ✓ gi works correctly (156ms)

    ✓ `. works correctly (134ms)

    ✓ '. works correctly (182ms)

    ✓ g; works correctly (203ms)

    ✓ g, works correctly (169ms)

    ✓ g_ works correctly (91ms)

    ✓ 3g_ works correctly (271ms)

    ✓ Can handle space (71ms)

    ✓ Can handle space (94ms)

    ✓ Undo 1 (231ms)

    ✓ Undo 2 (147ms)

    ✓ Undo cursor (257ms)

    ✓ Undo cursor 2 (175ms)

    ✓ Undo cursor 3 (186ms)

    ✓ Undo with movement first (165ms)

    ✓ Can handle 'U' (118ms)

    ✓ Can handle 'U' for multiple changes (187ms)

    ✓ Can handle 'U' for new line below (182ms)

    ✓ Can handle 'U' for new line above (180ms)

    ✓ Can handle 'U' for consecutive changes only (216ms)

    ✓ Can handle 'u' to undo 'U' (134ms)

    ✓ Can handle 'U' to undo 'U' (114ms)

    ✓ Redo (200ms)

    ✓ Redo (207ms)

    ✓ Redo (301ms)

    ✓ Can handle u (138ms)

    ✓ Can handle guw (86ms)

    ✓ Can handle gUw (84ms)

    ✓ Can handle u over line breaks (187ms)

    ✓ can handle s in visual mode (185ms)

    ✓ can handle p with selection (148ms)

    ✓ can handle P with selection (101ms)

    ✓ can handle p in visual to end of line (210ms)

    ✓ can repeat backspace twice (171ms)

    ✓ can delete linewise with d2G (78ms)

    ✓ can delete with + motion and count (154ms)

    ✓ can delete with - motion and count (157ms)

    ✓ can dE correctly (94ms)

    ✓ can dE correctly (100ms)

    ✓ can dE correctly (106ms)

    ✓ can ctrl-a correctly behind a word (87ms)

    ✓ can ctrl-a the right word (always the one AFTER the cursor) (92ms)

    ✓ can ctrl-a on word (171ms)

    ✓ can ctrl-a on a hex number (91ms)

    ✓ can ctrl-a on decimal (187ms)

    ✓ can ctrl-a with numeric prefix (115ms)

    ✓ can ctrl-a on a decimal (89ms)

    ✓ can ctrl-a on an octal  (77ms)

    ✓ Correctly increments in the middle of a number (137ms)

    ✓ can ctrl-x correctly behind a word (88ms)

    ✓ can ctrl-a on an number with word before  (69ms)

    ✓ can ctrl-a on an number with word before and after  (43ms)

    ✓ can ctrl-x on a negative number with word before and after  (90ms)

    ✓ can ctrl-a properly on multiple lines (120ms)

    ✓ can <C-a> on word with multiple numbers (incrementing first number) (63ms)

    ✓ can <C-a> on word with multiple numbers (incrementing second number) (99ms)

    ✓ can do Y (64ms)

    ✓ Can do S (122ms)

    ✓ / does not affect mark (111ms)

    ✓ / can search with regex (103ms)

    ✓ / can search with newline (118ms)

    ✓ / can search through multiple newlines (190ms)

    ✓ / matches ^ per line (80ms)

    ✓ / matches $ per line (116ms)

    ✓ /\c forces case insensitive search (99ms)

    ✓ /\C forces case sensitive search (114ms)

    ✓ <BS> deletes the last character in search in progress mode (106ms)

    ✓ <S-BS> deletes the last character in search in progress mode (66ms)

    ✓ <C-h> deletes the last character in search in progress mode (191ms)

    ✓ Can do C (99ms)

    ✓ Can do cit on a matching tag (135ms)

    ✓ Ignores cit on a non-matching tag (127ms)

    ✓ Ignores cit on a nested tag (140ms)

    ✓ Can do cit on a tag with an attribute tag (128ms)

    ✓ Can do cat on a matching tag (193ms)

    ✓ Can do cit on a multiline tag (160ms)

    ✓ Can do cit on a multiline tag with nested tags (249ms)

    ✓ Can do cit inside of a tag with another non closing tag inside tags (233ms)

    ✓ Can do cit inside of a tag with another empty closing tag inside tags (179ms)

    ✓ Can do dit on empty tag block, cursor moves to inside (106ms)

    ✓ Can do cit on empty tag block, cursor moves to inside (143ms)

    ✓ can do cit with self closing tags (235ms)

    ✓ Respects indentation with cc (232ms)

    ✓ Resets cursor to indent end with cc (83ms)

    ✓ can handle 'cc' on empty line (91ms)

    ✓ cc copies linewise (95ms)

    ✓ Indent current line with correct Vim Mode (96ms)

    ✓ Can handle <Esc> and do nothing (58ms)

    ✓ Can handle # on consecutive words (206ms)

    ✓ Can handle # on skipped words (250ms)

    ✓ Can 'D'elete the characters under the cursor until the end of the line (177ms)

    ✓ Can 'D'elete the characters under multiple cursors until the end of the line (273ms)

    ✓ cc on whitespace-only treats whitespace as indent (88ms)

    ✓ Can do cai (238ms)

    ✓ Can do cii (97ms)

    ✓ Can do caI (262ms)

    ✓ Can do dai (375ms)

    ✓ Can do dii (98ms)

    ✓ Can do daI (226ms)

    can handle gn

      ✓ gn selects the next match text (367ms)

      ✓ gn selects the current word at |hello (381ms)

      ✓ gn selects the current word at h|ello (416ms)

      ✓ gn selects the current word at hel|lo (380ms)

      ✓ gn selects the current word at hell|o (377ms)

      ✓ gn selects the next word at hello| (363ms)

    can handle dgn

      ✓ dgn deletes the next match text (from first line) (188ms)

      ✓ dgn deletes the current word when cursor is at |hello (120ms)

      ✓ dgn deletes the current word when cursor is at h|ello (127ms)

      ✓ dgn deletes the current word when cursor is at hel|lo (259ms)

      ✓ dgn deletes the current word when cursor is at hell|o (149ms)

      ✓ dgn deletes the next word when cursor is at hello| (148ms)

    can handle cgn

      ✓ cgn deletes the next match text (from first line) (191ms)

      ✓ cgn deletes the current word when cursor is at |hello (124ms)

      ✓ cgn deletes the current word when cursor is at h|ello (100ms)

      ✓ cgn deletes the current word when cursor is at hel|lo (186ms)

      ✓ cgn deletes the current word when cursor is at hell|o (179ms)

      ✓ cgn deletes the next word when cursor is at hello| (115ms)

    can handle gN

      ✓ gN selects the previous match text (471ms)

      ✓ gN selects the current word at hell|o (304ms)

      ✓ gN selects the current word at hel|lo (555ms)

      ✓ gN selects the current word at h|ello (467ms)

      ✓ gN selects the current word at |hello (520ms)

      ✓ gN selects the previous word at | hello (440ms)

    can handle dgN

      ✓ dgN deletes the previous match text (from first line) (160ms)

      ✓ dgN deletes the current word when cursor is at hell|o (145ms)

      ✓ dgN deletes the current word when cursor is at hel|lo (178ms)

      ✓ dgN deletes the current word when cursor is at h|ello (211ms)

      ✓ dgN deletes the current word when cursor is at |hello (145ms)

      ✓ dgN deletes the previous word when cursor is at | hello (228ms)

    can handle cgN

      ✓ cgN deletes the previous match text (from first line) (203ms)

      ✓ cgN deletes the current word when cursor is at hell|o (138ms)

      ✓ cgN deletes the current word when cursor is at hel|lo (202ms)

      ✓ cgN deletes the current word when cursor is at h|ello (223ms)

      ✓ cgN deletes the current word when cursor is at |hello (338ms)

      ✓ cgN deletes the previous word when cursor is at | hello (183ms)



  Mode Replace

    ✓ Can activate with <insert> from Insert mode (131ms)

    ✓ Can activate with R from Normal mode (140ms)

    ✓ Can handle R (104ms)

    ✓ Can handle R past current line (148ms)

    ✓ Can handle R and exit Replace Mode (122ms)

    ✓ Can handle R across lines (199ms)

    ✓ Can handle R across lines and exit Replace Mode (209ms)

    ✓ Can handle R with {count} (219ms)

    ✓ Can handle backspace (127ms)

    ✓ Can handle backspace (405ms)

    ✓ Can handle backspace across lines (262ms)

    ✓ Can handle arrows (157ms)

    ✓ Can handle . (189ms)

    ✓ Can handle . across lines (302ms)



  Mode Visual

    ✓ can be activated

    ✓ Can handle w (303ms)

    ✓ Can handle wd (356ms)

    ✓ Can handle x (202ms)

    ✓ Can handle x across a selection (174ms)

    ✓ Can do vwd in middle of sentence (289ms)

    ✓ Can do vwd in middle of sentence (258ms)

    ✓ Can do vwd multiple times (323ms)

    ✓ handles case where we go from selecting on right side to selecting on left side (308ms)

    ✓ Can handle H key (95ms)

    ✓ handles case where we delete over a newline (241ms)

    ✓ handles change operator (218ms)

    ✓ Can do vat on multiple matching tags (314ms)

    ✓ Can maintain selection on failure with vat on multiple matching tags (247ms)

    ✓ Can maintain selection on failure with repeat-prefixed vat on multiple matching tags (229ms)

    ✓ Repeat-prefixed vat does not bleed below (141ms)

    ✓ Failed vat does not expand or move selection, remains in visual mode (167ms)

    ✓ Can do vi) on a matching parenthesis (264ms)

    ✓ Can do vi) on multiple matching parens (184ms)

    ✓ Can do va) on a matching parenthesis (135ms)

    ✓ Can do va) on multiple matching parens (152ms)

    ✓ Failed va) does not expand or move selection, remains in visual mode (108ms)

    ✓ Repeat-prefixed va) does not bleed below (142ms)

    ✓ Can do va} on a matching bracket as first character (92ms)

    ✓ Can do va} on multiple matching brackets (223ms)

    ✓ Can do vi( on a matching bracket near first character (123ms)

    ✓ Can do vi{ on outer pair of nested braces (126ms)

    ✓ Can do vi{ on braces indented by 1 and preserve indent (107ms)

    ✓ Can do va] on multiple matching brackets (224ms)

    ✓ Can do repeat-prefixed vaf on multiple matching pairs of different types (191ms)

    ✓ Repeat-prefixed vaf does not bleed below (153ms)

    ✓ vaf only expands to enclosing pairs (229ms)

    ✓ Can use . to repeat indent in visual (116ms)

    ✓ Can do v_x to delete to first char (140ms)

    ✓ Can do vg_x to delete to last char with no EOL (178ms)

    ✓ Can do v3g_x to delete to last char with no EOL with count (176ms)

    ✓ Can do v$x to delete to last char including EOL (153ms)

    ✓ Can do gv to reselect previous selection (117ms)

    Vim's EOL handling is weird

      ✓ delete through eol (160ms)

      ✓ join 2 lines by deleting through eol (141ms)

      ✓ d$ doesn't delete whole line (116ms)

      ✓ vd$ does delete whole line (133ms)

      ✓ Paste over selection copies the selection (108ms)

      ✓ Paste over selection copies the selection linewise (187ms)

    Arrow keys work perfectly in Visual Mode

      ✓ Can handle <up> key (107ms)

      ✓ Can handle <down> key (135ms)

      ✓ Can handle <left> key (111ms)

      ✓ Can handle <right> key (116ms)

    handles aw in visual mode

      ✓ Can handle 'vawd' on word with cursor inside spaces (169ms)

      ✓ Can handle 'vawd' on word with trailing spaces (279ms)

      ✓ Can handle 'vawd' on word with leading spaces (166ms)

      ✓ Can handle 'vawd' on word with numeric prefix (90ms)

      ✓ Can handle 'vawd' on word with numeric prefix and across lines (197ms)

      ✓ Can handle 'vawd' on word with numeric prefix and across lines, containing words end with `.` (214ms)

    handles aW in visual mode

      ✓ Can handle 'vaWd' on big word with cursor inside spaces (182ms)

      ✓ Can handle 'vaWd' on word with trailing spaces (152ms)

      ✓ Can handle 'vaWd' on word with leading spaces (185ms)

      ✓ Can handle 'vaWd' on word with numeric prefix (92ms)

      ✓ Can handle 'vaWd' on word with numeric prefix and across lines (287ms)

    handles aW in visual mode

      ✓ Can handle 'vaWd' on big word with cursor inside spaces (185ms)

      ✓ Can handle 'vaWd' on word with trailing spaces (110ms)

      ✓ Can handle 'vaWd' on word with leading spaces (188ms)

      ✓ Can handle 'vaWd' on word with numeric prefix (220ms)

      ✓ Can handle 'vaWd' on word with numeric prefix and across lines (202ms)

    handles aw in visual mode

      ✓ Can handle 'vawd' on word with cursor inside spaces (139ms)

      ✓ Can handle 'vawd' on word with trailing spaces (159ms)

      ✓ Can handle 'vawd' on word with leading spaces (210ms)

      ✓ Can handle 'vawd' on word with numeric prefix (84ms)

      ✓ Can handle 'vawd' on word with numeric prefix and across lines (225ms)

      ✓ Can handle 'vawd' on word with numeric prefix and across lines, containing words end with `.` (159ms)

    handles aW in visual mode

      ✓ Can handle 'vaWd' on big word with cursor inside spaces (141ms)

      ✓ Can handle 'vaWd' on word with trailing spaces (181ms)

      ✓ Can handle 'vaWd' on word with leading spaces (204ms)

      ✓ Can handle 'vaWd' on word with numeric prefix (151ms)

      ✓ Can handle 'vaWd' on word with numeric prefix and across lines (282ms)

      ✓ Can handle 'Y' in visual mode (124ms)

    handles as in visual mode

      ✓ Select sentence with trailing spaces in visual mode (303ms)

      ✓ Select sentence with leading spaces in visual mode (275ms)

      ✓ Select multiple sentences in visual mode (272ms)

    handles is in visual mode

      ✓ Select inner sentence with trailing spaces in visual mode (193ms)

      ✓ Select inner sentence with leading spaces in visual mode (386ms)

      ✓ Select spaces between sentences in visual mode (274ms)

    handles tag blocks in visual mode

      ✓ Can do vit on a matching tag (258ms)

      ✓ Count-prefixed vit alternates expanding selection between inner and outer tag brackets (227ms)

      ✓ Can do vat on a matching tag (202ms)

    handles replace in visual mode

      ✓ Can do a single line replace (152ms)

      ✓ Can do a multi line replace (102ms)

    D command will remove all selected lines

      ✓ D deletes all selected lines (95ms)

      ✓ D deletes the current line (103ms)

    handles indent blocks in visual mode

      ✓ Can do vai (410ms)

      ✓ Can do vii (126ms)

      ✓ Doesn't naively select the next line (137ms)

      ✓ Searches backwards if cursor line is empty (124ms)

      ✓ Can do vaI (252ms)

    visualstar

      ✓ Works with * (104ms)

      ✓ Works with # (106ms)

    search works in visual mode

      ✓ Works with / (85ms)

      ✓ Works with ? (125ms)

      ✓ Selects correct range (165ms)

    X will delete linewise

      ✓ normal selection (139ms)

      ✓ normal selection (153ms)

    C will delete linewise

      ✓ normal selection (119ms)

      ✓ normal selection (133ms)

    R will delete linewise

      ✓ normal selection (105ms)

      ✓ normal selection (127ms)

    Linewise Registers will be inserted properly

      ✓ downward selection (187ms)

      ✓ upward selection (352ms)

    Indent Tests using > on visual selections

      ✓ multiline indent top down selection (108ms)

      ✓ multiline indent bottom up selection (114ms)

      ✓ repeat multiline indent top down selection (190ms)

      ✓ repeat multiline indent bottom up selection (203ms)

    Outdent Tests using < on visual selections

      ✓ multiline outdent top down selection (156ms)

      ✓ multiline outdent bottom up selection (178ms)

      ✓ repeat multiline outdent top down selection (186ms)

      ✓ repeat multiline outdent bottom up selection (172ms)

    Non-darwin <C-c> tests

      ✓ <C-c> copies and sets mode to normal (347ms)

    vi{ will go to end of second to last line

      ✓ select (158ms)

    Transition between visual mode

      ✓ vv will back to normal mode

      ✓ vV will transit to visual line mode

      ✓ v<C-v> will transit to visual block mode

      ✓ Vv will transit to visual (char) mode

      ✓ VV will back to normal mode

      ✓ V<C-v> will transit to visual block mode

      ✓ <C-v>v will transit to visual (char) mode (57ms)

      ✓ <C-v>V will back to visual line mode

      ✓ <C-v><C-v> will back to normal mode

    replace text in characterwise visual-mode with characterwise register content

      ✓ gv selects the last pasted text (which is shorter than original) (818ms)

      ✓ gv selects the last pasted text (which is longer than original) (929ms)

      ✓ gv selects the last pasted text (multiline) (441ms)

    can handle gn

      ✓ gn selects the next match text (811ms)

      ✓ gn selects the current word at |hello (455ms)

      ✓ gn selects the current word at h|ello (360ms)

      ✓ gn selects the current word at hel|lo (395ms)

      ✓ gn selects the next word at hell|o (315ms)

      ✓ gn selects the next word at hello| (374ms)



  Mode Visual Block

    ✓ can be activated

    ✓ Can handle A forward select (142ms)

    ✓ Can handle A backwards select (280ms)

    ✓ Can handle I forward select (145ms)

    ✓ Can handle I backwards select (160ms)

    ✓ Can handle I with empty lines on first character (inserts on empty line) (142ms)

    ✓ Can handle I with empty lines on non-first character (does not insert on empty line) (215ms)

    ✓ Can handle c forward select (139ms)

    ✓ Can handle c backwards select (150ms)

    ✓ Can handle C (153ms)

    ✓ Can do a multi line replace (186ms)

    ✓ Can handle 'D' (137ms)

    ✓ Can handle 'gj' (211ms)

    ✓ Properly add to end of lines j then $ (136ms)

    ✓ Properly add to end of lines $ then j (158ms)

    ✓ o works in visual block mode (155ms)

    Non-darwin <C-c> tests

      ✓ <C-c> copies and sets mode to normal (340ms)



  Mode Visual Line

    ✓ can be activated

    ✓ Can handle w (213ms)

    ✓ Can handle wd (185ms)

    ✓ Can handle x (157ms)

    ✓ Can handle U (352ms)

    ✓ Can handle x across a selection (226ms)

    ✓ Can do vwd in middle of sentence (299ms)

    ✓ Can do vwd in middle of sentence (187ms)

    ✓ Can do vwd multiple times (341ms)

    ✓ Can handle U across a selection (236ms)

    ✓ Can handle U across a selection in reverse order (271ms)

    ✓ handles case where we go from selecting on right side to selecting on left side (313ms)

    ✓ handles case where we delete over a newline (263ms)

    ✓ handles change operator (238ms)

    ✓ Vp updates register content (237ms)

    ✓ Vp does not append unnecessary newlines (first line) (114ms)

    ✓ Vp does not append unnecessary newlines (middle line) (154ms)

    ✓ Vp does not append unnecessary newlines (last line) (100ms)

    Vim's EOL handling is weird

      ✓ delete through eol (153ms)

      ✓ join 2 lines by deleting through eol (123ms)

      ✓ d$ doesn't delete whole line (176ms)

      ✓ vd$ does delete whole line (271ms)

    Arrow keys work perfectly in Visual Line Mode

      ✓ Can handle <up> key (91ms)

      ✓ Can handle <down> key (126ms)

    Can handle d/c correctly in Visual Line Mode

      ✓ Can handle d key (94ms)

      ✓ Can handle d key (122ms)

      ✓ Can handle d key (169ms)

      ✓ Can handle d key (134ms)

      ✓ can handle 'c' (76ms)

    handles replace in visual line mode

      ✓ Can do a single line replace (134ms)

      ✓ Can do a multi visual line replace (119ms)

      ✓ Can do a multi visual line replace from the bottom up (133ms)

    search works in visual line mode

      ✓ Works with / (112ms)

      ✓ Works with ? (158ms)

    Non-darwin <C-c> tests

      ✓ <C-c> copies and sets mode to normal (378ms)

    replace text in linewise visual-mode with linewise register content

      ✓ yyVp does not change the content but changes cursor position (104ms)

      ✓ linewise visual put works also in the end of document (155ms)

      ✓ gv selects the last pasted text (which is shorter than original) (800ms)

      ✓ gv selects the last pasted text (which is longer than original) (934ms)

      ✓ gv selects the last pasted text (multiline) (361ms)



  Mode Normal

    ✓ Can handle 'x' (128ms)

    ✓ Can handle 'Nx' (81ms)

    ✓ Can handle 'Nx' and paste (120ms)

    ✓ Can handle 'x' at end of line (196ms)

    ✓ Can handle 'Ns' (82ms)

    ✓ Can handle 'Ns' at end of line (89ms)

    ✓ Can handle '<Del>' (101ms)

    ✓ Can handle '<Del>' with counts, which removes the last character of the count (102ms)

    ✓ Can handle '<Del>' at end of line (188ms)

    ✓ Can handle 'cc' (138ms)

    ✓ Can handle 'Ncc' (103ms)

    ✓ Can handle 'yy' (121ms)

    ✓ Can handle 'D' (159ms)

    ✓ Can handle 'D' on empty lines (86ms)

    ✓ Can handle 'DD' (184ms)

    ✓ Can handle 'C' (151ms)

    ✓ Can handle 'NC' (270ms)

    ✓ Can handle 'r' (139ms)

    ✓ Can handle '<Count>r' (121ms)

    ✓ Can handle '<Count>r' (111ms)

    ✓ Can handle 'r' after 'dd' (204ms)

    ✓ Can handle 'J' once (113ms)

    ✓ Can handle 'J' twice (138ms)

    ✓ Can handle 'J' with empty last line (102ms)

    ✓ Can handle 'J's with multiple empty last lines (228ms)

    ✓ Can handle 'J' with leading white space on next line (112ms)

    ✓ Can handle 'J' with only white space on next line (92ms)

    ✓ Can handle 'J' with TWO indented lines (142ms)

    ✓ Can handle 'J' with ')' first character on next line (126ms)

    ✓ Can handle 'J' with a following delete (118ms)

    ✓ Can handle 'J' in Visual Line mode (168ms)

    ✓ Can handle 'gJ' once (170ms)

    ✓ Can handle 'gJ' once and ALL WHITESPACE IS ELIMINATED (166ms)

    ✓ Can handle '~' (134ms)

    ✓ Can handle 'g~{motion}' (179ms)

    ✓ Can handle '<BS>' in insert mode (189ms)

    ✓ Can handle undo with P (421ms)



  Dot Operator

    ✓ Can repeat '~' with <num> (150ms)

    ✓ Can repeat '~' with dot (245ms)

    ✓ Can repeat 'x' (123ms)

    ✓ Can repeat 'J' (114ms)

    ✓ Can handle dot with A (261ms)

    ✓ Can handle dot with I (250ms)

    ✓ Can repeat actions that require selections (286ms)


  Repeat content change

    ✓ Can repeat '<C-t>' (176ms)

    ✓ Can repeat insert change and '<C-t>' (250ms)

    ✓ Can repeat change by `<C-a>` (184ms)

    ✓ Only one arrow key can be repeated in Insert Mode (208ms)

    ✓ Cached content change will be cleared by arrow keys (310ms)



  Matching Bracket (%)

    ✓ before opening parenthesis (54ms)

    ✓ inside parenthesis (115ms)

    ✓ nested parenthesis beginning (134ms)

    ✓ nested parenthesis end (122ms)

    ✓ nested bracket and parenthesis beginning (140ms)

    ✓ nested bracket, parenthesis, braces beginning (123ms)

    ✓ nested bracket, parenthesis, braces end (243ms)



  Motions in Normal Mode

    ✓ Can handle [( (273ms)

    ✓ Can handle nested [( (112ms)

    ✓ Can handle <number>[( (113ms)

    ✓ Can handle [( and character under cursor exclusive (140ms)

    ✓ Can handle ]) (110ms)

    ✓ Can handle nested ]) (150ms)

    ✓ Can handle <number>]) (129ms)

    ✓ Can handle ]) and character under cursor exclusive (118ms)

    ✓ Can handle [{ (154ms)

    ✓ Can handle nested [{ (139ms)

    ✓ Can handle <number>[{ (274ms)

    ✓ Can handle [{ and character under cursor exclusive (146ms)

    ✓ Can handle ]} (171ms)

    ✓ Can handle nested ]} (151ms)

    ✓ Can handle <number>]} (153ms)

    ✓ Can handle ]} and character under cursor exclusive (170ms)

    ✓ Can handle 'ge' (258ms)

    ✓ Can handle 'gg' (195ms)

    ✓ Can handle 'gg' to first non blank char on random line (353ms)

    ✓ Can handle 'gg' to first non blank char on first line (128ms)

    ✓ Retain same column when moving up/down (123ms)

    ✓ Can handle <enter> (297ms)

    ✓ $ always keeps cursor on EOL (262ms)

    ✓ Can handle $ with a count (136ms)

    ✓ Can handle $ with a count at end of file (168ms)

    ✓ Can handle <end> with a count (136ms)

    ✓ Can handle <D-right> with a count (148ms)

    ✓ Can handle 'f' (208ms)

    ✓ Can handle 'f' twice (215ms)

    ✓ Can handle 'F' (235ms)

    ✓ Can handle 'F' twice (198ms)

    ✓ Can handle 't' (239ms)

    ✓ Can handle 't' twice (230ms)

    ✓ Can handle 'T' (230ms)

    ✓ Can handle 'T' twice (281ms)

    ✓ Can run a forward search (104ms)

    ✓ Can run a forward and find next search (262ms)

    ✓ Can run a reverse search (312ms)

    ✓ Can run a reverse and find next search (404ms)

    ✓ maintains column position correctly (167ms)

    ✓ maintains column position correctly with $ (131ms)

    ✓ Can handle G  (131ms)

    ✓ Can handle G with number prefix (168ms)

    ✓ Can handle G with number prefix (132ms)

    ✓ Can handle gg (159ms)

    ✓ Can handle gg with number prefix (110ms)

    ✓ Can handle 0 (310ms)

    ✓ Can handle 0 as part of a repeat (144ms)

    ✓ Can handle g* (127ms)

    ✓ Can handle g*n (140ms)

    ✓ Can handle * (95ms)

    ✓ Can handle ** (105ms)

    ✓ Can handle # on whitespace (205ms)

    ✓ Can handle # on EOL (256ms)

    ✓ Can handle g# (257ms)

    ✓ Can handle g#n (342ms)

    ✓ Can handle # (240ms)

    ✓ Can handle # already on the word (185ms)

    ✓ Can handle ## (273ms)

    ✓ Can handle | (207ms)

    ✓ Can handle <number> | (269ms)

    ✓ Can handle + (102ms)

    ✓ Can handle + indent (106ms)

    ✓ Can handle + with count prefix (91ms)

    ✓ Can handle - (89ms)

    ✓ Can handle - indent (75ms)

    ✓ Can handle - with count prefix (120ms)

    ✓ Can handle _ (85ms)

    ✓ Can handle _ with count prefix (67ms)

    ✓ Can handle g_ (82ms)

    ✓ Can handle g_ with count prefix (99ms)

    ✓ Can handle <up> key (89ms)

    ✓ Can handle <down> key (68ms)

    ✓ Can handle <left> key (87ms)

    ✓ Can handle <right> key (54ms)



  basic motion

    ✓ char right: should move one column right

    ✓ char right
    ✓ char left: should move cursor one column left
    ✓ char left: left-most column should stay at the same location

    ✓ line down: should move cursor one line down
    ✓ line down: bottom-most line should stay at the same location
    ✓ line begin
    ✓ line end
    ✓ document begin
    ✓ document end
    ✓ line begin cursor on first non-blank character
    ✓ last line begin cursor on first non-blank character
    line up
      ✓ should move cursor one line up
      ✓ top-most line should stay at the same location



  word motion

    ✓ line begin cursor on first non-blank character

    ✓ last line begin cursor on first non-blank character
    word right
      ✓ move to word right
      ✓ last word should move to next line

      ✓ last word should move to next line stops on empty line
      ✓ last word should move to next line skips whitespace only line
      ✓ last word on last line should go to end of document (special case!)
    word left
      ✓ move cursor word left across spaces
      ✓ move cursor word left within word
      ✓ first word should move to previous line, beginning of last word
      ✓ first word should move to previous line, stops on empty line
      ✓ first word should move to previous line, skips whitespace only line
    WORD right
      ✓ move to WORD right
      ✓ last WORD should move to next line
      ✓ last WORD should move to next line stops on empty line
      ✓ last WORD should move to next line skips whitespace only line
    WORD left
      ✓ move cursor WORD left across spaces
      ✓ move cursor WORD left within WORD
      ✓ first WORD should move to previous line, beginning of last WORD
      ✓ first WORD should move to previous line, stops on empty line
      ✓ first WORD should move to previous line, skips whitespace only line
    end of word right
      ✓ move to end of current word right
      ✓ move to end of next word right
      ✓ end of last word should move to next line
      ✓ end of last word should move to next line skips empty line
      ✓ end of last word should move to next line skips whitespace only line
    end of WORD right

      ✓ move to end of current WORD right

      ✓ move to end of next WORD right

      ✓ end of last WORD should move to next line

      ✓ end of last WORD should move to next line skips empty line

      ✓ end of last WORD should move to next line skips whitespace only line



  sentence motion

    sentence forward

      ✓ next concrete sentence

      ✓ next sentence that ends with paragraph ending

      ✓ next sentence when cursor is at the end of previous paragraph
      ✓ next sentence when paragraph contains a line of whilte spaces
    sentence backward
      ✓ current sentence begin
      ✓ sentence forward when cursor is at the beginning of the second sentence
      ✓ current sentence begin with no concrete sentense inside

      ✓ current sentence begin when it's not the same as current paragraph begin
      ✓ current sentence begin when previous line ends with a concrete sentence


  paragraph motion

    paragraph down

      ✓ move down normally

      ✓ move down longer paragraph

      ✓ move down starting inside empty line

      ✓ paragraph at end of document

    paragraph up

      ✓ move up short paragraph

      ✓ move up longer paragraph

      ✓ move up starting inside empty line



  motion line wrapping

    whichwrap enabled

      normal mode

        ✓ h wraps to previous line (63ms)

        ✓ l wraps to next line (85ms)

        ✓ <left> wraps to previous line (65ms)

        ✓ <right> wraps to next line (102ms)

      insert mode

        ✓ <left> wraps to previous line (82ms)

        ✓ <right> once goes to end of line (77ms)

        ✓ <right> twice wraps to next line (108ms)

    whichwrap disabled

      normal mode

        ✓ h does not wrap to previous line (114ms)

        ✓ l does not wrap to next line (166ms)

        ✓ <left> does not wrap to previous line (111ms)

        ✓ <right> does not wrap to next line (62ms)

      insert mode

        ✓ <left> does not wrap to previous line (53ms)

        ✓ <right> does not wrap to next line (95ms)



  Multicursor

    ✓ can add multiple cursors below (144ms)

    ✓ can add multiple cursors above (138ms)


  numeric string
    ✓ fails on non-string
    ✓ handles hex round trip
    ✓ handles decimal round trip
    ✓ handles octal trip

  comment operator

    ✓ gcc comments out current line (409ms)

    ✓ gcj comments in current and next line (237ms)

    ✓ block comment with motion (364ms)

    ✓ block comment in Visual Mode (332ms)


  put operator

    ✓ basic put test (226ms)

    ✓ test yy end of line (132ms)

    ✓ test yy first line (205ms)

    ✓ test yy middle line (108ms)

    ✓ test yy with correct positon movement (147ms)



  shift operator

    ✓ basic shift left test (123ms)

    ✓ shift left goto end test (145ms)

    ✓ shift left goto line test (132ms)

    ✓ shift right goto end test (124ms)

    ✓ shift right goto line test (198ms)



  easymotion plugin

    ✓ Can handle s move (223ms)

    ✓ Can handle 2s move (100ms)

    ✓ Can handle f move (99ms)

    ✓ Can handle 2f move (134ms)

    ✓ Can handle F move (266ms)

    ✓ Can handle 2F move (146ms)

    ✓ Can handle t move (133ms)

    ✓ Can handle bd-t move (128ms)

    ✓ Can handle 2t move (120ms)

    ✓ Can handle bd-t2 move (162ms)

    ✓ Can handle T move (133ms)

    ✓ Can handle 2T move (107ms)

    ✓ Can handle w move (106ms)

    ✓ Can handle bd-w move (137ms)

    ✓ Can handle b move (151ms)

    ✓ Can handle e move (168ms)

    ✓ Can handle bd-e move (159ms)

    ✓ Can handle ge move (209ms)

    ✓ Can handle n-char move (259ms)

    ✓ Can handle j move (115ms)

    ✓ Can handle k move (118ms)

    ✓ Can handle bd-jk move (1) (158ms)

    ✓ Can handle bd-jk move (2) (124ms)

    ✓ Can handle lineforward move (1) (105ms)

    ✓ Can handle lineforward move (2) (75ms)

    ✓ Can handle linebackward move (1) (192ms)

    ✓ Can handle linebackward move (2) (134ms)



  Input method plugin

    ✓ use default im in insert mode

    ✓ use other im in insert mode

error: Unhandled Rejection at: Promise [object Promise]. Reason: TypeError: Cannot read property 'options' of undefined.



  sneak plugin

    ✓ Can handle s motion (91ms)

    ✓ Can handle S motion (113ms)

    ✓ Can handle <operator>z motion (98ms)

    ✓ Can handle <operator>Z motion (118ms)

rejected promise not handled within 1 second

    ✓ Can handle s; motion (117ms)

    ✓ Can handle s, motion (154ms)

    ✓ Can handle S; motion (149ms)

    ✓ Can handle S, motion (257ms)



  surround plugin

    ✓ 'ysiw)' surrounds word without space (332ms)

    ✓ 'ysiw(' surrounds word with space (184ms)

    ✓ 'ysw)' surrounds word without space (236ms)

    ✓ 'ysw(' surrounds word with space (185ms)

    ✓ 'ysaw)' surrounds word without space (222ms)

    ✓ 'ysaw(' surrounds word with space (469ms)

    ✓ 'ysiw(' surrounds word with space and ignores punctuation (167ms)

    ✓ 'ysiw<' surrounds word with tags (282ms)

    ✓ 'ysiw<' surrounds word with tags and attributes (244ms)

    ✓ 'cst<' surrounds word with tags that have a dot in them (281ms)

    ✓ 'yss)' surrounds entire line respecting whitespace (239ms)

    ✓ change surround (190ms)

    ✓ change surround with alias (237ms)

    ✓ change surround to tags (237ms)

    ✓ delete surround (219ms)

    ✓ delete surround with alias (212ms)

    ✓ delete surround with tags (271ms)

    ✓ change surround brackets at end of line (245ms)

    ✓ changing brackets with surround works again (236ms)


  register

    ✓ Can copy to a register (218ms)

    ✓ Can use two registers together (271ms)

    ✓ Can use black hole register (376ms)

    ✓ System clipboard works with chinese characters (251ms)

    ✓ Yank stores text in Register '0' (420ms)

    ✓ Register '1'-'9' stores delete content (709ms)

    ✓ "A appends linewise text to "a (378ms)

    ✓ "A appends character wise text to "a (361ms)

    ✓ Can put and get to register

    clipboard

      ✓ Can access '*' (clipboard) register (178ms)

      ✓ Can access '+' (clipboard) register (142ms)



  Repeatable movements with f and t

    ✓ Can repeat f<character> (82ms)

    ✓ Can repeat reversed F<character> (134ms)

    ✓ Can repeat t<character> (132ms)

    ✓ Can repeat N times reversed t<character> (128ms)



  text editor

    ✓ insert 'Hello World'

    ✓ replace 'World' with 'Foo Bar'

    ✓ delete `Hello`

    ✓ delete the whole line

    ✓ try to read lines that don't exist





  994 passing (4m)

  1 failing



  1) Remapper
       jj -> <Esc> through modehandler:

      AssertionError [ERR_ASSERTION]: '' == 'lorem ipsum'
      + expected - actual

      +lorem ipsum
      
      at Object.<anonymous> (test/configuration/remapper.test.ts:215:12)
      at Generator.next (<anonymous>)
      at fulfilled (out/test/configuration/remapper.test.js:4:58)
      at <anonymous>






Tests exited with code: 1
@Chillee

This comment has been minimized.

Copy link
Member

Chillee commented Sep 8, 2018

Awesome!!! This is one of my personal biggest pet peeves with VSCodeVim, but I haven't had the time/energy to completely rewrite the jump tracking system.

I'll need to spend some time reviewing it (as well as probably some time trying it out), but I just wanted to say thanks first!

@Chillee

This comment has been minimized.

Copy link
Member

Chillee commented Sep 8, 2018

Also, just a couple notes on some of the things that you noted:

Currently, state is not tracked per pane. It used to be, but I removed that due to it causing some really bad bugs with undo (where it would delete a lot of a user's history).

EDITOR_SELECTION_THRESHOLD is used in VSCode internally, but it actually doesn't help with our <ctrl-o> issues. I remember thinking that adding the EDITOR_SELECTION_THRESHOLD would help our issues, but they have a check that causes "changes made from an extension" to override the threshold. So every change we make is tracked by VSCode.

@shawnaxsom

This comment has been minimized.

Copy link
Contributor Author

shawnaxsom commented Sep 8, 2018

No problem! Thanks for the "thanks", and thank you for all of your hard work on this plugin. It's gotten me off of vanilla Vim for the longest time in recent years.

I should do a little more testing as well I'm sure. What is there seems to be working very well, but I'm not sure how well it play with other plugins. I am sure I need to handle some extra cases like handleContentChangedFromDisk, for example.

Yeah I did see some of the undo history discussion on #2007. That makes sense. The current behavior split pane doesn't bother me, though I don't use split panes often in vscode. Sometimes it might open a file in a different pane than expected, may be some work there.

@Chillee
Copy link
Member

Chillee left a comment

It mostly looks really great to me! I took a look through most of the code, and most of it looks great.

for (let action of recordedMacro.actionsRun) {
keyStrokes = keyStrokes.concat(action.keysPressed);
await this.handleMultipleKeyEvents(action.keysPressed);

This comment has been minimized.

@Chillee

Chillee Sep 9, 2018

Member

I don't think this is actually necessary. command.replay can either be contentChange or keyStrokes. contentChange is your standard macro stuff, while keyStrokes is what happens when you paste a macro.

See a8dfee5#diff-7addcd1a8a241060a73b1fe4abb39960R1822 for context.

Interestingly, it seems like it doesn't actually work...

Either way, I don't think you need to handle jumps here.

const to: Jump = this._jumps[this._currentJumpNumber - 1];

if (this._currentJumpNumber === this._jumps.length) {
this.recordJump(from, to);

This comment has been minimized.

@Chillee

Chillee Sep 9, 2018

Member

Why is this necessary?

This comment has been minimized.

@shawnaxsom

shawnaxsom Sep 9, 2018

Author Contributor

That is how vanilla Vim appears to work, which lets you <C-i> after you've jumped back. Vim doesn't keep track of where you jumped to until you jump back.

Here's video demonstrating that in Vim: https://cl.ly/b1d14cd87b45

Notice how the first time I show :jump, it doesn't show the current line of where I jumped to (export class JumpTracker), and that the > position arrow is outside of the jumps list, but then I press <C-o> and I can see a jump was added and the > position arrow is now on the from jump.

removeDuplicateJumps() {
for (let i = 0; i < this._jumps.length; i++) {
const jump = this._jumps[i];
this.clearJumpsOnSameLine(jump);

This comment has been minimized.

@Chillee

Chillee Sep 9, 2018

Member

Are we concerned about potential N^2 complexity here?

The max N=100, but 100^2 is still 10k, which is bordering on significant.

If any of the comparisons are expensive, then this might become an issue.

This comment has been minimized.

@Chillee

Chillee Sep 9, 2018

Member

Also, is it an issue which order we remove jumps?

This comment has been minimized.

@shawnaxsom

shawnaxsom Sep 9, 2018

Author Contributor

Good points. The latest jump should be preserved, to have the latest column number.

I can loop through the jumps in the list in reverse and keep track of the line numbers as I go, removing when I see a duplicate. That should get it down to O(n) at least and preserve the newer jump.

This comment has been minimized.

@shawnaxsom

shawnaxsom Sep 9, 2018

Author Contributor

I changed it as described, and I added a new "Can handle text deleted from a file" test to JumpTracker.tests.js to validate behavior. Added tests, also added a test for Visual Mode instead of just Visual Line Mode.

* @param to - File/position jumped to
*/
public recordFileJump(from: Jump | null, to: Jump) {
if (this.isJumpingFiles) {

This comment has been minimized.

@Chillee

Chillee Sep 9, 2018

Member

Is there a potential race here, and does it matter?

Say we call handleFileJump twice before recordFileJump gets triggered once by the onDidChangeActiveTextEditor, we might record the second handleFileJump as a real jump.

This comment has been minimized.

@shawnaxsom

shawnaxsom Sep 10, 2018

Author Contributor

It does matter if that race condition would occur. If you remove that if block, then it will record the from location as a jump again, which puts it back in the jump stack as the next location <C-o> will take you to. If you <C-o> again, same thing happens, so it circles between the two files so you can't get to older jumps.

But I haven't been able to reproduce the potential race condition. I tested by jumping to definition for two files in a row. I then manually <C-o> twice and <C-i> twice. Worked fine every time. I also tried 2<C-o> and 2<C-i> and that works fine as well.

I'd suggest it is fine as it is. I don't think there is a perfect solution for this. We could use a counter instead, but counters can be worse in their own ways if counter change events are missed for whatever reason. I also was going to originally just go by filename, seeing if it matches the previous or next in the jump list, but that doesn't match vanilla Vim and might have unexpected behavior.

This comment has been minimized.

@Chillee

Chillee Sep 10, 2018

Member

Alright, I tested it out, and I think the race condition occurring doesn't cause it to fail disastrously. I'm fine with it.

@shawnaxsom

This comment has been minimized.

Copy link
Contributor Author

shawnaxsom commented Sep 10, 2018

I pushed up some changes based on the conversation so far. I also did a little refactoring, pulling in logic from Actions.ts into JumpTracker.ts itself to better encapsulate the logic, and to maybe be able to unit test it better.

@Chillee

This comment has been minimized.

Copy link
Member

Chillee commented Sep 10, 2018

I think it looks good to me! Tell me if you think it's ready to merge.

@shawnaxsom

This comment has been minimized.

Copy link
Contributor Author

shawnaxsom commented Sep 10, 2018

I think we are good! Should be ready to merge.

I tested file changes on disk this morning, and vscode.workspace.onDidChangeTextDocument fired and textWasDeleted returned true, so it handled that use case fine, which was the last one I was concerned about. Hopefully if it can handle that then it can handle whatever lines any plugin tries to add/delete from the files.

Thanks for the review and for your feedback!

@Chillee Chillee merged commit 0938573 into VSCodeVim:master Sep 10, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@shawnaxsom shawnaxsom deleted the shawnaxsom:feature/improved-jump-list branch Sep 11, 2018

@ohjames

This comment has been minimized.

Copy link
Contributor

ohjames commented Sep 27, 2018

I was hoping the '' binding would be fixed by this, but it's still as buggy in 0.16.5 as ctrl-o etc. was before.

@shawnaxsom

This comment has been minimized.

Copy link
Contributor Author

shawnaxsom commented Sep 27, 2018

@ohjames Yes I didn't touch double single quote or double back tick keys. What is a specific use case that isn't working? Even though it is still using built-in vscode buggy commands, it often works fine when I am testing it given it just jumps back to previous jump, so reproduction steps would be helpful.

It wouldn't be too difficult to implement behavior for those keys. I could take a look at some point if you want to open a new GitHub issue, mention my name in it, and mention a specific use case that is failing.

@devguydavid

This comment has been minimized.

Copy link

devguydavid commented Dec 19, 2018

I know this is merged, but I must be missing something glaringly obvious. I'm having a hard time seeing the effect of this change. Example:

  • ctrl-] to go to definition of a symbol
  • j j j k k k to navigate line by line a bit
  • ctrl-o to go back

Expected result: The one-line motions are skipped and I jump back to the original position.
Actual result: The ctrl-o follows the one-line motions.

I put this comment here only for posterity and hopefully to solicit a final comment describing if there's something that needs to be done to get this working as expected (or to set my expectations straight). If this is a newly introduced bug I'd be happy to create an Issue.

@shawnaxsom

This comment has been minimized.

Copy link
Contributor Author

shawnaxsom commented Dec 19, 2018

@devguydavid Your expectations are correct. I can't reproduce an issue like you describe, though there are a few similar issues with jump to definition.

If I jump to a definition in a separate file, I have to press ctrl-o twice to return to the previous file.

If I jump to definition in the same file, it doesn't seem to be adding the "from" line as a jump.

To confirm, pressing ctrl-] j j j k k k, you are having to press ctrl-o 6 times? I'm not sure why it would be doing that. Each "action" (like pressing "j") has a flag to determine if it should create a jump or not, and those have that disabled.

@devguydavid

This comment has been minimized.

Copy link

devguydavid commented Dec 19, 2018

That is correct. I'd have to type ctrl-o 6 times just as before this pull request. I have tried multiple versions of this plugin including the one this was introduced in and it's the same result for me.

Good news, though! This morning I removed all my extensions and settings:

mv ~/.vscode ~/.vscode.orig
mv ~/Library/Application\ Support/Code ~/Library/Application\ Support/Code.orig

I then installed this plugin and the Go extension (since I'm testing on some go code) and it is now working as expected. There must have been a setting or an extension that was conflicting. VSCode itself showed that 0.17.0 was being loaded, so it's still a mystery to me. I'll dig in a little more, but at this point I at least have a properly functioning state to work from.

@shawn-pe

This comment has been minimized.

Copy link
Contributor

shawn-pe commented Dec 20, 2018

Okay great! Yes, there are some minor issues still as mentioned above, and also some non-Vim commands like Go To Symbol In File can't easily be tracked as jumps, but I hope it works better for you now otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment