Commit Graph

5580 Commits

Author SHA1 Message Date
Jason Fields
94d3159f24 Fix linewise gu, gU, and g~
Fixes #6467
2021-04-14 22:36:18 -04:00
Jason Fields
1f5a93e8d3 Fix tests 2021-04-14 22:03:40 -04:00
Jason Fields
5985012cec Fix another bug with clipboard register 2021-04-14 21:49:32 -04:00
Jason Fields
8509ab84b6 Fix <C-v> in Insert mode
This didn't work in multi-cursor mode and would paste as if you'd typed it (matching brackets, etc.).
2021-04-14 21:19:58 -04:00
renovate[bot]
e88bd05da2
Update dependency @types/node to v12.20.8 (#6481)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-14 17:41:29 -04:00
renovate[bot]
90dc8dc06e
Update dependency webpack to v5.33.2 (#6480)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-14 15:55:38 -04:00
renovate[bot]
21a012fd41
Update dependency @types/sinon to v10 (#6449)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-14 12:21:25 +00:00
Jason Fields
aff299a908 Fix clipboard register
Should only overwrite it when the first slot is different from the system clipboard. This was causing issues with multicursor.
2021-04-14 00:52:40 -04:00
Jason Fields
9fb7cb4d2f Collapse all cursors in Normal mode, not just the first
This could cause cursors to get mixed up, leading to weird multicursor bugs
2021-04-14 00:44:39 -04:00
Jason Fields
91cf50a754 Avoid overlapping transformations in Visual mode block-wise put 2021-04-13 23:27:59 -04:00
Jason Fields
8df8ab9ad7 Re-write put from scratch
I finally bit the bullet, deleted all of our put logic, and re-implemented it from scratch.
This includes `p`, `P`, `gp`, `gP`, `]p`, `[`, and `:put`.

In addition to cleaner, more maintainable code, this resulted in:
  - Using replace transformations, which means better performance
  - Fixing VisualBlock put and block-wise put (fixes #1796)
  - Fixing put when the register contains a macro (fixes #3714)
  - Fixing various other corner cases, particularly with regards to cursor placement
  - Beefing up our test suite

I'm sure there are still obscure corner cases that we handle wrong, but it'll be easier going forward to fix them.
2021-04-13 20:19:32 -04:00
renovate[bot]
4b920503fa
Update dependency neovim to v4.10.0 (#6473)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-13 13:44:01 -04:00
renovate[bot]
c13471a0de
Update dependency webpack to v5.32.0 (#6469)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-12 15:55:28 -04:00
Jason Fields
46224248ff Run prettier 2021-04-12 14:17:08 -04:00
Jason Fields
e5e61a1701 Add exactPosition PositionDiff type
This ignores the Position its applied to and just sets the line/character to its parameters.
Turns out this absurdly simple addition will help us pay off a lot of technical debt.
2021-04-12 13:46:03 -04:00
Jason Fields
18d5531162 Slight PositionDiff refactor
Make constructor private and stop exporting PositionDiffType in favor of using factory methods
2021-04-12 13:43:58 -04:00
Jason Fields
045cabeef5 Big fat refactor of registers
- Each register now points to an array - the i'th slot contains the content for the i'th cursor
- If there are more cursors than slots, the first slot is used as a backup
- Each slot contains either a RecordedState (in the case of a macro) or a string
- Newlines in those strings should be interpreted in the context of the associated RegisterMode
- The interface was changed somewhat to be safer and more consistent

I probably broke *something*, but the tests pass and this refactor enables further improvement of the terrible put logic, so I'll fix things as they come up.
2021-04-09 23:17:59 -04:00
Jason Fields
f4a2b61ce4 Fix cursor position after yanking multiple lines and [count]p
This is all so janky...
2021-04-09 14:40:29 -04:00
renovate[bot]
eb52da5f06
Update dependency webpack to v5.31.2 (#6457)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-09 14:08:16 -04:00
Jason Fields
35ff1f51de Attempt to untangle the put logic somewhat
This is easily one of the worst areas of the codebase.
It really needs a fundamental refactor (closer to a rewrite, really), but a good first step is to make it a bit more understandable as-is.
This attempts to change no behavior or even fundamental logic, just to make it a bit easier to reason about.
2021-04-09 12:59:32 -04:00
Jason Fields
9e83bfaed7 Test cases for character-wise put commands with count in normal mode
Several of these result in incorrect cursor positions - this has been noted with comments
2021-04-09 12:22:51 -04:00
renovate[bot]
377c387c66
Update dependency fork-ts-checker-webpack-plugin to v6.2.1 (#6455)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-09 09:20:42 -04:00
Jason Fields
1873effd4c Make gP and ]P respond to [count] and dot
Fixes #6416, Fixes #6444
2021-04-09 00:52:53 -04:00
Jason Fields
f5c3cdd841 Remove a few stupid, hardly used methods from Position 2021-04-08 18:46:10 -04:00
Jason Fields
3355569e96 Run prettier 2021-04-08 18:42:22 -04:00
Jason Fields
9e50e0dc52 Refactor interface of Position's "word" methods
- Rename word methods to be more intuitive
- Use Position methods instead of standalone functions
- Use an object for pseudo-kwargs
- Pass WordType instead of having separate methods for "big" words
- Take `TextDocument` as a parameter

The result is a bit verbose (a more fundamental refactor might be needed
at a later date), but it's consistent, safe, and extensible.
This prepares for some changes to fix corner cases in our word handling.

Refs #5663
2021-04-08 18:12:26 -04:00
Ramkumar Ramachandra
986d14dd8a
Make <C-d> respect vim.use (#6364) 2021-04-07 16:18:15 -04:00
WhiteSource Renovate
52c7bc98c1
Update dependency typescript to v4.2.4 (#6448) 2021-04-07 15:47:33 -04:00
renovate[bot]
53bca3e88c
Update dependency webpack to v5.31.0 (#6447)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-07 15:22:27 -04:00
Jason Fields
aa0004362d Fix <C-t> in insert mode
Fixes #6190
2021-04-07 00:54:36 -04:00
Jason Fields
282f05224a Don't await VSCodeContext.set('vim.mode')
This saves ~15-20ms each time the mode changes, which is most impactful when repeating an action or macro that changes mode a few times.
I don't think this should cause any issues...
2021-04-07 00:48:18 -04:00
Jason Fields
15abffb2b8 _ when used with operator should be linewise
So `d_` is the same as `dd`, `y_` is the same as `yy`, etc.
Fixes #6435
2021-04-06 23:45:08 -04:00
Jason Fields
057cfc58ed <C-u> in insert mode deletes line break when used at start of line
Fixes #6429
2021-04-06 23:21:43 -04:00
sql-koala
594b308597
Use transformations for :s (#6402)
This fixes some edge cases as well as doing the edits in parallel
Fixes #4915, Refs #5663
Known issue: interactive `:s` does not update the document until the last replace is confirmed
2021-04-05 20:53:25 -04:00
Jason Fields
87786b0bf4 Make section motions, like ][, work in VisualBlock mode
Fixes #6411
2021-04-04 22:57:21 -04:00
Jason Fields
f86273d252 Small refactor of Jumps 2021-04-04 22:17:49 -04:00
Jason Fields
72b75605a0 Optimize undo/redo for replace mode 2021-04-04 21:30:41 -04:00
Jason Fields
009b5d52ad Yank should move cursor to start of range (or, if linewise, to first line of range)
Fixes #4871
2021-04-04 21:22:15 -04:00
Jason Fields
384da528da < in VisualBlock mode
This was meant to be part of d5155e81d5
2021-04-04 20:06:21 -04:00
Jason Fields
547a8ef37f Don't throw "No string under cursor" error on */# 2021-04-04 19:19:15 -04:00
Jason Fields
d5155e81d5 > in VisualBlock mode should indent the selection
Fixes #6414
2021-04-04 18:41:29 -04:00
Jason Fields
f2df5e45aa Fix X in Visual and VisualLine modes
This should delete entire selection linewise.
Fixes #6408
2021-04-04 18:35:25 -04:00
Jason Fields
393ab09d39 <S-BS> and <C-BS> in replace mode work same as <BS> 2021-04-03 14:19:49 -04:00
Jason Fields
86a4ed05a7 Remove last instance of TextEditor.delete 2021-04-02 00:41:15 -04:00
Jason Fields
05dd48b6ad Implement :y[ank]
Fixes #3219
2021-04-01 22:59:07 -04:00
renovate[bot]
ecd36982ae
Update dependency webpack to v5.30.0 (#6396)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-01 16:29:49 -04:00
Andrew Hewitson
213cdcb9c9
Feature/vimrc source support (#6394)
Adds support for the source keyword in .vimrc, loading the referenced files and parsing their configurations.

Fixes #5542
2021-04-01 14:31:47 -04:00
renovate[bot]
2ffa74f36b
Update dependency webpack to v5.29.0 (#6395)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-01 12:58:04 -04:00
Jason Fields
63f4160107 Overhaul HistoryTracker
- Much better edit merging, so undoing/redoing should generally only take one replace
- Correct changelist edge cases
- Improve and organize related tests

Known issue: `U` after `O` is broken, but that's a small corner case and `U` is generally much better behaved now.
2021-03-31 22:14:07 -04:00
Jason Fields
1c2cdc26be Remove Globals.mockModeHandler, which is no longer necessary 2021-03-31 18:40:24 -04:00