Commit Graph
100 Commits
Author SHA1 Message Date
Matt EllisandAlex Pláte d00bd8bb25 Fix incsearch highlights with operator count
E.g. `2"a3"b4"c5d6/foo` will now highlight the current match correctly
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte a66e44d835 Fix [count]: initial range text in ex field
Fixes regression from changes in ex field handling
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte ce05317634 Maintain Visual when cancelling search entry 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 33d88d55c9 Remove unused branch in SortCommand
Commands are executed in Normal mode, although there may be multiple carets
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte a31a4a8ca7 Share ex entry set up with filter commands 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte c34d000b91 Reintroduce ProcessGroup.startExEntry
We need to share the implementation between starting an Ex command, and starting a filter command, which is just an Ex command with initial text
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte a2bfe950fa Fix move command moving to current line
Removes a workaround that would break moving a range to the current line because it would always move the caret to the start of the range. Now positions the caret to the start of the selection if there is one. This also means we can remove the SAVE_VISUAL flag from JoinLinesCommand

Fixes VIM-2936
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte b44f40acd6 Fix incorrect output for line() in Normal mode 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 5169093bbf Clear ex output after assert and fix tests
This ensures that a failing action doesn't pass due to previous state
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte b15b1cd3f8 Fix range with missing last address
Fixes VIM-992
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte f7b6a97435 Support 0 as part of a range address
Fixes VIM-1137
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte f64c99c406 Support incsearch highlighting for global command
Fixes VIM-2891
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte f552e43c5b Refactor handling of default range
Specify a default range instead of default line for count.
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 4798198e41 Minor refactorings 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte a59de4ce05 Add tests and fixes for yank command
Handles validation for count and ensures correct behaviour for registers.
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 2dea525665 Add tests and fixes for join command
Handles validation for count and positions caret in the correct place. Also handles join with visual multicaret scenarios.
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 8ecb1f7296 Add tests and fixes for print command
Handles validation of count and correctly moves caret to end of range after execution. Also fix issue where the results of :print are accumulated and not cleared.

Fixes VIM-2570
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 9ca9530061 Add tests and fixes for shift commands
Shift left and right now work with counts, validate the counts and move the caret to the correct end position
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 54e27afc3f Simplify getCount functions
Made it explicit to get the count from argument and/or range. Default count is not passed, because it was never used. Added some tests where possible, but hard to test select file and friends
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 5e67032655 Add tests and fixes for delete lines command
Validates register before use and correctly uses register and count
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte cb37f6df63 Add tests and fixes for goto line command
Correctly handles some validation, and also allows going to line zero
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte ca3a18cf37 Add tests for goto character command
Also start to refactor handling of count
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte cac36627aa Support 0 in copy command to copy to top of file 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 6404e1127e Remove incorrect VimBehaviourDiffers annotation 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte e762a3093b Range is already normalised 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 739ac2ae5e Simplify getting address from argument 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 77c364a2d0 Move count handling out of range into command 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 103cd9f5ce Fix off-by-one error in count
Count needs to be one-based, lines must be zero-based. So store addresses as one-based until processed
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 99859fe857 Rename test classes
Also ensure that test derives from VimTestCase so that injector is correctly initialised
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 4778995f3b Remove unnecessary getFirstLine function 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 0a14150840 Extract TextRange from Ex range class 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte e8ffc0313f Remove Range overloads that don't require a caret
Provide caret when calling from Command
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 7dbd3886b1 Introduce addresses for current line and last line
Remove mutation from LineAddress
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 8c83164d76 Remove mutable state from Range
Sometimes we cache things, and other times it's relative to a passed caret. Let's always calculate it
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 076aab1ccf Rename Ranges, and ExRanges.kt 2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 751f51c88f Rename Range and related classes to Address
An address evaluates to a line, and a range is a collection of addresses
2024-06-03 11:54:48 +03:00
Matt EllisandAlex Pláte 7865388086 Fix regression when sub string ends with backslash
Fixes VIM-3428
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 26297bc5a9 Fix last line sometimes obscured by scrollbar
Fixes VIM-3028
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 9db5cdd8e3 Fix last line sometimes obscured by ex entry prompt
When performing a substitute command with confirmation, the height of the editor content pane should be reduced by the height of the ex entry panel. IdeaVim would do this correctly when moving a search result to the bottom of the file, but not when the result was on the last line of the file. Because the wrong height was used, IdeaVim would decide that no scrolling was necessary and the result in the last line would be obscured.

Fixes VIM-1560
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 2b17534a08 Fix infinite loop while highlighting in old regex
Fixes VIM-2510
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 4e2db68acf Update selection when searching in Visual mode 2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte ddabf8df5e Fix regression finding endpos in new regex engine
Fixes VIM-3344
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 3f28e197ca Clear status bar on scrolling, add/remove lines, etc.
Also implements <C-L> to "redraw" screen and clear status line
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 3a67524e8a Show status bar message when search wraps
Fixes VIM-1043
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 33312d95b0 Remove wrapscan flag for substitute
Substitute always works on a known range
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte f554b21cd9 Support count for search
Fixes VIM-2836
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte d9fa4e4648 Fix end of file atom for old regex engine
Fixes VIM-2888
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte e98a284d40 Fix multiline regex substitution
Fixes VIM-2141
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 38ef8c1053 Fix removing search highlight that crosses newline 2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte d3f560a31c Add special case to match newline with end of file 2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte e2cb3ff284 Stop subst skipping too far with multiline pattern
Fixes VIM-698
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 0f5a3953e1 Don't break ex field with exceptions from incsearch 2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 633667ed7f Fix regression with global not saving used patterns
This is a messy quick fix, as the search group needs a lot of tidying up right now. Perhaps a better implementation would be to move the implementation of the global command into the search group - processGlobalCommand, like we already have processSearchCommand and processSubstituteCommand

Fixes VIM-3348
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 656e975562 Fix reset of last substitution string on use
Fixes VIM-3354
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte f7fbe89de4 Use EnumSet instead of list of enums 2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 509829b052 Fix force ignorecase atom in search highlights
Fixes VIM-3391
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte efd61e17f2 Reset CMD_LINE mode when losing focus
Fixes VIM-3293
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte cf2b021d02 Fix search for last search pattern with new offset
Fixes VIM-2356
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 67f10aece5 Fix search motion type when providing offset
Search motion type should be linewise if there's a line offset, or inclusive if the `e` flag is provided. Otherwise, it's exclusive.

Fixes VIM-1940
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 9b5c777fcf Update highlights when editor scheme changes 2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte c65e5f8341 Fix highlighting for 'incsearch' and 'nohlsearch'
Setting 'incsearch' and 'nohlsearch' should highlight only the current match in the current editor
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 053bb603cd Fix errors with incsearch and substitute command
Fixes VIM-3325
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 93b07bbb90 Update comments and fix warnings 2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 764a115601 Show search highlights in all visible editors
Fixes VIM-2174
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte 1adfe53f29 Fix wrong offset returned for current search result
Fixes VIM-2779
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte bfe0f51cb1 Restore current match highlighting for :s command
Regression while migrating to the new regex engine removed the highlights shown when confirming each change
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte ffce61906a Restore search highlights when setting 'hlsearch'
Fixes VIM-3257
2024-05-28 13:53:13 +03:00
Matt EllisandAlex Pláte f382544101 Fix clearing highlighted yank in modal dialogs
Also fixes a memory leak registering a disposable for each yank, allows config variables to be numbers rather than strings and removes highlights when IdeaVim is disabled

Fixes VIM-2236
2024-05-24 18:05:51 +03:00
Matt EllisandAlex Pláte d00e802674 Update options documentation 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte c46008dddc Update Vim option even when IdeaVim is disabled 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 755000c376 Reset Vim options when IDE setting changes
Options are not reset if they've been explicitly set by the user (e.g. `:set list` or _View | Active Editor | Show Whitespaces_). They are reset if they were explicitly set in `~/.ideavimrc`.

Also bumps the IDE build number to 233.11799.241 in order to use EditorSettingsExternalizable.PropNames
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 1e4a60bfe6 Fix nullability warning 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte c9ee685956 Codify assumption re global-local external setting 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte c2b1083836 Updated descriptions as per review comments 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 3518528f22 Prevent resetting options when plugin re-enabled 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 9bed8fec79 Map 'scrolloff' and 'sidescrolloff' options
Fixes VIM-3110
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 3ffbea7d42 Match Vim's behaviour for :set[local] {option}<
String and number/toggle options have different and opposite behaviour for `:set {option}<` and `:setlocal {option}<`. This change matches Vim's behaviour.
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 39b42193cb Map 'scrolljump' and 'sidescroll' options
Fixes VIM-3110
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte c69e080b05 Add 'fileencoding' option
No tests, as I don't know how to test interaction with saving to disk
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 50b42036d1 Add 'bomb' option
No tests, as I don't know how to test interaction with saving to disk
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 340c40ceff Add 'fileformat' option
No tests, as I don't know how to test interaction with saving to disk
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 6aeffe71de Map 'number' and 'relativenumber' options 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 04c33d719e Improve relative line converter for soft wraps
It now shows visual lines relative to the caret's visual line, rather than relative to the caret's logical line. This still isn't correct, and we should be showing the relative count of Vim logical lines (buffer lines + fold lines) but this matches movement so is more helpful
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 07f1d1e8e6 Move number/relativenumber options out of engine
While they are core Vim options, they are implemented by the host, not by the engine. If another host wants to support these options, they can add them in their implementation layer.
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 6c61254c50 Add 'colorcolumn' option to show visual guides
IntelliJ ties the hard wrap right margin guide with the other visual guides, and it's not possible to show one without the other. In Vim, you can show the hard wrap margin by adding "+0" to 'colorcolumn', so in IdeaVim, we automatically add this.
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte c6efea8c34 Add 'textwidth' option
Also supports overriding local-to-buffer options with IDE values, ensuring that changes to the option/IDE value are applied to all editors for the buffer.

Fixes VIM-1310
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 80f43a7c66 Add 'cursorline' option 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 9f5d3a9a28 Add 'list' option to show whitespace
Fixes VIM-267
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 8800a4f70b Add 'breakindent' option
Fixes VIM-2748
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 990254dcac Sort ideavim.dic to make it easier to modify 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 73a1118e78 Extract base implementation for IDE backed options 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte d3bedf26cf Treat IDE value as default for 'wrap' option 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 25b29f429a Track how option value is set 2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte 363f821962 Introduce 'wrap' option based on IntelliJ setting
Fixes VIM-1265
2024-05-10 15:27:24 +03:00
Matt EllisandAlex Pláte bc808403fb Rename localEditors to getEditors
The fact that these methods only return local editors (i.e., editors for the local user while hosting a Code With Me session) is an implementation detail
2024-02-23 17:01:32 +02:00
Matt EllisandAlex Pláte 9d6dc317a4 Only notify editors for the current buffer 2024-02-23 17:01:32 +02:00
Matt EllisandAlex Pláte cf29c50f31 Ensure editors are initialised before use
Fixes VIM-3256
2024-02-23 17:01:32 +02:00
Matt EllisandAlex Pláte bd192561ae Stop IdeaVim actions flowing into JB Client
IdeaVim actions are local only - they control local behaviour and should not be visible in the Client

Fixes VIM-3283
2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte 66ff56a05e Move document listeners to global listeners
This means we listen to changes in all documents, rather than just the changes in the documents for open local editors. And this means that we correctly update e.g. marks when a non-local editor changes a file that isn't open in a local editor.
2024-02-23 15:54:20 +02:00
Matt EllisandAlex Pláte def86d179e Review disabled editor checks 2024-02-23 15:54:20 +02:00