Commit Graph
100 Commits
Author SHA1 Message Date
Matt EllisandAlex Pláte a005eb0612 Fix repeating change action with count
Fixes VIM-3729
2024-12-04 18:23:16 +02:00
Matt EllisandAlex Pláte 8da15b8c08 Manually track last selected editor
This is important for initialising options. We can't rely on FileEditorManager.selectedTextEditor, as 2024.2 changed behaviour to reset to null during creation of a new editor. This fixes tests (and option initialisation) for 242.
2024-11-22 17:01:38 +02:00
Matt EllisandAlex Pláte e22c2b6473 Improve updating fallback window option values
The assumption for selection change events is no longer valid in 242, so switch approach to checking when editors are released
2024-11-22 17:01:38 +02:00
Matt EllisandAlex Pláte e293c1b786 Add tests for updating the fallback window 2024-11-22 17:01:38 +02:00
Matt EllisandAlex Pláte 468ca840ed Update options tests
Expanded to assert changes on all open windows, and formatted to make it a little easier to read/comprehend what's being tested
2024-11-22 17:01:38 +02:00
Matt EllisandAlex Pláte 4f9d76ef66 Fix memory leak with non-disposed listeners
Fixes VIM-3319
2024-11-13 18:00:47 +02:00
Matt EllisandAlex Pláte 4b7381901d Fix bug removing map that is also a prefix 2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 6e2cb9ba11 Reorder functions. No logic changes 2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 91cd4ab01f Add sequences to iterate keystroke trie
Allows iterating the trie entries without having to create a list or create a list for each entry's keystrokes.
2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 34d23180bd Avoid wrapping the keys list for each map attempt 2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte fc5aaa50d8 Remove unnecessary hasmapfrom function 2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte c7bbfdcaf5 Remove some test only functions 2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 562906fe6d Filter map output by prefix
Fixes VIM-2981
2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 976771d11a Implement smap and snoremap
Support for sunmap and smapclear already exists, and vmap would introduce a Select mode map.

Fixes VIM-2260
2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 5fc4462b03 Support map! to map insert and cmdline modes
Also supports `mapclear!` and `unmap!`

Moves parsing of the bang modifier to the parser so we can tell the difference between `map! foo bar` and `map ! foo bar`
2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 5f263e7014 Fix output of maps with same keys in multiple modes
E.g. `map foo bar` and `vmap foo baz` would only output one map for `foo` when calling `:map`. Now it will output all maps that match the ex command's modes. This change also improves the marker characters in the first column of map output.
2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 4c899fcc93 Simplify test code 2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 2f8fe392af Use KeyStrokeTrie for maps 2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 84c7e1159b Introduce KeyStrokeTrie to find commands
Should also restore compatibility with idea-which-key
2024-11-13 17:57:31 +02:00
Matt EllisandAlex Pláte 18d6f79796 Add missing C-PageUp/Down shortcuts to switch tab
Fixes VIM-2044
2024-11-13 17:52:28 +02:00
Matt EllisandAlex Pláte a745da9761 Add Shift+Enter mapping to scroll page forward
Fixes VIM-2752
2024-11-13 17:52:28 +02:00
Matt EllisandAlex Pláte 5eb36ce428 Remove unneeded extended special name parsing
This was needed when action keys were registered in a comma separated list in a single XML attribute string. Additional encoding was needed for angle brackets and commas. Registration has changed, and this is no longer needed
2024-11-13 17:52:28 +02:00
Matt EllisandAlex Pláte 92ee271f1e Add fallback if ve guicursor option not specified 2024-11-05 12:29:13 +02:00
Matt EllisandAlex Pláte babc5daf3b Use Visual-exclusive caret shape from guicursor 2024-11-05 12:29:13 +02:00
Matt EllisandAlex Pláte 82d18cfbb9 Remove unused imports 2024-11-05 04:14:12 +02:00
Matt EllisandAlex Pláte b0dd75f77c Fix deprecated API usage 2024-11-05 04:14:12 +02:00
Matt EllisandAlex Pláte 727cfb36ba Remove pre-242 workaround 2024-11-05 04:14:12 +02:00
Matt EllisandAlex Pláte a7d5c5f2d4 Remove custom version for split mode
Split mode run task will use the same version as runIde
2024-11-05 04:14:12 +02:00
Matt EllisandAlex Pláte 1e02848a66 Update target IDEA version to 242
Note that this uses 2024.2.1 as the minimum version because 2024.2.0 is no longer available.
2024-11-05 04:14:12 +02:00
Matt EllisandAlex Pláte 879d191800 Scroll caret into view after undo/redo
This is to ensure that 'scrolloff' is applied. Relates to VIM-3671
2024-10-21 15:50:58 +03:00
Matt EllisandAlex Pláte 9d9e38843d Invoke undo/redo on correct editor
Fixes VIM-3671
2024-10-21 15:50:58 +03:00
Matt EllisandAlex Pláte f7aded99e8 Only perform incsearch in current project
Fixes VIM-3682
2024-10-21 15:50:58 +03:00
Matt EllisandAlex Pláte 34fe09c8f9 Use full width of output panel for text 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 10283ce2f8 Add support for custom digraphs 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte cc53b59658 Add digraph headers 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte c758a79f79 Minor refactor outputting digraphs 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 01d00d45d8 Add a default size for the digraph string builder 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 5c7edc498f Rename getDigraph - it gets a char from a digraph 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 9c403d2862 Simplify creating string digraph key 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte ebbd733bba Update default digraphs to match current Vim
List is based on Vim's documentation, although not all digraphs are documented. Additional digraphs are added based on the output of `:digraphs`. These additional digraphs include some digraphs that produce the same character, so the code is updated to handle duplicates, with the same ordering/priority as Vim.

Extra digraphs include the Euro symbol (`=e` and `Eu`), quadruple prime (`4'`) and bullet (`oo`), amongst others.

Also removes a number of non-standard digraphs. The symbols generated don't match the descriptions. The code appears to be private use, so are not reliable. Once custom digraphs are implemented, they can be easily added back in `~/.ideavimrc`
2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 88d1e1d24a Suppress language download inspection 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte c19f2aeee4 Update comments for default digraphs 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 86202c846a Remove unused commented digraph data 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 9a7ff442f3 Correctly format RTL and combining digraph chars 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 3752a97d74 Output digraph character codes in decimal, like Vim
Not sure why IdeaVim has used hex. Vim appears to have used decimal for at least 20 years.
2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 5572dfc80d Update digraph formatting to match Vim
Vim only use the `~` prefix if the encoding is "latin1". We can just treat it as though the encoding is Unicode, and match the other places we format printable characters. Note that for Vim, if `'display'` contains "uhex", then all unprintable characters are shown in hex, including control characters (`^C`, etc.). IdeaVim does not support the `'display'` option.
2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 100f420d46 Strip trailing spaces 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 3fcc4746d8 Migrate digraph output to engine 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte 5c5ac192da Add tests for digraph output 2024-09-05 19:22:04 +03:00
Matt EllisandAlex Pláte fb7a2de07b Encapsulate the command builder's state flag
This also gets rid of BAD_COMMAND, which was set but never checked - the function that set the flag would immediately reset the command builder
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte def9ca479b Ensure builder resets to a root command trie node
Also refactors command nodes a bit for better debug/trace output
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 0936e0761f Reorder CommandBuilder methods
Try to keep related functions together: awaiting arguments, count, registers, adding action/argument, processing keystrokes, build, reset.
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 09a335bcfe Start to encapsulate setting command builder state
Also rename `pushCommandPart` and `completeCommandPart`
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 37b8d69bac Remove unused EMPTY_COMMAND 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 13308050a8 Remove unnecessary OperatorArguments parameters 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte a1a553ebc9 Deprecate OperatorArguments.mode 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 5bb0c4f7cb Use editor.mode instead of OperatorArguments.mode
`OperatorArguments.mode` is the mode *before* the command was completed, rather than the current mode, which is non-obvious. E.g. for a command in Insert mode, it will still be Insert, and for a (simple) command in Normal, it will still be Normal. The only difference is that a command such as `dw` would be in Operator-pending before the command is completed. That logic is not required for this method, so it's safe to use the current mode.

This allows us to start to deprecate `OperatorArguments.mode`.
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte da6736f24a Simplify the logic when yanking during delete 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 4df1ce2ae8 Remove OperatorArguments.mode usage in block insert
`OperatorArguments.mode` is the mode *before* the command is completed, so might be Visual, Operator-pending, Insert, etc. It's not immediately obvious this is the case, so we're going to deprecate `OperatorArguments.mode` to avoid confusion with `editor.mode`.

It's not required for this method because it's only called for Visual-block mode.
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 00fd4cd491 Handle op-pending for space and backspace 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte d185672e2f Deprecate OperatorArguments.isOperatorPending
Register specific handlers for Operator-pending mode instead of relying on a runtime flag for behaviour. Also refactors and renames some arrow motion handlers.
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 55fef03a4a Add 'whichwrap' to dictionary 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 69b3e4f782 Start to refactor OperatorArguments 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 6be29b0378 Remove KeyHandler.isOperatorPending
It's easier to just look at mode. We don't need the additional check on command builder, because we can't be in OP_PENDING without pushing an operator action to the command builder
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 9965c863a6 Encapsulate command node state in builder 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 3f11ae512c Move register pending state to command builder 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 1c842eb3d8 Avoid exposing misleading count on command builder 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte c7fbce675b Update comment 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte d7e68488c8 Make Command.rawCount immutable 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 69d13a74e6 Remove unnecessary copy method 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 5a83df34a7 Replace var properties with read only 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 0a18c388e0 Simplify CommandBuilder
Fixes selecting last register if multiple registers are used in a command
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 1a3409e7df Remove count from motion argument
Only Command has a count. The motion argument is now a sealed class hierarchy, and consists only of the motion action and optional argument. This is to reduce confusion over which count to use, and potential incorrect calculation of the count
2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte e93db961a0 Wrap offsets argument as an external action 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 8fd76bd08f Refactor properties for sealed Argument classes 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 0eea4a5b2c Introduce sealed classes to represent an argument 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 18a0c533e2 Remove unused OperatedRange type 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte 0bd8d8f4d2 Remove unused digraph command flag 2024-08-30 16:36:24 +03:00
Matt EllisandAlex Pláte dfebe542d8 Fix incsearch highlight in multiple Rider instances
Unlike other IDEs, Rider has multiple client sessions. The IDE itself is the "local" session, while the external ReSharper process is treated as a "frontend" process. The code to get local editors was erroneously getting `ALL` sessions, rather than just `LOCAL` sessions, and assuming that the first was the local session. In Rider, opening three instances would add three additional clients, and that would change the order.

I don't know why I changed `LOCAL` to `ALL` when previously changing this bit of code. AIUI, using `LOCAL` should work fine. If it turns out that CWM or remote dev require `ALL`, please document why.

Fixes VIM-3549
2024-08-05 18:58:45 +03:00
Matt EllisandAlex Pláte 7fde47c08b Update README.md
Added links to POSIX spec
2024-08-01 14:04:58 +03:00
Matt Ellisandlippfi 13426915f4 Remove special case handling for macro recording 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi d766c3b8ee Add test for nested insert literal action 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi 844bc01537 Make functions protected 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi 3d2d32b022 Move special case code to actions 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi a8677d3dd7 Refactor expected argument type
We no longer need to track a previous fallback argument type, since we don't support nested commands inside a command builder. We can just return the current argument type, or its fallback
2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi 7217fdf734 Remove unused special case check
This was to handle nested commands, e.g. inserting a digraph inside a search `d/foo<C-K>OK<CR>`. The command line now has its own command builder, so this check is no longer needed
2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi 0c867b3869 Make some CommandBuilder properties immutable 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi b3bcab4336 Refactor DigraphResult to sealed classes 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi fe1b48a9b3 Refactor digraph prompt handling 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi b5a0862520 The last command part is the current one 2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi babc1f54e5 Return the last valid register if it exists
The last command part is not guaranteed to be a "select register" part. The user might have selected a register then typed an operator, and we might be waiting for a motion.
2024-07-23 23:08:24 +03:00
Matt Ellisandlippfi 32b910a65b Remove unused functions and properties 2024-07-23 23:08:24 +03:00
Matt EllisandAlex Pláte e07a16863e Show possible IDs based on the action's shortcuts
Fixes VIM-3499
2024-07-12 15:09:02 +03:00
Matt EllisandAlex Pláte afceecadbe Disable the configuration cache for GitHub actions
These tasks should be rewritten to work nicely with Gradle's configuration cache. In the meantime, this allows them to still run as actions.
2024-07-03 19:39:55 +03:00
Matt EllisandAlex Pláte b2a4e59571 Update gradle plugin to beta 8
Fixes an issue with resetting the sandbox after killing the IDE instead of quitting gracefully
2024-07-03 19:39:55 +03:00
Matt EllisandAlex Pláte 6b4e4bacd7 Fix null reference initialising output panel fonts
Fixes VIM-3515
2024-07-03 09:43:48 +03:00
Matt EllisandAlex Pláte e748b7b265 Fix soft wrap inconsistency in run console
IntelliJ has multiple soft wrap options. One for main editors, another for consoles and a third for previews. This can lead to inconsistencies if initialising a console based on a main editor when both have default values, versus the same scenario when the main editor has an explicit value. Furthermore, the run console's soft-wraps toggle button uses the global value, so can get out of sync if the local value is initialised to an explicit value. This change will only copy the soft wrap value over during initialisation for similar editors (main editor, preview, diff) and not for different editors (console).

Fixes VIM-3450
2024-06-28 16:50:25 +03:00
Matt EllisandAlex Pláte c2401ec013 Protect against recursion when opening editors
Fixes VIM-3066
2024-06-28 16:50:25 +03:00
Matt EllisandAlex Pláte 8073d7ecd0 Fix copying 'fileencoding' during window opening
The option should be "local-noglobal", and reset to default. Copying the value could cause the file to be converted immediately, possibly with a warning dialog

Fixes VIM-3467
2024-06-28 16:50:25 +03:00
Matt EllisandAlex Pláte 64f7859ba7 Fix switching to insert for non-file backed diff
Fixes VIM-3442
2024-06-28 16:50:25 +03:00