Commit Graph

1085 Commits

Author SHA1 Message Date
Abid H. Mujtaba
91b58999e9
Add Python-specific motions (#6393)
- Map ([|])(m|M) to motions to the prev|next start|end of Python functions
- Map ([|])([|]) to motions to the prev|next end|start of Python classes

Fixes #6213
2021-06-01 21:32:00 -04:00
Jason Fields
f0282c0c86 Slight change to HistoryTracker interface
At least currently, we only store a single cursor position per HistoryStep to restore on undo/redo. Let's be honest about that fact.
2021-06-01 00:13:30 -04:00
Jason Fields
4ba5da3740 Ex commands like :s should create undo points
See #5058 for some background on this issue, which really needs rationalization.
2021-05-30 22:13:47 -04:00
Jason Fields
338c202c5a Use transformation for increment/decrement 2021-05-30 16:44:23 -04:00
Jason Fields
3fd358d7ad Fix :sort with both (i)gnorecase and (u)nique flags set 2021-05-30 16:00:15 -04:00
Jason Fields
d25f6676ad Use transformation for :sort and fix cursor position 2021-05-30 15:36:06 -04:00
Jason Fields
6b03413559 Run prettier 2021-05-29 22:52:13 -04:00
Jason Fields
fe6a154f78 Rename custom Range class to Cursor
Refs #4585
2021-05-29 21:15:20 -04:00
sql-koala
be2a52af5e
Surround Rewrite (#6452)
This reduces the jank of the surround plugin substantially, fixes a number of bugs, and uses an InputBox for specifying tags.
Fixes #1818, fixes #5211, fixes #2893, fixes #6564, fixes #3386
2021-05-29 15:17:33 -04:00
Jason Fields
7103285539 Enable strictPropertyInitialization
Fixes #5847
2021-05-28 21:34:16 -04:00
Jason Fields
f22fbed657 Merge <C-y> and <C-e> in Insert mode with DocumentContentChangeAction
Repeating these should do the same insertion, regardless of what's below/above the cursor.
2021-05-28 17:19:23 -04:00
Jason Fields
5e2b9ce25e Expand and organize test suite a bit
- `I`, `gI`, `gi`
- `w` and `go` motions
- `<C-a>` in Insert mode
- `<C-y>` and `<C-e>` in Insert mode
- `.` after content change with `<BS>`, `<Del>`, and `<CR>`

Refs #5033
2021-05-28 16:23:03 -04:00
Jason Fields
518d3d5923 Clean up :substitute test suite 2021-05-28 15:28:49 -04:00
sekai013
f4a46889cc
Fix substitute with backslash (#6409)
Fixes #2710
2021-05-28 14:07:41 -04:00
Jason Fields
a111baa3ff Make n and N act as failed motions at end/start of document with nowrapscan
Refs #4908
2021-05-10 22:48:12 -04:00
renovate[bot]
3f6ba73944
Update dependency prettier to v2.3.0 (#6604)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-05-10 01:29:40 -04:00
Jason Fields
95cc88b1d5 Make gn act as failed movement if there are no more instances of the search term
Fixes #5194
2021-04-29 21:55:39 -04:00
Erik Demaine
ddf93f6a93
gq preserves whitespace between line breaks (#6571)
Rewrite `gq` reflow to apply manual spacing (including `joinspaces`
option) just when creating whitespace from what were linebreaks.
Fixes #6569

Fix precision around `textwidth`
Fixes #3509
2021-04-29 21:24:32 -04:00
Jason Fields
82ff74abcc Fix <C-w> in Insert mode at start of document
Fixes #6529
2021-04-22 11:59:37 -04:00
Jason Fields
d055eda3a3 Get rid of deprecated insertAt 2021-04-22 00:22:14 -04:00
Jason Fields
80dae08a5f Fix cursor position after <C-d> and <C-t> in Insert mode 2021-04-22 00:13:02 -04:00
Erik Demaine
2d8ce4304a
Support joinspaces in join and reformat paragraph (#5895)
Fixes #2505
2021-04-19 21:43:34 -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
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
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
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
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
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
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
f86273d252 Small refactor of Jumps 2021-04-04 22:17:49 -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
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
86a4ed05a7 Remove last instance of TextEditor.delete 2021-04-02 00:41:15 -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
Jason Fields
a6c65cf50a Organize and flesh-out tests for gg and G
Refs #5033
2021-03-29 20:03:50 -04:00
Jason Fields
11a4a87032 Slight refactor of test harness
This simplifies things, reduces jank, and makes test setup a little bit faster. A lot more refactoring could be done, but this is a good start.
2021-03-29 20:01:43 -04:00
Jason Fields
e606f5599d <BS> in replace mode goes over EOL
Fixes #6371
2021-03-29 11:03:54 -04:00
Jason Fields
a578a0b8d8 Fix [count]R
It was inserting the newly-entered characters again, rather than repeating the replace.
Fixes #6370
2021-03-28 21:43:09 -04:00
Jason Fields
a0f37f6eb7 Fix <BS> in replace mode when cursor is already before where it started
Fixes #6369
2021-03-28 21:16:50 -04:00
Jason Fields
d96ebf0c9b Remove a few instances of any
We love type safety, don't we folks?
2021-03-28 20:14:10 -04:00
Jason Fields
c45a73b2cd [count]<C-v> selects <count> characters 2021-03-28 19:17:13 -04:00
Jason Fields
79a570c0c3 Fix [count]gp in visual mode 2021-03-28 15:58:24 -04:00
Jason Fields
04068bf842 [count]v in normal mode selects <count> characters 2021-03-28 15:28:08 -04:00
Jason Fields
f19ccecec2 Fix [count]p in visual mode
Fixes #6357
2021-03-26 23:03:45 -04:00
Jason Fields
18327e0ff0 Improve startup performance by calling getCommands only once 2021-03-26 14:27:05 -04:00
Jason Fields
4043c978bd Remove leading underscores from private members
(Except when they're necessary because of getters/setters)
2021-03-22 00:06:36 -04:00