1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-17 16:31:45 +02:00

Compare commits

...

377 Commits
0.46 ... 0.51

Author SHA1 Message Date
Andrey Vlasovskikh
132f52785c Version 0.51 2019-02-12 00:08:12 +03:00
Andrey Vlasovskikh
c556ec2001 Merge branch 'fixes-by-matt'
# Conflicts:
#	resources/META-INF/plugin.xml
2019-01-28 23:05:23 +03:00
Andrey Vlasovskikh
d49683ab2f Updated Kotlin to 1.3 due to compatibility IntelliJ 2019.1
The minimal compatible version is now 2018.3.
2019-01-28 22:56:14 +03:00
Andrey Vlasovskikh
810c3cd561 Use the IntelliJ repo instead of the default cache-redirector due to network issues 2019-01-28 21:54:55 +03:00
Andrey Vlasovskikh
b909157f4b Mention Rider as a compatible IDE 2019-01-28 21:51:16 +03:00
Andrey Vlasovskikh
21c1232ba6 Updated the changelog 2019-01-28 21:42:21 +03:00
Andrey Vlasovskikh
ff61a42670 Updated usages of obsolete APIs 2019-01-28 21:40:14 +03:00
Andrey Vlasovskikh
f160d855c0 Added missing nullity annotations 2019-01-28 21:38:37 +03:00
Andrey Vlasovskikh
51685a2094 Renamed attributes according to naming convention 2019-01-28 20:49:23 +03:00
Andrey Vlasovskikh
487c71ec15 Updated since-build according to the version that introduced the required API 2019-01-28 20:42:40 +03:00
Andrey Vlasovskikh
39aa60850d Fixed inspection warnings 2019-01-28 20:41:56 +03:00
Andrey Vlasovskikh
872921e6b7 Reformat code 2019-01-28 20:39:45 +03:00
Andrey Vlasovskikh
89788df95c Merge branch 'pull/173' 2019-01-28 20:38:03 +03:00
Andrey Vlasovskikh
6ccd8ed0b8 Added Matt Ellis to the list of contributors 2019-01-27 17:04:44 +03:00
Andrey Vlasovskikh
aa7e3bfa69 Updated changelog 2019-01-27 17:03:46 +03:00
Andrey Vlasovskikh
00154f2b9f Merge branch 'pull/170' 2019-01-27 16:48:05 +03:00
Matt Ellis
531a9c28ae VIM-1558 Support block inlays 2019-01-25 12:31:42 +00:00
Matt Ellis
56c4e3e31f VIM-1187 Fix performance with large files and relative line numbers 2019-01-08 13:47:05 +00:00
Matt Ellis
ef2497cadc Update to IJ 2018.3 2019-01-08 13:46:20 +00:00
Andrey Vlasovskikh
95f56a8869 Added Alex Plate to the contributors list 2018-12-31 18:10:44 +03:00
Andrey Vlasovskikh
f5b1112304 Updated changelog 2018-12-31 18:09:55 +03:00
Andrey Vlasovskikh
333a5be30b Merge branch 'pull/162' 2018-12-31 18:05:38 +03:00
Andrey Vlasovskikh
6c9e697892 VIM-620 Fixed handling nested <C-O> & <Esc> in Insert and Replace modes 2018-12-31 18:01:15 +03:00
Alex Plate
7663eb531e Write test to reproduce VIM-620 issue
Enter insert mode after single command produces incorrect behaviour.
Insert mode is not escaped after Esc
2018-12-29 00:36:51 +03:00
Andrey Vlasovskikh
33499fe945 Version 0.50 2018-10-18 15:00:16 +03:00
Andrey Vlasovskikh
2882b638e5 Use latest stable IntelliJ, Kotlin, gradle-intellij-plugin 2018-10-18 14:45:33 +03:00
Alex Plate
5529bf284a VIM-798 Arrow keys for window navigation commands
Add new mappings to allow window navigation with arrow keys:
- ^W-<left> as ^W-h
- ^W-<down> as ^W-j
- ^W-<up> as ^W-k
- ^W-<right> as ^W-l
2018-10-01 20:19:25 +03:00
Andrey Vlasovskikh
81c92cda79 Updated changelog 2018-09-21 19:34:50 +03:00
Andrey Vlasovskikh
6506935d03 Merge branch 'vim-1274' 2018-09-21 19:31:40 +03:00
John Lin
b6be26231f VIM-1274 Fix StringHelper.containsUpperCase behavior
StringHelper.containsUpperCase should return true when one of
the character of the input string satisfies the following two
conditions:

1. The character is upper case.
2. The character is not prefixed with a backslash.

Before this fix, the second condition was incorrectly written.
2018-09-17 11:53:23 +08:00
Andrey Vlasovskikh
a96ba9f717 Updated changelog 2018-09-17 01:13:11 +03:00
Andrey Vlasovskikh
173f570230 EA-108647 Check if the editor is disposed in invokeLater() 2018-09-14 18:19:37 +03:00
Andrey Vlasovskikh
57dcaba367 EA-89803 Fixed running IntelliJ write actions directly within Swing timer handler
We have to switch to a transaction with an appropriate modality state.
2018-09-14 18:08:45 +03:00
Andrey Vlasovskikh
d9f7955356 VIM-1366 Don't wrap secondary event loop for input() into write action
Extension handlers are now run without outer read / write actions and
they are required to synchronize access to the data structures of
IntelliJ by themselves.
2018-09-14 17:28:25 +03:00
Andrey Vlasovskikh
9cf264998f VIM-1317 Don't run Undo/Redo inside write actions
They show UI dialogs, which is not allowed under a write action, and
they use their own write actions when needed.
2018-09-14 17:23:10 +03:00
Andrey Vlasovskikh
0dc67ae467 Updated changelog 2018-09-10 15:40:15 +03:00
Andrey Vlasovskikh
75c1c0b839 Move "Vim Emulation" settings into "File | Settings | Editor" 2018-09-10 14:53:26 +03:00
Andrey Vlasovskikh
1feac95069 VIM-339 Handle <Esc> by Vim only in primary or physical file editors
<Esc> is handled by the Vim emulation in primary editors of the main
window and in non-primary editors with physical files open in them,
but only in modes other than Normal. This is needed for the diff dialog
where you can have both physical file editors and non-physical file
editors, but they are non-primary, so users still expect <Esc> to close
the diff window when the editor is in the Normal mode.
2018-09-10 14:45:22 +03:00
Andrey Vlasovskikh
ed3f87e6a8 VIM-176 Treat console editors like any other editors
If an editor is a writable non-file editor (like a console), then we
activate the 'i' mode *and* allow running write commands. Thus,
Insert mode commands like arrow navigation will work in these editors.
2018-09-08 19:20:53 +03:00
Andrey Vlasovskikh
43662318be Compatibility with IntelliJ 2018.1 and newer due to the platform API changes 2018-08-27 22:06:09 +03:00
Andrey Vlasovskikh
785d1a04da Merge pull request #157 from JetBrains/multiple-carets 2018-08-27 21:55:57 +03:00
Andrey Vlasovskikh
cc76c7f0f3 Merge pull request #156 from karavaevitalii/multiple-carets
Fixed bug with selecting occurrences when ignorecase is set
2018-08-27 21:55:06 +03:00
Vitalii Karavaev
57741cd5ce Fixed bug with selecting occurrences when ignorecase is set 2018-08-27 21:23:25 +03:00
Andrey Vlasovskikh
69bd71148c Added Vasily Alferov and Vitalii Karavaev to the contributors list 2018-08-27 21:00:13 +03:00
Andrey Vlasovskikh
528e363d64 Updated changelog 2018-08-27 20:57:09 +03:00
Andrey Vlasovskikh
bd772daee0 Small reordering of multiple-cursors commands 2018-08-27 20:51:04 +03:00
Andrey Vlasovskikh
23fa55ea11 Updated the list of all supported commands
Removed the multiple carets support marker, since all commands are
basically covered now. We'll handle any bugs left in the same way we
do it for other bugs.
2018-08-27 20:50:07 +03:00
Vitalii Karavaev
0a052e7bb3 Cleanup 2018-08-10 18:18:43 +03:00
Vitalii Karavaev
60a96e9542 Cleanup 2018-08-10 17:32:30 +03:00
Vitalii Karavaev
f3f9abef0c <A-x> shows no more matches message when necessary 2018-08-10 17:06:10 +03:00
Vitalii Karavaev
58fc34d9f7 Implement <A-x> 2018-08-10 17:01:36 +03:00
Vitalii Karavaev
6fdd769d0f Implement <A-p> 2018-08-10 16:43:46 +03:00
Vitalii Karavaev
b54384bb33 Implement <Plug>All<Whole>Occurrences 2018-08-10 16:31:48 +03:00
Vitalii Karavaev
c57f98591a Revert MultipleCursorsExtension and implement <A-n> 2018-08-10 14:08:25 +03:00
Vitalii Karavaev
7dcacd3b01 Minor fixes 2018-08-09 17:45:56 +03:00
Vitalii Karavaev
2225033b7c Reset state and additional checks 2018-08-09 17:32:32 +03:00
Vitalii Karavaev
7c5194fbaa Better work in case of multiple carets 2018-08-09 14:55:22 +03:00
Vitalii Karavaev
cded76d1a2 Test 2018-08-09 14:52:47 +03:00
Vitalii Karavaev
361284fe06 Fixed <A-n> in visual mode 2018-08-09 14:25:29 +03:00
Vitalii Karavaev
aa3e55cacc Fixed bug with multiple carets <A-n> action 2018-08-09 13:54:31 +03:00
Vitalii Karavaev
73987eaf23 Safer work in case of multiple carets 2018-08-09 12:47:40 +03:00
Vitalii Karavaev
06058a45c0 Fixed review issues and README.md updated 2018-08-09 12:35:08 +03:00
Vitalii Karavaev
d46cab6fc8 Fixed review issues 2018-08-09 11:18:39 +03:00
Vitalii Karavaev
77bd800d95 private modifier 2018-08-08 16:11:55 +03:00
Vitalii Karavaev
831373c292 Cleanup 2018-08-08 15:59:44 +03:00
Vitalii Karavaev
9c5e5e117a Cleanup 2018-08-08 15:47:35 +03:00
Vitalii Karavaev
346ada2eff Blank lines 2018-08-08 15:45:56 +03:00
Vitalii Karavaev
485ff37b22 Better work with nulls 2018-08-08 15:38:33 +03:00
Vitalii Karavaev
47ef6f4844 Show message when no more matches 2018-08-08 15:19:03 +03:00
Vitalii Karavaev
cd288ec125 Support for selection all occurrences 2018-08-08 15:16:13 +03:00
Vitalii Karavaev
bde2eb786d g<A-n> support 2018-08-08 14:38:33 +03:00
Vitalii Karavaev
b6896e28c8 Better support for vim-multiple-cursors extension 2018-08-08 13:57:16 +03:00
Vitalii Karavaev
15dc233a86 Overlap carets when jump to mark 2018-08-08 10:20:15 +03:00
Vitalii Karavaev
b070549eca Remove gn action 2018-08-07 17:42:18 +03:00
Vitalii Karavaev
71a3df028b Fixed review issues 2018-08-07 17:37:11 +03:00
Vitalii Karavaev
73ef8c821b Minor review issues 2018-08-07 16:47:18 +03:00
Vitalii Karavaev
bbd314b6df Test :s/// 2018-08-07 15:05:46 +03:00
Vitalii Karavaev
5764fe7555 Multiple carets support for :@ 2018-08-07 14:54:42 +03:00
Vitalii Karavaev
44cc17cb84 Multiple carets support for :s/// 2018-08-07 14:53:10 +03:00
Vitalii Karavaev
dba8879576 Formatted lines 2018-08-07 10:29:56 +03:00
Vitalii Karavaev
1deb48bf60 Fixed broken tests 2018-08-07 10:28:37 +03:00
Vitalii Karavaev
11174b8581 Tests :sor 2018-08-07 10:17:47 +03:00
Vitalii Karavaev
bd35f71c6a :sor multicaret support 2018-08-07 10:17:47 +03:00
Vitalii Karavaev
d29ae6a64d :> fix bug and multiple carets support 2018-08-06 16:01:39 +03:00
Vitalii Karavaev
5b69b9beae :< fix bug and multiple carets support 2018-08-06 15:55:47 +03:00
Vitalii Karavaev
0c78741642 Warnings 2018-08-06 15:54:58 +03:00
Vitalii Karavaev
a9440f41a7 Support skip and remove for vim-multiple-cursors emulation 2018-08-06 15:18:05 +03:00
Vitalii Karavaev
8fc4306d76 :d support 2018-08-06 13:42:21 +03:00
Vitalii Karavaev
371d7385ed Vim Multiple Cursors extension prototype 2018-08-06 12:14:50 +03:00
Vitalii Karavaev
2cacdbaf00 Minor 2018-08-06 10:24:09 +03:00
Vitalii Karavaev
3041fe7c3b Rename VisualSelectNextOccurrence to VimSelectNextOccurrence 2018-08-06 09:45:49 +03:00
Vitalii Karavaev
436e96f734 Test :y 2018-08-03 18:15:24 +03:00
Vitalii Karavaev
67a9e1f8c5 Remove support for ex commands with visual selection and multiple carets support for :y 2018-08-03 17:30:44 +03:00
Vitalii Karavaev
fc0a950af1 Cleanup 2018-08-03 14:35:23 +03:00
Vitalii Karavaev
e1872387d4 Shortcut for caret adding prototype 2018-08-03 14:08:06 +03:00
Vitalii Karavaev
ac10b96280 Better work with nullable carets 2018-08-03 11:15:17 +03:00
Vitalii Karavaev
d5313ebbda Remove warnings 2018-08-02 18:09:36 +03:00
Vitalii Karavaev
c3d1e5c58c Remove warnings 2018-08-02 17:26:08 +03:00
Vitalii Karavaev
478c0cd443 Replace block of code with function call 2018-08-02 17:20:29 +03:00
Vitalii Karavaev
2be2d861c9 Update action for [p and update package-info 2018-08-02 12:04:56 +03:00
Vitalii Karavaev
9731980fe6 Fixed incompatibility wit goto mark action and preparing to remove inconsistency between yank and delete 2018-08-02 11:57:06 +03:00
Vitalii Karavaev
392f8e5e60 Fix goto mark actions 2018-08-02 11:54:16 +03:00
Vitalii Karavaev
a7e1275b5f Remove redundant null check 2018-08-01 14:19:55 +03:00
Vitalii Karavaev
29a6d47cca Correct annotation 2018-08-01 14:18:04 +03:00
Vitalii Karavaev
65483dd34a Correct Javadoc 2018-08-01 14:12:08 +03:00
Vitalii Karavaev
3b290fe356 Add tests and fix bug for CopyGroup 2018-08-01 13:59:05 +03:00
Vitalii Karavaev
2648913b61 Corrected review issues 2018-08-01 10:55:54 +03:00
Vitalii Karavaev
d386e49bd5 Simplify logic and remove unused logger 2018-08-01 10:42:31 +03:00
Vitalii Karavaev
f3c66d131e Test :m 2018-07-31 16:38:00 +03:00
Vitalii Karavaev
c1b4671435 Multiple carets support for :m 2018-07-31 16:37:47 +03:00
Vitalii Karavaev
cbeb0d229b Remove todo 2018-07-31 10:49:35 +03:00
Vitalii Karavaev
7f8db50017 Test :pu 2018-07-31 10:44:56 +03:00
Vitalii Karavaev
0c5ca37412 Multiple carets support for :pu command 2018-07-31 10:41:45 +03:00
Vitalii Karavaev
602071a440 Remove warning 2018-07-30 17:50:17 +03:00
Vitalii Karavaev
7061b58940 Remove warnings 2018-07-30 17:44:25 +03:00
Vitalii Karavaev
76c2c54e5a Remove unnecessary comments 2018-07-30 15:50:26 +03:00
Vitalii Karavaev
f256da8a16 Tests :co 2018-07-30 15:42:31 +03:00
Vitalii Karavaev
ffcf7d0630 Multiple carets support for :co 2018-07-30 15:42:20 +03:00
Vitalii Karavaev
b80205200c Tests for :j 2018-07-30 15:17:28 +03:00
Vitalii Karavaev
40d0f6c1e2 Multiple carets support for join lines via :j 2018-07-30 15:05:41 +03:00
Vitalii Karavaev
bddd4db2b2 Uncertainty 2018-07-30 15:04:19 +03:00
Vitalii Karavaev
7ee18e81c7 Remove unused function 2018-07-30 10:56:50 +03:00
Vitalii Karavaev
700240d441 Remove warnings 2018-07-26 15:24:34 +03:00
Vitalii Karavaev
539d38259c Remove TODO 2018-07-26 15:17:29 +03:00
Vitalii Karavaev
2efb0dfb17 Multicaret support for go to line 2018-07-26 14:52:40 +03:00
Vitalii Karavaev
f38bf65656 Tests for ex commands 2018-07-26 13:56:08 +03:00
Vitalii Karavaev
947d32d905 Multiple carets support for :go command 2018-07-26 13:55:51 +03:00
Vitalii Karavaev
56569966a6 Preparing for multicaret support for ex commands 2018-07-26 13:55:24 +03:00
Vitalii Karavaev
6092535041 Remove some warnings 2018-07-26 11:46:14 +03:00
Vitalii Karavaev
d965eb0d7e Tests for fix overlapping carets 2018-07-26 11:34:05 +03:00
Vitalii Karavaev
44a53ce28e Fix bug with overlapping carets 2018-07-26 11:33:32 +03:00
Vitalii Karavaev
a228f32f34 Remove possible NPE 2018-07-26 11:01:04 +03:00
Vitalii Karavaev
2082981bd6 Permute parameters 2018-07-26 10:28:41 +03:00
Vitalii Karavaev
994ad0b06c Tests 2018-07-25 16:47:14 +03:00
Vitalii Karavaev
3c59ee79f6 Refactoring and TODO 2018-07-25 16:47:00 +03:00
Vitalii Karavaev
b3ebd7c29d Fix caret order for different put cases 2018-07-25 14:53:28 +03:00
Vitalii Karavaev
fcc2355037 Add caret offsets to tests 2018-07-25 12:00:04 +03:00
Vitalii Karavaev
76a5c39fdc Remove warnings and fixed null handling 2018-07-25 11:24:22 +03:00
Vitalii Karavaev
f4ec448d75 Add constants and remove TODO 2018-07-25 11:06:54 +03:00
Vitalii Karavaev
e38390f8a1 Codestyle 2018-07-25 10:59:12 +03:00
Vitalii Karavaev
2990389ea5 Codestyle 2018-07-25 10:50:03 +03:00
Vitalii Karavaev
249dfb166d Change if/else block to switch 2018-07-25 10:03:20 +03:00
Vitalii Karavaev
4c06d21396 Proper marks in case of put [count] 2018-07-25 09:57:56 +03:00
Vitalii Karavaev
a046f2975f Remove TODO: use tabs as needed 2018-07-24 11:51:52 +03:00
Vitalii Karavaev
0bf217ef36 Pair.NonNull instead of Pair 2018-07-24 10:12:19 +03:00
Vitalii Karavaev
f2712d8cfb Pair.create instead of constructor call 2018-07-23 18:14:59 +03:00
Vitalii Karavaev
bb32e7adb4 Multiple carets support for put visual text 2018-07-23 16:33:04 +03:00
Vitalii Karavaev
cadaec585b Minor fixes 2018-07-23 13:25:55 +03:00
Vitalii Karavaev
11c2f5014f Fixed bug yank blockwise 2018-07-23 12:50:58 +03:00
Vitalii Karavaev
2326489658 Multiple carets support for yank visual 2018-07-23 12:39:31 +03:00
Vitalii Karavaev
01ec08e20b Multiple carets support for going to character/line in command mode 2018-07-20 14:16:18 +03:00
Vitalii Karavaev
69ebcc17e9 Put text bug fixed 2018-07-20 14:15:27 +03:00
Vitalii Karavaev
b86bdd7847 Explicitly passing carets to some methods and cleanup 2018-07-20 11:53:50 +03:00
Vitalii Karavaev
fbd7409851 Moved putText to single method and better work with multicaret insertion 2018-07-20 11:25:53 +03:00
Vitalii Karavaev
0773c886ee Fixed bug with put blockwise text. Properly this time 2018-07-19 18:00:14 +03:00
Vitalii Karavaev
d05c7268d9 Fixed bug with put blockwise text 2018-07-19 17:44:11 +03:00
Vitalii Karavaev
80d0748edd minor 2018-07-19 17:15:42 +03:00
Vitalii Karavaev
fcbf228d35 Proper indent after yank commands 2018-07-19 16:53:22 +03:00
Vitalii Karavaev
34feb27bef Yank commands and tests 2018-07-19 16:11:28 +03:00
Vitalii Karavaev
86f707bc51 More tests 2018-07-19 15:57:13 +03:00
Vitalii Karavaev
07f74f82b5 Better tests for put text commands 2018-07-19 12:44:48 +03:00
Vitalii Karavaev
60917433d2 Update package-info 2018-07-19 11:22:36 +03:00
Vitalii Karavaev
dd59e0704a Update package-info 2018-07-19 11:18:57 +03:00
Vitalii Karavaev
d4bf472291 Refactoring 2018-07-19 11:07:56 +03:00
Vitalii Karavaev
039b650953 Remove redundant caret passing 2018-07-19 11:06:31 +03:00
Vitalii Karavaev
0148860b2d Test for put text 2018-07-18 15:39:21 +03:00
Vitalii Karavaev
49590c831f PutTextAfterCursorAction implemented 2018-07-18 15:39:06 +03:00
Vitalii Karavaev
9aed0ce621 Revert CopyGroup and implement putTextBeforeCursor action 2018-07-18 12:27:37 +03:00
Vitalii Karavaev
9b653a7c63 Fix visual block insert/append 2018-07-18 10:38:16 +03:00
Vitalii Karavaev
8d919d6ec8 Added some tests 2018-07-17 15:59:27 +03:00
Vitalii Karavaev
bb0094038a Remove unnecessary caret passing in some cases and started to simplify ChangeGroup methods 2018-07-17 15:59:01 +03:00
Vitalii Karavaev
c29764b164 Updated .gitignore and codestyle config 2018-07-17 09:45:19 +03:00
Vitalii Karavaev
ae55f5d605 Multicaret support for yank visual range 2018-07-16 14:41:48 +03:00
Vitalii Karavaev
81ca21517a Update package-info 2018-07-16 14:41:27 +03:00
Vitalii Karavaev
24a4167296 Multicaret support for yank motion 2018-07-16 13:59:19 +03:00
Vitalii Karavaev
3ffd967b00 Update package-info 2018-07-16 13:41:50 +03:00
Vitalii Karavaev
a2a1f4806a Multicaret support for yank lines 2018-07-16 13:39:16 +03:00
Vitalii Karavaev
6b56d7d1cd Remove redundant code 2018-07-16 12:06:21 +03:00
Vitalii Karavaev
b5a802bf30 Update package-info 2018-07-16 11:58:39 +03:00
Vitalii Karavaev
b4586779b3 Remove unused function 2018-07-16 11:34:43 +03:00
Vitalii Karavaev
d92d5a1b33 Remove unused functions 2018-07-16 11:32:59 +03:00
Vitalii Karavaev
52ec080343 Remove unused function 2018-07-16 11:31:38 +03:00
Vitalii Karavaev
5bff61c2ee Discard redundant changes 2018-07-16 11:23:48 +03:00
Vitalii Karavaev
c12b713543 Remove unused methods and fix bug 2018-07-16 11:19:00 +03:00
Vitalii Karavaev
7bafa0f8c8 Fix broken going to [count] line end. 2018-07-16 11:16:43 +03:00
Vitalii Karavaev
a47cdb9f35 Remove unnecessary throws clause 2018-07-16 11:15:24 +03:00
Vitalii Karavaev
bd9ac3b031 Pull check if caret is not null up in base class 2018-07-16 11:14:29 +03:00
Vitalii Karavaev
22ad45cd58 Fixed expression with both pure and side-effects and inline unnecessary function call 2018-07-16 11:12:53 +03:00
Vitalii Karavaev
58e0b7704b Remove unused method 2018-07-16 10:30:19 +03:00
Vitalii Karavaev
b78854b8de Remove unnecessary function calls and properly handle multicaret jump to mark 2018-07-16 10:29:12 +03:00
Vitalii Karavaev
ae61ed456f Multiple carets support for put text instead of visual block 2018-07-12 17:32:50 +03:00
Vitalii Karavaev
bdc1103641 Proper indents 2018-07-12 15:45:47 +03:00
Vitalii Karavaev
689d19759d Remove indent in pasting text where necessary 2018-07-12 15:44:52 +03:00
Vitalii Karavaev
7f34b826b2 Fix test 2018-07-12 14:29:37 +03:00
Vitalii Karavaev
064d3765c0 Multiple carets support for auto indent and refactoring 2018-07-12 14:29:12 +03:00
Vitalii Karavaev
752814a5fb .idea/Project.xml removed 2018-07-12 14:26:15 +03:00
Vitalii Karavaev
861028ef5c Proper code style 2018-07-12 12:20:03 +03:00
Vitalii Karavaev
dad0d8e559 Tests for pasting 2018-07-12 12:18:44 +03:00
Vitalii Karavaev
75f88c539c Multiple carets support for putting text without indent 2018-07-12 10:20:31 +03:00
Vitalii Karavaev
1109650fde Multiple carets support for put text 2018-07-12 10:06:11 +03:00
Vitalii Karavaev
704f8d7e9d Proper indent in visual mode changes 2018-07-10 15:37:06 +03:00
Vitalii Karavaev
4a2c3d9098 Inserting new line for particular caret bug fixed 2018-07-10 14:22:32 +03:00
Vitalii Karavaev
d21b04acb5 Better multiple carets handling in some cases and cleanup 2018-07-10 13:38:17 +03:00
Vitalii Karavaev
5403336c78 Minor code cleanup 2018-07-09 16:09:54 +03:00
Vitalii Karavaev
def6d2bd5b Change behaviour when inserting previously inserted text 2018-07-09 14:53:54 +03:00
Vitalii Karavaev
04db2764c1 Better insertion after line end 2018-07-09 14:47:24 +03:00
Vitalii Karavaev
0e9b2250bd Multiple carets support for inserting after line end 2018-07-09 14:38:42 +03:00
Vitalii Karavaev
654d345d78 Fix bug in insertion previously inserted text 2018-07-09 11:05:59 +03:00
Vitalii Karavaev
99e379392b Fix typo 2018-07-09 09:54:41 +03:00
Vitalii Karavaev
1debd99701 Multiple carets support for jumping to older/newer cursor position in jump list 2018-07-06 17:03:48 +03:00
Vitalii Karavaev
a099070c79 Multiple carets support for moving caret to the middle column 2018-07-06 15:22:52 +03:00
Vitalii Karavaev
0a09b8bd5a Multiple carets support for motion to first non-blank character of the screen line 2018-07-06 15:09:56 +03:00
Vitalii Karavaev
b3750dd24d Multiple carets support for motion to first/last screen column 2018-07-06 14:59:13 +03:00
Vitalii Karavaev
db1b0c2516 Multiple carets support for searching substrings 2018-07-06 14:32:19 +03:00
Vitalii Karavaev
fc6208b95d Goto first line bug fixed 2018-07-06 14:17:43 +03:00
Vitalii Karavaev
e68d3eac7d Multiple carets support for repeating latest search 2018-07-06 12:41:48 +03:00
Vitalii Karavaev
d093b446c2 Multiple carets support for going to [count] line from bottom of window 2018-07-06 12:19:21 +03:00
Vitalii Karavaev
be839051d5 Multiple carets support for going to [count] line from bottom of window 2018-07-06 12:07:16 +03:00
Vitalii Karavaev
8937068b5f Multiple carets support for going to [count] line from top of window 2018-07-06 11:58:21 +03:00
Vitalii Karavaev
3f82020100 Multiple carets support for going to line 2018-07-06 11:39:57 +03:00
Vitalii Karavaev
63ee6bbc56 Multiple carets support for searching entry in reversed direction 2018-07-05 17:40:23 +03:00
Vitalii Karavaev
7046680765 Multiple carets support for searching entry in forward direction 2018-07-05 17:35:54 +03:00
Vitalii Karavaev
c17334f17f Multiple carets support for jumping on mark line 2018-07-05 17:13:01 +03:00
Vitalii Karavaev
ecd40231a5 Multiple carets support for jumping to mark added 2018-07-05 16:52:32 +03:00
Vitalii Karavaev
c3935aafc9 Tests for finding next item in line 2018-07-05 09:44:25 +03:00
Vitalii Karavaev
9b751da31c Multiple carets support for matching items 2018-07-04 17:48:34 +03:00
Vitalii Karavaev
b464d99bd5 Tests for searching whole word 2018-07-04 16:23:59 +03:00
Vitalii Karavaev
f3d168f19f Multiple carets support for searching whole word 2018-07-04 16:08:37 +03:00
Vitalii Karavaev
bb8fa94668 Tests for moving cursor after last char in the file 2018-07-04 15:11:10 +03:00
Vitalii Karavaev
4f4d9fda0b Multiple carets support for moving cursor after last char in the file 2018-07-04 15:10:32 +03:00
Vitalii Karavaev
24994fa387 Test for moving carets to the first char in the file 2018-07-04 14:44:12 +03:00
Vitalii Karavaev
f4bb745519 Multiple carets support for moving cursor to the first char in the file 2018-07-04 14:41:17 +03:00
Vitalii Karavaev
a03258999a Multiple carets support for deleting the word before cursor in insert mode 2018-07-04 12:31:29 +03:00
Vitalii Karavaev
3f45200cb9 Fixed bug in test 2018-07-04 12:28:08 +03:00
Vitalii Karavaev
4703e75003 Test for inserting previously inserted text and stop inserting added 2018-07-04 10:20:43 +03:00
Vitalii Karavaev
39b166b87f Multiple caret support for insert previously inserted text and stop inserting added 2018-07-04 10:19:17 +03:00
Vitalii Karavaev
ded21efe5f Test for inserting previously inserted text 2018-07-03 15:49:46 +03:00
Vitalii Karavaev
4952ddc494 Multiple carets support for inserting previously inserted text 2018-07-03 15:49:03 +03:00
Vitalii Karavaev
8ffc9b6581 Simple case for insert previous inserted text implemented 2018-07-02 17:46:17 +03:00
Andrey Vlasovskikh
f0be6581b2 Merge branch 'master' into multiple-carets
# Conflicts:
#	src/com/maddyhome/idea/vim/action/motion/object/MotionInnerBlockTagAction.java
#	src/com/maddyhome/idea/vim/action/motion/object/MotionOuterBlockTagAction.java
#	src/com/maddyhome/idea/vim/group/MotionGroup.java
#	src/com/maddyhome/idea/vim/helper/SearchHelper.java
2018-06-29 12:39:39 +03:00
Andrey Vlasovskikh
356217a6af Added Konstantin Petrov to the contributors list 2018-06-28 16:12:39 +03:00
Andrey Vlasovskikh
9b5c86211b Updated changelog 2018-06-28 16:12:20 +03:00
Andrey Vlasovskikh
ef470bd890 Merge branch 'FIX-VIM-1287' 2018-06-28 16:09:47 +03:00
Andrey Vlasovskikh
428d75968c VIM-1287 More tests for badly nested blocks and strings 2018-06-28 16:09:21 +03:00
Andrey Vlasovskikh
dca4b0a399 VIM-1287 Removed redundant code 2018-06-28 16:08:55 +03:00
Andrey Vlasovskikh
2380e1b013 Added Jan Palus to the contributors 2018-06-04 16:11:50 +03:00
Andrey Vlasovskikh
9718445b44 Updated the changelog 2018-06-04 16:11:38 +03:00
Andrey Vlasovskikh
7f897440b7 Merge remote-tracking branch 'jpalus/master' 2018-06-04 16:05:10 +03:00
Andrey Vlasovskikh
5b21074b9d Merge remote-tracking branch 'jpalus/VIM-1431' 2018-06-04 16:01:42 +03:00
Jan Palus
b0714075eb add test for VIM-1427 (tag motion with count) 2018-06-02 15:26:02 +02:00
Jan Palus
956b56a772 add test for VIM-1431 (put in empty file) 2018-06-02 15:10:26 +02:00
Jan Palus
50b2093548 generalize check on offset boundaries 2018-06-02 15:09:28 +02:00
Andrey Vlasovskikh
bc5ca28b13 Fixed API incompatibility 2018-05-30 22:26:50 +03:00
Andrey Vlasovskikh
653a62b5e4 Switched to IntelliJ 2018.1 2018-05-30 22:26:24 +03:00
Andrey Vlasovskikh
08780e1a5c Updated changelist 2018-05-30 21:54:23 +03:00
Andrey Vlasovskikh
ce39355025 Added Florian Hassmann to the list of contributors 2018-05-30 21:53:05 +03:00
Andrey Vlasovskikh
3eed987488 Fixed code inspection warnings in FileGroup 2018-05-30 21:51:20 +03:00
Andrey Vlasovskikh
6f633700ae Removed deprecated API usages 2018-05-30 21:27:57 +03:00
Andrey Vlasovskikh
a7670829d5 Fixed NPE 2018-05-30 21:27:01 +03:00
Andrey Vlasovskikh
6fb8817391 Code style 2018-05-30 21:24:02 +03:00
Jan Palus
e90b7276cb VIM-1431 handle empty documents when checking if line is empty
Signed-off-by: Jan Palus <jpalus@fastmail.com>
2018-05-29 23:08:40 +02:00
Andrey Vlasovskikh
a1ba5fec2b Updated the index of supported and not supported commands 2018-05-29 22:45:04 +03:00
Andrey Vlasovskikh
6606211233 Incomplete commands index with the current status of multi-caret support 2018-05-29 20:08:32 +03:00
Andrey Vlasovskikh
b1daacc9fb Added TODO items for unused actions 2018-05-29 20:04:23 +03:00
Jan Palus
03fe7d9ea2 VIM-1427 add count support to tag motion 2018-05-29 00:45:44 +02:00
Vasily Alferov
2d3da163a8 Attempt to fix Visual Block down movements 2018-05-26 21:52:57 +03:00
Vasily Alferov
49c59764ac Merge in change.insert actions 2018-05-26 20:17:12 +03:00
Vasily Alferov
06cc59b7a3 Got rid of deprecated overrides in EditorActionHandlerBase 2018-05-26 19:47:47 +03:00
Vasily Alferov
7754080323 Various fixes 2018-05-25 11:45:11 +03:00
Vasily Alferov
ebf081e273 Multicaret shift 2018-05-22 22:51:49 +03:00
Vasily Alferov
258467467b Multicaret insert 2018-05-22 22:02:26 +03:00
Vasily Alferov
bbea7e787f Merge pull request #3 from vasalf/multicaret-change
Multicaret change.change
2018-05-22 00:18:05 +03:00
Vasily Alferov
4f468cace7 Multicaret change.change 2018-05-22 00:16:58 +03:00
Vasily Alferov
b2f736adf5 Merge pull request #2 from vasalf/multicaret-change
Multicaret deletion
2018-05-21 19:10:08 +03:00
Vasily Alferov
9ddedbe752 Multicaret delete visual operator actions 2018-05-21 19:08:40 +03:00
Vasily Alferov
63b237114a Multicaret version for VisualOperatorActionHandler 2018-05-21 17:05:38 +03:00
Vasily Alferov
29c789dcf3 Implementations of all of the delete actions whose handlers doesn't override VisualOperatorActionHandler. 2018-05-20 13:55:33 +03:00
Vasily Alferov
59e2ae552e ChangeEditorActionHandler multicaret version and multicaret delete tests 2018-05-12 21:24:28 +03:00
Vasily Alferov
9d396a5cfa Merge remote-tracking branch 'origin/multicaret-motions' into multicaret-motions 2018-05-12 19:04:30 +03:00
Vasily Alferov
422557d4ce Cosmetical changes 2018-05-12 19:01:01 +03:00
Vasily Alferov
04ebbcc3a9 Merge pull request #1 from vasalf/multicaret-visual
Multicaret merging selections & text objects
2018-05-12 17:09:49 +03:00
Vasily Alferov
0919e9d560 Multicaret merging selections & text objects 2018-05-12 17:08:19 +03:00
Vasily Alferov
8af14edf21 Fix accidentally changed file 2018-05-05 12:09:49 +03:00
Vasily Alferov
13c475d73c Fix multiple carets movement in case i<ESC>i<ESC> 2018-05-05 12:01:00 +03:00
Vasily Alferov
1373af6f66 Fix accidentally changed files 2018-05-05 11:13:26 +03:00
Vasily Alferov
291ad2906d Fix accidentally deleted files 2018-05-05 11:06:33 +03:00
Vasily Alferov
be5532b35d Comment out text object multiple carets tests. 2018-05-05 10:59:58 +03:00
Vasily Alferov
b2402aad2e reset accidentally changed file 2018-04-27 20:29:49 +03:00
Vasily Alferov
3b46e44e4f action.motion.text.* multicaret tests and implementation 2018-04-27 20:24:26 +03:00
Vasily Alferov
537ec30936 object.MotionInner* tests 2018-04-24 23:43:21 +03:00
Vasily Alferov
a75db02d05 Fix failed tests on Visual Block Mode. 2018-04-24 22:17:10 +03:00
Vasily Alferov
4698f1be5c Reformat code with IntellIJ IDEA tool. 2018-04-16 16:11:53 +03:00
Vasily Alferov
1db103e352 Basic multicaret up-down motions.
+ Create a class for caret-specific data and move LAST_COLUMN getter/setter there.
2018-04-16 16:05:52 +03:00
Vasily Alferov
5037a1182f Fix unused imports 2018-03-29 17:21:30 +05:30
Vasily Alferov
6b476fa75f Fix accidentally changed file 2018-03-29 10:34:44 +05:30
Vasily Alferov
4d46000ec6 Write most of multicaret leftright actions.
MotionColumnAction, MotionFirstColumnAction, MotionFirstNonSpaceAction, MotionLastColumnAction, MostionLastMatchCharAction, MotionLastMatchCharReverseAction, MotionLastNonSpaceAction, MotionLeftAction, MotionLeftMatchCharAction, MotionLeftTillMatchCharAction, MotionRightAction, MotionRightMatchCharAction, MotionRightTillMatchCharAction now have their own native multi-caret implementations.
2018-03-29 10:18:35 +05:30
Vasily Alferov
56ad6b4c0d Multi-caret basic leftright motions.
Add basic multi-caret interfaces (i.e. deprecated and new functions to EditorActionHandlerBase) and overloaded them in MotionLeftAction and MotionRightAction.
2018-03-21 17:13:57 +03:00
Florian Hassmann
ab750b6e75 Fixes #VIM-1404. 2018-01-29 12:22:15 +01:00
Andrey Vlasovskikh
44a4a858fe IDEA-184351 Check if project is disposed before setting editor line numbers
Setting line numbers requires re-initializing the editor that means
accessing project code style settings. If the project has been disposed
then this operation is illegal.
2017-12-29 11:34:56 +03:00
Andrey Vlasovskikh
74fb59640d Added parameter for toggling code instrumentation
Several recent test runs failed with errors instrumenting code with
nullity checks. This parameter will help to debug the problem.
2017-12-29 11:12:01 +03:00
Andrey Vlasovskikh
797bfaaf3d Updated Gradle to 4.4.1 2017-12-29 11:01:27 +03:00
Andrey Vlasovskikh
0015a4357e Updated changelog 2017-12-29 10:32:22 +03:00
Andrey Vlasovskikh
dbdc15f21f Merge branch 'cypok/vim-1380' 2017-12-29 10:29:34 +03:00
Andrey Vlasovskikh
c9236527e4 Added Vladimir Parfinenko to contributors 2017-12-29 10:20:46 +03:00
Andrey Vlasovskikh
1a8c72d721 Merge branch 'cypok/vim-1379' 2017-12-29 10:19:08 +03:00
Andrey Vlasovskikh
739ef487fa Updated changelog 2017-12-29 10:18:48 +03:00
Andrey Vlasovskikh
b7273bc4f2 VIM-1379 Added check for empty ranges 2017-12-29 10:09:09 +03:00
Andrey Vlasovskikh
c3e9452fdc Added Maximilian Luz to contributors 2017-12-28 15:59:10 +03:00
Andrey Vlasovskikh
a4e34caa5d Updated changelog 2017-12-28 15:58:01 +03:00
Andrey Vlasovskikh
fea2f0ba1e VIM-1110 Added test 2017-12-28 15:54:49 +03:00
qzed
b98427472f VIM-1110 Fix caret jumping after escape from block-insert mode 2017-12-28 15:53:02 +03:00
Andrey Vlasovskikh
bf42822626 VIM-862 Keep selected text after running possibly async IDE action
E.g. `:action ReformatCode` is run asynchronously in another thread, so
we used to exit the visual mode (and thus dropped the selection) before
it was run.
2017-12-27 19:00:42 +03:00
Andrey Vlasovskikh
b71eb465cb Updated contribution guide and supported IDEs 2017-12-19 23:30:42 +03:00
Andrey Vlasovskikh
f072638c8c Merge pull request #129 from jamescmartinez/master
Update README to correct preference paths
2017-12-19 23:17:52 +03:00
Andrey Vlasovskikh
79afcd4b65 Added Naoto Ikeno to the contributors list 2017-12-18 00:58:24 +03:00
Andrey Vlasovskikh
595482048c Updated changelog 2017-12-18 00:57:50 +03:00
Andrey Vlasovskikh
2c99da538e VIM-1329 Use default modality state to run actions after focus settles down 2017-12-18 00:54:52 +03:00
Andrey Vlasovskikh
1393e60ca8 VIM-862 Properly apply and reset visual mode for running visual :action commands
Also fixed minor formatting and Java 8 issues.
2017-12-18 00:53:56 +03:00
Andrey Vlasovskikh
2e67c704f7 VIM-862 Fixed off-by-1 in restoring visual character selection after 'gv' 2017-12-18 00:52:29 +03:00
Andrey Vlasovskikh
c0410131bf Merge remote-tracking branch 'ikenox/feature/action-in-visual-mode' 2017-12-15 01:37:40 +03:00
Andrey Vlasovskikh
473a305e5f Use SecondaryLoop of JDK 8
The current version of IdeaVim is compatible with IntelliJ 2017.1+
which has switched to Java 8+, so we no longer need compatibility
layers for earlier versions.
2017-12-15 01:25:58 +03:00
Andrey Vlasovskikh
d53ca6cd90 Updated changelog 2017-12-14 03:31:02 +03:00
Andrey Vlasovskikh
bd84babecd Converted UiHelper into Kotlin 2017-12-14 03:26:01 +03:00
Andrey Vlasovskikh
1b83231b1c VIM-1329 Use IntelliJ API to request focus reliably 2017-12-14 00:29:11 +03:00
Andrey Vlasovskikh
f39ad34057 VIM-1368 Use IntelliJ API to run stuff after the current component gets focus 2017-12-14 00:28:02 +03:00
Andrey Vlasovskikh
942b64052d Inherit from VimTestCase to setup IntelliJ extension points properly
Otherwise these tests depend on the run order of other tests for
proper initialization.
2017-12-12 20:17:49 +03:00
Andrey Vlasovskikh
559aabd6b8 Version 0.49 2017-12-12 19:55:08 +03:00
Vladimir Parfinenko
52d26f9fb6 VIM-1380 Fixed 'cNw' at the last character of a word
Bug was introduced while fixing VIM-200
2017-11-20 11:37:42 +07:00
Naoto Ikeno
b7d124ce8d Make :action commands work in visual mode 2017-11-19 20:06:02 +09:00
Vladimir Parfinenko
6a5c70ee6a VIM-1379 Fix usage TextRange.size() as lines count
TextRange.size() should be used only for iterating over starts/ends
2017-11-19 13:49:12 +07:00
Andrey Vlasovskikh
a76b41b737 VIM-1367 Fixed resetting the default value
The previous fix tried to parse the current value instead of the default
one.
2017-11-03 05:00:29 +03:00
Andrey Vlasovskikh
2fc6553203 VIM-1367 Correctly reset parsed and stored 'iskeyword' option value 2017-11-03 04:26:46 +03:00
Andrey Vlasovskikh
98b003e601 VIM-1367 Deterministic order of options for reproducible tests 2017-11-03 04:23:29 +03:00
Andrey Vlasovskikh
0dda443cc8 Added iskeyword option to the list of supported set commands 2017-11-03 03:59:13 +03:00
Andrey Vlasovskikh
9322283cb1 Updated changelog 2017-11-03 03:56:00 +03:00
Andrey Vlasovskikh
95d412c78d Added nickgieschen to contributors 2017-11-03 03:54:06 +03:00
Andrey Vlasovskikh
6245b15d8f Cleanup 2017-11-03 03:48:15 +03:00
Andrey Vlasovskikh
ab1d7ba6cb VIM-1367 Removed unnecessary repetition in positive lookbehind
It resulted in an inspection warning that positive lookbehind groups
cannot contain 1 or more repetition patterns.
2017-11-03 03:34:11 +03:00
nickgieschen
ef05491991 VIM-1367 Implement iskeyword
(cherry picked from commit d91d38c)
2017-11-03 03:22:39 +03:00
Andrey Vlasovskikh
113642c8f5 Fixed test configuration URL 2017-11-01 03:15:05 +03:00
Andrey Vlasovskikh
088dd98e0d Updated test configuration ID 2017-11-01 03:14:23 +03:00
Andrey Vlasovskikh
7e0046a715 Updated changelog 2017-11-01 03:00:40 +03:00
Andrey Vlasovskikh
1a11d5df35 Added tieTYT to the list of contributors 2017-11-01 02:58:06 +03:00
tieTYT
57b5b319a7 VIM-523 Fixed global mark remembering only the line number
Bear with me as this is the first thing I've ever done with
Intellij-IDEA plugin development.

I tested this and I believe I fixed the problem.  The cause of the
problem was that the code was checking if the mark was in a different
file but if it was, it was using the editor of the current file to go
to the line of the mark.  I changed the code so that it opens the file
of the mark first, then jumps to its line number.

I need a VirtualFile so that I can get the Editor to open. The Mark
stores the path of the file it's in, but the path is not enough
information to get a VirtualFile.  I also need the "protocol" of the
file.  So, I had to change the structure of the Mark and add a
"protocol" field to it.

I had to update the save/load logic to use this new field, too.  This
way, when you restart Intellij-IDEA, the marks can still be used.  For
old marks, I defaulted the "protocol" to the value of "file".

One thing I couldn't figure out how to do is add a test case to check
that this is working correctly.  This is not due to a lack of effort.
In fact, I tried to write the test case first.  But I have been unable
to find any examples anywhere of testing multiple Editors, and that's
what's involved to fix this issue.  Because of this, this issue may be
best used as a reference to fix the problem instead of worthy of being
used in production.  Either way, I'd love to know how to write such a
test.
2017-11-01 02:35:23 +03:00
Andrey Vlasovskikh
0a4672c050 Updated intellij-gradle-plugin, Kotlin, and IntelliJ platform versions 2017-11-01 02:12:07 +03:00
Andrey Vlasovskikh
8808b651e2 Updated gradle wrapper to 4.3 2017-11-01 02:12:07 +03:00
Andrey Vlasovskikh
e9fca757b7 JetBrains project badge 2017-09-08 23:09:46 +03:00
Andrey Vlasovskikh
98a3801f6a New code style settings format of IntelliJ 2017.3 2017-09-08 23:06:24 +03:00
Konstantin Petrov
e97c49a032 Fix search for braces inside quotes the way vim does 2017-05-31 10:27:48 +02:00
Konstantin Petrov
0335b344a1 Add test to reproduce the bug 2017-05-31 10:27:00 +02:00
James Martinez
63b7bed61a Update README to correct preference paths 2017-05-16 16:20:00 -07:00
Andrey Vlasovskikh
49ecfd6879 Added Pavel Fatin to contributors 2017-01-16 01:03:42 +03:00
Andrey Vlasovskikh
4d4b5967da Updated CHANGES 2017-01-16 01:02:47 +03:00
Andrey Vlasovskikh
a882e37d04 Merge remote-tracking branch 'origin/vim-1007'
# Conflicts:
#	gradle.properties
#	resources/META-INF/plugin.xml
#	src/com/maddyhome/idea/vim/VimTypedActionHandler.java
2017-01-16 00:57:31 +03:00
Andrey Vlasovskikh
4734d23e29 Fixed compilation by adding Kotlin Gradle plugin 2017-01-16 00:42:55 +03:00
Andrey Vlasovskikh
b7416da26d Merge branch 'kotlin'
# Conflicts:
#	build.gradle
#	gradle.properties
2017-01-16 00:30:30 +03:00
Andrey Vlasovskikh
36e768ab37 Allow Java 8 2017-01-16 00:27:51 +03:00
Andrey Vlasovskikh
ede0bd8623 Set minimal version to 2017.1 in order to use new API for zero-latency typing 2017-01-16 00:25:47 +03:00
Andrey Vlasovskikh
b4072eb62d Use gradle-intellij-plugin 0.2.0 2017-01-15 23:36:27 +03:00
Andrey Vlasovskikh
120b69c439 Fixed source API compatibility with branch 171 2017-01-15 23:22:40 +03:00
Andrey Vlasovskikh
b68daf3f3e Version 0.48 2017-01-15 23:01:53 +03:00
Andrey Vlasovskikh
c32a1a5e5b Updated changelog and list of contributors 2016-11-29 00:43:41 +03:00
Andrey Vlasovskikh
a5e303d1ca Merge pull request #121 from gaganis/VIM-1216
Fixed . reseting the last find movement
2016-11-29 00:35:40 +03:00
Giorgos Gaganis
c4d8cef44d Fixed . reseting the last find movement where repeating change that also uses movement.
On the original vim when we repeat a change with . that also contain an find movement the last find that was typed before the repeat is the one used by the motion repeat ;. Before the commit the plugin would have reset the last movement to use the movement contained in the command that was repeated.

To solve this I took a simple approach where I save the last find motion before starting the repeat and then restoring it to its original value after the repeat is over. In order to access the find motion fields from RepeatChangeAction I created getters in MotionGroup for the movement type and character.

	modified:   src/com/maddyhome/idea/vim/action/change/RepeatChangeAction.java
	modified:   src/com/maddyhome/idea/vim/group/MotionGroup.java
	modified:   test/org/jetbrains/plugins/ideavim/action/ChangeActionTest.java
2016-11-28 19:05:11 +02:00
Andrey Vlasovskikh
72fbe758b4 VIM-1205 Don't move key handling into separate event for raw handlers 2016-11-22 21:58:32 +03:00
Andrey Vlasovskikh
3344bb3254 Ability to use Kotlin along with Java 2016-11-21 19:40:14 +03:00
Pavel Fatin
6b9ab7163a Support for zero-latency rendering, #VIM-1007 fixed 2016-10-26 12:53:13 +02:00
Andrey Vlasovskikh
563092cffb Fixed caret model exception when changing selection in documents open in several editors 2016-10-21 18:11:15 +03:00
Andrey Vlasovskikh
9a2a0c3b0e Split several channel names by comma 2016-10-19 17:26:23 +03:00
Andrey Vlasovskikh
f3b4726b34 Version 0.47 2016-10-19 15:58:35 +03:00
Andrey Vlasovskikh
30d7c6edf1 Remove obsolete pluginId 2016-09-30 21:15:51 +03:00
Andrey Vlasovskikh
f33f73d2f5 VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
We now use IntelliJ's version of invokeLater() in order to satisfy the
new protocol for running read-write actions in modal dialogs.
2016-09-30 20:44:16 +03:00
Andrey Vlasovskikh
b595dfd443 VIM-1098 Don't start visual selection when mouse click was actually drag over single character 2016-09-01 20:50:55 +03:00
Andrey Vlasovskikh
a3e15b5c76 Possibility to publish the plugin to multiple channels 2016-09-01 18:32:16 +03:00
Andrey Vlasovskikh
31d85c0221 Update gradle-intellij-plugin to 0.2.0-SNAPSHOT for multi-channel plugin publishing 2016-09-01 18:26:30 +03:00
Andrey Vlasovskikh
124bd55e18 Update gradle-intellij-plugin to 0.0.43 2016-07-08 12:19:02 +03:00
Andrey Vlasovskikh
bb9b5b5bde Use IntelliJ 15.0.5 by default 2016-07-08 12:19:02 +03:00
299 changed files with 10725 additions and 3346 deletions

2
.gitignore vendored
View File

@@ -3,4 +3,4 @@
/.idea/
/build/
/out/
/tmp/
/tmp/

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@@ -39,6 +39,21 @@ Contributors:
* [Daniel Leong](mailto:falcone88@gmail.com)
* [Aleksey Lagoshin](mailto:aleksey@pri-num.com)
* [Paulo Bu](mailto:pbu_98@yahoo.com)
* [Giorgos Gaganis](mailto:gaganis@yahoo.com)
* [Pavel Fatin](mailto:pavel.fatin@jetbrains.com)
* [tieTYT](mailto:tietyt@gmail.com)
* [Nick Gieschen](mailto:nickgieschen@gmail.com)
* [Naoto Ikeno](mailto:ikenox@gmail.com)
* [Maximilian Luz](mailto:qzed@users.noreply.github.com)
* [Vladimir Parfinenko](mailto:vparfinenko@excelsior-usa.com)
* [Florian Hassmann](mailto:hassmann@hwdev.de)
* [Jan Palus](mailto:jpalus@fastmail.com)
* [Konstantin Petrov](mailto:kpetrov@ripe.net)
* [Vasily Alferov](mailto:ya-ikmik2012@yandex.ru)
* [Vitalii Karavaev](mailto:fkve97@gmail.com)
* [John Lin](mailto:johnlinp@gmail.com)
* [Alex Plate](mailto:alexpl292@gmail.com)
* [Matt Ellis](mailto:m.t.ellis@gmail.com)
If you are a contributor and your name is not listed here, feel free to
contact the maintainer.

View File

@@ -16,6 +16,82 @@ It is important to distinguish EAP from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
To Be Released
--------------
...
0.51, 2019-02-12
----------------
* [VIM-1558](https://youtrack.jetbrains.com/issue/VIM-1558) Fixed scrolling for code with block inlays in Rider 2018.3
* [VIM-1187](https://youtrack.jetbrains.com/issue/VIM-1187) Improved performance of `set relativelinenumber` on large files
* [VIM-620](https://youtrack.jetbrains.com/issue/VIM-620) Fixed handling `<C-O>` and `<Esc>` in Insert and Replace modes
* [VIM-798](https://youtrack.jetbrains.com/issue/VIM-798) Allow arrow keys for window navigation commands
0.50, 2018-10-18
----------------
Moved "Vim Emulation" settings into "File | Settings | Vim Emulation". Support
for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>` (put `set
multiple-cursors` into your ~/.ideavimrc to enable it). Support for running
Vim commands for multiple cursors. Various bug fixes.
* [VIM-634](https://youtrack.jetbrains.com/issue/VIM-634) Support for vim-multiple-cursors commands `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
* [VIM-780](https://youtrack.jetbrains.com/issue/VIM-780) Support for running Vim commands for multiple cursors
* [VIM-176](https://youtrack.jetbrains.com/issue/VIM-176) Fixed arrow key navigation in Run/Debug tool windows
* [VIM-339](https://youtrack.jetbrains.com/issue/VIM-339) Fixed `<Esc>` in diff windows
* [VIM-862](https://youtrack.jetbrains.com/issue/VIM-862) Allow `:action` to work in visual mode
* [VIM-1110](https://youtrack.jetbrains.com/issue/VIM-1110) Put the caret in correct place after `I` in visual block mode
* [VIM-1329](https://youtrack.jetbrains.com/issue/VIM-1329) Request focus reliably for Ex entry and output panels
* [VIM-1368](https://youtrack.jetbrains.com/issue/VIM-1368) Wait for focus reliably before running an `:action`
* [VIM-1379](https://youtrack.jetbrains.com/issue/VIM-1379) Fixed `I` for short lines in visual block mode
* [VIM-1380](https://youtrack.jetbrains.com/issue/VIM-1380) Fixed `cw` with count at the end of a word
* [VIM-1404](https://youtrack.jetbrains.com/issue/VIM-1404) Fixed the ability to use `:e#` when editor tabs are hidden
* [VIM-1431](https://youtrack.jetbrains.com/issue/VIM-1431) Fixed pasting text into the empty document
* [VIM-1427](https://youtrack.jetbrains.com/issue/VIM-1427) Added the support for count to the `it` and `at` motions
* [VIM-1287](https://youtrack.jetbrains.com/issue/VIM-1287) Fixed `i(` actions inside string literals
* [VIM-1317](https://youtrack.jetbrains.com/issue/VIM-1317) Don't run Undo/Redo inside write actions
* [VIM-1366](https://youtrack.jetbrains.com/issue/VIM-1366) Don't wrap a secondary event loop for `input()` into a write action
* [VIM-1274](https://youtrack.jetbrains.com/issue/VIM-1274) Correctly process escaping when `smartcase` is on
0.49, 2017-12-12
----------------
Enabled zero-latency typing for Vim emulation. Added support for `iskeyword` option. Various bug fixes.
* [VIM-1254](https://youtrack.jetbrains.com/issue/VIM-1254) Enable zero-latency typing for Vim emulation
* [VIM-1367](https://youtrack.jetbrains.com/issue/VIM-1367) Support `iskeyword` option
* [VIM-523](https://youtrack.jetbrains.com/issue/VIM-523) Fixed global mark remembering only the line number
0.48, 2017-01-15
----------------
A bugfix release.
Bug fixes:
* [VIM-1205](https://youtrack.jetbrains.com/issue/VIM-1205) Don't move key handling into separate event for raw handlers
* [VIM-1216](https://youtrack.jetbrains.com/issue/VIM-1216) Fixed `.` resetting the last find movement while repeating change that also uses movement
Features:
* Support for zero-latency rendering
0.47, 2016-10-19
----------------
A bugfix release.
Bug fixes:
* VIM-1098 Don't start visual selection when mouse click was actually drag over single character
* VIM-1190 Fixed exception "Write access is allowed from write-safe contexts only"
0.46, 2016-07-07
----------------

View File

@@ -1,6 +1,12 @@
IdeaVim
=======
<div>
<a href="https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub">
<img src="http://jb.gg/badges/official.svg" alt="official JetBrains project"/>
</a>
</div>
<div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_Build&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_Build)/statusIcon.svg?guest=1"/>
@@ -9,15 +15,15 @@ IdeaVim
</div>
<div>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ15&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ15)/statusIcon.svg?guest=1"/>
<a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=IdeaVim_TestsForIntelliJ20182&guest=1">
<img src="http://teamcity.jetbrains.com/app/rest/builds/buildType:(id:IdeaVim_TestsForIntelliJ20182)/statusIcon.svg?guest=1"/>
</a>
<span>Tests</span>
</div>
IdeaVim is a Vim emulation plugin for IDEs based on the IntelliJ platform.
IdeaVim can be used with IntelliJ IDEA, RubyMine, PyCharm, PhpStorm, WebStorm,
AppCode, CLion, DataGrip and Android Studio.
IdeaVim can be used with IntelliJ IDEA, PyCharm, CLion, PhpStorm, WebStorm,
RubyMine, AppCode, DataGrip, GoLand, Rider, Cursive, and Android Studio.
Resources:
@@ -40,8 +46,10 @@ it is unchecked. At this point your IDE will work with its regular keyboard
shortcuts.
Keyboard shortcut conflicts between the Vim emulation and the IDE can be
resolved via "File | Settings | Vim Emulation", "File | Settings | Keymap"
and key mapping commands in your ~/.ideavimrc file.
resolved via "File | Settings | Editor | Vim Emulation", "File | Settings |
Keymap" on Linux & Windows, and by "Preferences | Editor | Vim Emulation",
"Preferences | Keymap" on macOS. They can also be resolved by key mapping
commands in your ~/.ideavimrc file.
Get an Early Access
@@ -84,6 +92,7 @@ Supported:
Emulated Vim plugins:
* vim-surround
* vim-multiple-cursors
Not supported (yet):
@@ -92,7 +101,7 @@ Not supported (yet):
See also:
* [List of recently added commands](src/com/maddyhome/idea/vim/package-info.java)
* [The list of all supported commands](src/com/maddyhome/idea/vim/package-info.java)
* [Top features and bugs](http://youtrack.jetbrains.com/issues/VIM?q=%23Unresolved+sort+by%3A+votes)
@@ -119,8 +128,8 @@ have `-Duser.home=/my/alternate/home` then IdeaVim will source
Emulated Vim Plugins
--------------------
IdeaVim extensions emulate some plugins of the original Vim. In order to use IdeaVim extensions, you have to enable
them via this command in your ~/.ideavimrc:
IdeaVim extensions emulate some plugins of the original Vim. In order to use
IdeaVim extensions, you have to enable them via this command in your ~/.ideavimrc:
set <extension-name>
@@ -129,6 +138,9 @@ Available extensions:
* surround
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
* Commands: `ys`, `cs`, `ds`, `S`
* multiple-cursors
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
Changes to the IDE
@@ -188,24 +200,25 @@ in the issue tracker.
1. Fork IdeaVim on GitHub and clone the repository on your local machine.
2. Import the project from existing sources in IntelliJ IDEA 15+ (Community or
2. Import the project from existing sources in IntelliJ IDEA 2018.1 or newer (Community or
Ultimate) using "File | New | Project from Existing Sources..." or "Import
Project" from the start window.
* In the project wizard select "Import project from external model | Gradle"
* Select your Java 6+ JDK as the Gradle JVM, leave other parameters unchanged
* Select your Java 8+ JDK as the Gradle JVM, leave other parameters unchanged
3. Create a new plugin run configuration using "Run | Edit Configurations | New
Gradle Configuration" and run it in order to launch IntelliJ with the
compiled version of the IdeaVim plugin.
3. Run your IdeaVim plugin within IntelliJ via a Gradle task
* Select your project as the Gradle project
* Select "View | Tool Windows | Gradle" tool window
* Launch "ideavim | intellij | runIde" from the tool window
* Enter "runIdea" as the task to run
4. Run IdeaVim tests via a Gradle task
4. Create and run a new configuration for running tests by right-clicking on the
"test" folder in the project structure and selecting "Run All Tests".
* Select "View | Tool Windows | Gradle" tool window
* Launch "ideavim | verification | test" from the tool window
5. Build the plugin distribution by running `./gradlew clean buildPlugin` in the
terminal in your project root.

View File

@@ -1,8 +1,19 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
plugins {
id "org.jetbrains.intellij" version "0.0.39"
id 'org.jetbrains.intellij' version '0.3.12'
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
@@ -24,11 +35,20 @@ intellij {
pluginName 'IdeaVim'
updateSinceUntilBuild false
downloadSources Boolean.valueOf(downloadIdeaSources)
instrumentCode Boolean.valueOf(instrumentPluginCode)
intellijRepo = "https://www.jetbrains.com/intellij-repository"
publish {
pluginId '164'
channel publishChannel
username publishUsername
password publishPassword
publishPlugin {
channels publishChannels.split(',')
username publishUsername
password publishPassword
}
}
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}

View File

@@ -9,6 +9,7 @@ The following `:set` commands can appear in `~/.ideavimrc` or set manually in th
'history' 'hi' number of command-lines that are remembered
'hlsearch' 'hls' highlight matches with last search pattern
'ignorecase' 'ic' ignore case in search patterns
'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc.
'incsearch' 'is' show where search pattern typed so far matches
'matchpairs' 'mps' pairs of characters that "%" can match
'nrformats' 'nf' number formats recognized for CTRL-A command

View File

@@ -1,7 +1,9 @@
ideaVersion IC-15.0.2
ideaVersion IC-2018.3
downloadIdeaSources true
instrumentPluginCode true
version SNAPSHOT
javaVersion 1.6
javaVersion 1.8
kotlinVersion 1.3.11
publishUsername username
publishPassword password
publishChannel eap
publishChannels eap

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#Sat Jan 23 00:00:00 MSK 2016
#Fri Dec 29 11:00:46 MSK 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip

100
gradlew vendored
View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
@@ -6,42 +6,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -60,6 +24,46 @@ cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -85,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

14
gradlew.bat vendored
View File

@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line

View File

@@ -2,6 +2,32 @@
<name>IdeaVim</name>
<id>IdeaVIM</id>
<change-notes><![CDATA[
<p>0.51:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.50:</p>
<ul>
<li>Moved "Vim Emulation" settings into "File | Settings | Editor"</li>
<li>Support for vim-multiple-cursors commands <code>&lt;A-n&gt;</code>, <code>&lt;A-x&gt;</code>, <code>&lt;A-p&gt;</code>, <code>g&lt;A-n&gt;</code> (put <code>set multiple-cursors</code> into your ~/.ideavimrc to enable it)</li>
<li>Support for running Vim commands for multiple cursors</li>
<li>The <a href="https://github.com/JetBrains/ideavim/blob/master/src/com/maddyhome/idea/vim/package-info.java">index of supported commands</a> on the GitHub page</li>
<li>Various bug fixes</li>
</ul>
<p>0.49:</p>
<ul>
<li>Enabled zero-latency typing for Vim emulation</li>
<li>Support for <code>iskeyword</code> option</li>
<li>Various bug fixes</li>
</ul>
<p>0.48:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.47:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.46:</p>
<ul>
<li>Support for <code>incsearch</code> option for showing search results while typing</li>
@@ -10,50 +36,6 @@
<li>Support for <code>={motion}</code> formatting command</li>
<li>Various bug fixes</li>
</ul>
<p>0.44:</p>
<ul>
<li>Fixed typing keys in completion menus and typing with the plugin disabled</li>
</ul>
<p>0.43:</p>
<ul>
<li>Fixed running the plugin with Java 6</li>
</ul>
<p>0.42:</p>
<ul>
<li>Fixed move commands in read-only files</li>
</ul>
<p>0.41:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.40:</p>
<ul>
<li>Support for <code>mapleader</code></li>
<li>Support comments in <code>%</code> brace matching</li>
<li>Various bug fixes</li>
</ul>
<p>0.39:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.38:</p>
<ul>
<li>Support for <code>:action</code> and <code>:actionlist</code> for executing arbitrary IDE actions</li>
<li>Support for <code>number</code> and <code>relativenumber</code> options</li>
<li>Support for <code>clipboard=unnamed</code> option</li>
<li>Various bug fixes</li>
</ul>
<p>0.37:</p>
<ul>
<li>Various bug fixes</li>
</ul>
<p>0.36:</p>
<ul>
<li>Window commands from the <code>&lt;C-W&gt;</code> family</li>
<li>Support for <code>:split</code>/<code>:vsplit</code> commands</li>
<li>Fixed visual block selection mode</li>
<li>Various bug fixes</li>
</ul>
<p>See also the complete <a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">changelog</a>.</p>
]]></change-notes>
<description><![CDATA[
@@ -68,7 +50,7 @@
<version>SNAPSHOT</version>
<vendor>JetBrains</vendor>
<idea-version since-build="143.0"/>
<idea-version since-build="183.2940.10"/>
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform -->
<depends>com.intellij.modules.lang</depends>
@@ -85,11 +67,12 @@
</extensionPoints>
<extensions defaultExtensionNs="com.intellij">
<applicationConfigurable instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
</extensions>
<extensions defaultExtensionNs="IdeaVIM">
<vimExtension implementation="com.maddyhome.idea.vim.extension.surround.VimSurroundExtension"/>
<vimExtension implementation="com.maddyhome.idea.vim.extension.multiplecursors.VimMultipleCursorsExtension"/>
</extensions>
<actions>
@@ -373,6 +356,9 @@
<action id="VimRedo" class="com.maddyhome.idea.vim.action.change.RedoAction" text="Redo"/>
<action id="VimUndo" class="com.maddyhome.idea.vim.action.change.UndoAction" text="Undo"/>
<!-- Internal -->
<action id="VimInternalAddInlays" class="com.maddyhome.idea.vim.action.internal.AddInlaysAction" text="Vim (internal) add test inlays" internal="true"/>
<!-- Keys -->
<action id="VimShortcutKeyAction" class="com.maddyhome.idea.vim.action.VimShortcutKeyAction" text="Shortcuts"/>
<action id="VimOperatorAction" class="com.maddyhome.idea.vim.action.change.OperatorAction" text="Operator"/>

View File

@@ -24,8 +24,10 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.ActionPlan;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.project.Project;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
@@ -35,15 +37,16 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.extension.VimExtensionHandler;
import com.maddyhome.idea.vim.group.RegisterGroup;
import com.maddyhome.idea.vim.helper.*;
import com.maddyhome.idea.vim.helper.DigraphSequence;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.helper.RunnableHelper;
import com.maddyhome.idea.vim.helper.StringHelper;
import com.maddyhome.idea.vim.key.*;
import com.maddyhome.idea.vim.option.Options;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
@@ -92,6 +95,26 @@ public class KeyHandler {
return origHandler;
}
/**
* Invoked before acquiring a write lock and actually handling the keystroke.
*
* Drafts an optional {@link ActionPlan} that will be used as a base for zero-latency rendering in editor.
*
* @param editor The editor the key was typed into
* @param key The keystroke typed by the user
* @param context The data context
* @param plan The current action plan
*/
public void beforeHandleKey(@NotNull Editor editor, @NotNull KeyStroke key,
@NotNull DataContext context, @NotNull ActionPlan plan) {
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
if (mode == CommandState.Mode.INSERT || mode == CommandState.Mode.REPLACE) {
VimPlugin.getChange().beforeProcessKey(editor, context, key, plan);
}
}
/**
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for
* processing.
@@ -241,15 +264,15 @@ public class KeyHandler {
if (mapping.isPrefix(fromKeys)) {
mappingKeys.add(key);
if (!application.isUnitTestMode() && Options.getInstance().isSet(Options.TIMEOUT)) {
commandState.startMappingTimer(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
mappingKeys.clear();
for (KeyStroke keyStroke : fromKeys) {
handleKey(editor, keyStroke, new EditorDataContext(editor), false);
}
commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> {
mappingKeys.clear();
if (editor.isDisposed()) {
return;
}
});
for (KeyStroke keyStroke : fromKeys) {
handleKey(editor, keyStroke, new EditorDataContext(editor), false);
}
}, ModalityState.stateForComponent(editor.getComponent())));
}
return true;
}
@@ -274,12 +297,11 @@ public class KeyHandler {
}
}
else if (extensionHandler != null) {
RunnableHelper.runWriteCommand(editor.getProject(), new Runnable() {
@Override
public void run() {
extensionHandler.execute(editor, context);
}
}, "Vim " + extensionHandler.getClass().getSimpleName(), null);
final CommandProcessor processor = CommandProcessor.getInstance();
processor.executeCommand(editor.getProject(),
() -> extensionHandler.execute(editor, context),
"Vim " + extensionHandler.getClass().getSimpleName(),
null);
}
if (prevMappingInfo != null) {
handleKey(editor, key, currentContext);
@@ -447,23 +469,25 @@ public class KeyHandler {
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
Project project = editor.getProject();
if (cmd.getType().isRead() || project == null || EditorHelper.canEdit(project, editor)) {
if (ApplicationManager.getApplication().isDispatchThread()) {
Runnable action = new ActionRunner(editor, context, cmd, key);
String name = cmd.getAction().getTemplatePresentation().getText();
name = name != null ? "Vim " + name : "";
if (cmd.getType().isWrite()) {
RunnableHelper.runWriteCommand(project, action, name, action);
}
else {
RunnableHelper.runReadCommand(project, action, name, action);
}
}
}
else {
final Command.Type type = cmd.getType();
if (type.isWrite() && !editor.getDocument().isWritable()) {
VimPlugin.indicateError();
reset(editor);
}
if (ApplicationManager.getApplication().isDispatchThread()) {
Runnable action = new ActionRunner(editor, context, cmd, key);
String name = cmd.getAction().getTemplatePresentation().getText();
name = name != null ? "Vim " + name : "";
if (type.isWrite()) {
RunnableHelper.runWriteCommand(project, action, name, action);
}
else if (type.isRead()) {
RunnableHelper.runReadCommand(project, action, name, action);
}
else {
CommandProcessor.getInstance().executeCommand(project, action, name, action);
}
}
}
private boolean handleArgumentNode(@NotNull Editor editor, @NotNull KeyStroke key, @NotNull DataContext context,

View File

@@ -515,10 +515,10 @@ public class RegisterActions {
new Shortcut("gp"));
parser.registerAction(MappingMode.N, "VimCopyPutTextBeforeCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
new Shortcut("[P"),
new Shortcut("]P")
new Shortcut("]P"),
new Shortcut("[p")
});
parser.registerAction(MappingMode.N, "VimCopyPutTextAfterCursorNoIndent", Command.Type.PASTE, new Shortcut[]{
new Shortcut("[p"),
new Shortcut("]p")
});
parser.registerAction(MappingMode.N, "VimCopyYankLine", Command.Type.COPY,
@@ -614,9 +614,9 @@ public class RegisterActions {
new Shortcut("@:"));
parser.registerAction(MappingMode.N, "QuickJavaDoc", Command.Type.OTHER_READONLY,
new Shortcut('K'));
parser.registerAction(MappingMode.N, "VimRedo", Command.Type.OTHER_WRITABLE,
parser.registerAction(MappingMode.N, "VimRedo", Command.Type.OTHER_SELF_SYNCHRONIZED,
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK)));
parser.registerAction(MappingMode.N, "VimUndo", Command.Type.OTHER_WRITABLE, new Shortcut[]{
parser.registerAction(MappingMode.N, "VimUndo", Command.Type.OTHER_SELF_SYNCHRONIZED, new Shortcut[]{
new Shortcut('u'),
new Shortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UNDO, 0))
});

View File

@@ -80,9 +80,7 @@ import java.util.concurrent.TimeUnit;
*/
@State(
name = "VimSettings",
storages = {@Storage(
id = "main",
file = "$APP_CONFIG$/vim_settings.xml")})
storages = {@Storage(file = "$APP_CONFIG$/vim_settings.xml")})
public class VimPlugin implements ApplicationComponent, PersistentStateComponent<Element> {
private static final String IDEAVIM_COMPONENT_NAME = "VimPlugin";
private static final String IDEAVIM_PLUGIN_ID = "IdeaVIM";

View File

@@ -22,8 +22,10 @@ import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.actionSystem.ActionPlan;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import org.jetbrains.annotations.NotNull;
@@ -34,7 +36,7 @@ import javax.swing.*;
*
* IDE shortcut keys used by Vim commands are handled by {@link com.maddyhome.idea.vim.action.VimShortcutKeyAction}.
*/
public class VimTypedActionHandler implements TypedActionHandler {
public class VimTypedActionHandler implements TypedActionHandlerEx {
private static final Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
private final TypedActionHandler origHandler;
@@ -46,21 +48,28 @@ public class VimTypedActionHandler implements TypedActionHandler {
handler.setOriginalHandler(origHandler);
}
@Override
public void beforeExecute(@NotNull Editor editor, char charTyped, @NotNull DataContext context, @NotNull ActionPlan plan) {
if (isEnabled(editor)) {
handler.beforeHandleKey(editor, KeyStroke.getKeyStroke(charTyped), context, plan);
}
else {
TypedActionHandler originalHandler = KeyHandler.getInstance().getOriginalHandler();
if (originalHandler instanceof TypedActionHandlerEx) {
((TypedActionHandlerEx)originalHandler).beforeExecute(editor, charTyped, context, plan);
}
}
}
@Override
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
if (isEnabled(editor)) {
// Run key handler outside of the key typed command for creating our own undoable commands
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
}
catch (Throwable e) {
logger.error(e);
}
}
});
try {
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
}
catch (Throwable e) {
logger.error(e);
}
}
else {
origHandler.execute(editor, charTyped, context);

View File

@@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull;
/**
*
*/
// TODO: Cannot find the corresponding Vim command. Remove it?
public class ResetModeAction extends EditorAction {
public ResetModeAction() {
super(new EditorActionHandler() {

View File

@@ -63,7 +63,7 @@ public abstract class VimCommandAction extends EditorAction {
*
* These legacy flags will be refactored in future releases.
*
* @see {@link Command}.
* @see com.maddyhome.idea.vim.command.Command
*/
public int getFlags() {
return 0;

View File

@@ -26,6 +26,8 @@ import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.DumbAware;
@@ -38,6 +40,7 @@ import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.helper.EditorDataContext;
import com.maddyhome.idea.vim.key.ShortcutOwner;
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -98,18 +101,12 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
notifyAboutShortcutConflict(keyStroke);
}
// Should we use InjectedLanguageUtil.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
// Run key handler later to restore input events sequence due to VimTypedActionHandler
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
}
});
try {
KeyHandler.getInstance().handleKey(editor, keyStroke, new EditorDataContext(editor));
}
catch (Throwable throwable) {
ourLogger.error(throwable);
}
}
}
@@ -164,6 +161,9 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
if (LookupManager.getActiveLookup(editor) != null) {
return isExitInsertMode(keyStroke);
}
if (keyCode == VK_ESCAPE) {
return isEnabledForEscape(editor);
}
if (CommandState.inInsertMode(editor)) {
// XXX: <Tab> won't be recorded in macros
if (keyCode == VK_TAB) {
@@ -196,6 +196,22 @@ public class VimShortcutKeyAction extends AnAction implements DumbAware {
return false;
}
private boolean isEnabledForEscape(@NotNull Editor editor) {
final CommandState.Mode mode = CommandState.getInstance(editor).getMode();
return isPrimaryEditor(editor) || (EditorData.isFileEditor(editor) && mode != CommandState.Mode.COMMAND);
}
/**
* Checks if the editor is a primary editor in the main editing area.
*/
private boolean isPrimaryEditor(@NotNull Editor editor) {
final Project project = editor.getProject();
if (project == null) return false;
final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
return StreamEx.of(fileEditorManager.getAllEditors())
.anyMatch(fileEditor -> editor.equals(EditorUtil.getEditorEx(fileEditor)));
}
private boolean isExitInsertMode(@NotNull KeyStroke keyStroke) {
for (List<KeyStroke> keys : InsertExitModeAction.getInstance().getKeyStrokesSet()) {
// XXX: Currently we cannot handle <C-\><C-N> because of the importance of <C-N> for the IDE on Linux

View File

@@ -49,8 +49,9 @@ public class OperatorAction extends VimCommandAction {
if (argument != null) {
final Command motion = argument.getMotion();
if (motion != null) {
final TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(),
argument, true);
final TextRange range = MotionGroup
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(),
cmd.getRawCount(), argument, true);
if (range != null) {
VimPlugin.getMark().setChangeMarks(editor, range);
final SelectionType selectionType = SelectionType.fromCommandFlags(motion.getFlags());
@@ -82,7 +83,7 @@ public class OperatorAction extends VimCommandAction {
@NotNull
@Override
public Command.Type getType() {
return Command.Type.OTHER_READ_WRITE;
return Command.Type.OTHER_SELF_SYNCHRONIZED;
}
@NotNull

View File

@@ -41,6 +41,7 @@ public class RepeatChangeAction extends EditorAction {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command command) {
CommandState state = CommandState.getInstance(editor);
Command cmd = state.getLastChangeCommand();
if (cmd != null) {
if (command.getRawCount() > 0) {
cmd.setCount(command.getCount());
@@ -53,6 +54,9 @@ public class RepeatChangeAction extends EditorAction {
}
}
Command save = state.getCommand();
int lastFTCmd = VimPlugin.getMotion().getLastFTCmd();
char lastFTChar = VimPlugin.getMotion().getLastFTChar();
state.setCommand(cmd);
state.pushState(CommandState.Mode.REPEAT, CommandState.SubMode.NONE, MappingMode.NORMAL);
char reg = VimPlugin.getRegister().getCurrentRegister();
@@ -67,6 +71,7 @@ public class RepeatChangeAction extends EditorAction {
if (save != null) {
state.setCommand(save);
}
VimPlugin.getMotion().setLastFTCmd(lastFTCmd, lastFTChar);
state.saveLastChangeCommand(cmd);
VimPlugin.getRegister().selectRegister(reg);

View File

@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.NotNull;
@@ -37,13 +39,11 @@ import java.util.Set;
*/
public class AutoIndentLinesVisualAction extends VimCommandAction {
public AutoIndentLinesVisualAction() {
super(new VisualOperatorActionHandler() {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) {
VimPlugin.getChange().autoIndentRange(editor, context, range);
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
VimPlugin.getChange().autoIndentRange(editor, caret, context, range);
return true;
}
});

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
@@ -36,10 +38,16 @@ public class ChangeCaseLowerMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount, CharacterHelper.CASE_LOWER,
argument);
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_LOWER, argument);
}
}
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
@@ -26,6 +27,7 @@ import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
@@ -39,11 +41,12 @@ import java.util.Set;
*/
public class ChangeCaseLowerVisualAction extends VimCommandAction {
public ChangeCaseLowerVisualAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(editor);
return VimPlugin.getChange().changeCaseRange(topLevelEditor, range, CharacterHelper.CASE_LOWER);
return VimPlugin.getChange().changeCaseRange(topLevelEditor, caret, range, CharacterHelper.CASE_LOWER);
}
});
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeCaseToggleCharacterAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCaseToggleCharacter(editor, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCaseToggleCharacter(editor, caret, count);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
@@ -36,9 +38,16 @@ public class ChangeCaseToggleMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_TOGGLE, argument);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_TOGGLE, argument);
}
}
}

View File

@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
@@ -38,10 +40,11 @@ import java.util.Set;
*/
public class ChangeCaseToggleVisualAction extends VimCommandAction {
public ChangeCaseToggleVisualAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_TOGGLE);
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_TOGGLE);
}
});
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
@@ -36,9 +38,15 @@ public class ChangeCaseUpperMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeCaseMotion(editor, context, count, rawCount,
CharacterHelper.CASE_UPPER, argument);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange()
.changeCaseMotion(editor, caret, context, count, rawCount, CharacterHelper.CASE_UPPER, argument);
}
}
}

View File

@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.CharacterHelper;
import org.jetbrains.annotations.NotNull;
@@ -38,10 +40,10 @@ import java.util.Set;
*/
public class ChangeCaseUpperVisualAction extends VimCommandAction {
public ChangeCaseUpperVisualAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, range, CharacterHelper.CASE_UPPER);
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return VimPlugin.getChange().changeCaseRange(editor, caret, range, CharacterHelper.CASE_UPPER);
}
});
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeCharacterAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeCharacter(editor, count, argument.getCharacter());
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeCharacter(editor, caret, count, argument.getCharacter());
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeCharactersAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCharacters(editor, context, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeCharacters(editor, caret, count);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeEndOfLineAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeEndOfLine(editor, context, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeEndOfLine(editor, caret, count);
}
}
}

View File

@@ -38,8 +38,8 @@ public class ChangeLastGlobalSearchReplaceAction extends EditorAction {
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/&");
final LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
return VimPlugin.getSearch().searchAndReplace(editor, editor.getCaretModel().getPrimaryCaret(), range, "s", "//~/&");
}
}
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
@@ -36,10 +37,17 @@ public class ChangeLastSearchReplaceAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
int line = editor.getCaretModel().getLogicalPosition().line;
LineRange range = new LineRange(line, line);
return VimPlugin.getSearch().searchAndReplace(editor, range, "s", "//~/");
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
boolean result = true;
for (Caret caret : editor.getCaretModel().getAllCarets()) {
final int line = caret.getLogicalPosition().line;
if (!VimPlugin.getSearch().searchAndReplace(editor, caret, new LineRange(line, line), "s", "//~/")) {
result = false;
}
}
return result;
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class ChangeLineAction extends EditorAction {
public ChangeLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeLine(editor, context, count);
}
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().changeLine(editor, caret, count);
}
});
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeMotion(editor, context, count, rawCount, argument);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().changeMotion(editor, caret, context, count, rawCount, argument);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeNumberDecAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, -count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, -count);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ChangeNumberIncAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeNumber(editor, caret, count);
}
}
}

View File

@@ -31,12 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class ChangeReplaceAction extends EditorAction {
public ChangeReplaceAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().changeReplace(editor, context);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().changeReplace(editor, context);
return true;
}
});
}
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -26,7 +27,9 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -38,11 +41,14 @@ import java.util.Set;
*/
public class ChangeVisualAction extends VimCommandAction {
public ChangeVisualAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
final SelectionType type = range.isMultiple() ? SelectionType.BLOCK_WISE : SelectionType.CHARACTER_WISE;
return VimPlugin.getChange().changeRange(editor, context, range, type);
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final SelectionType type = EditorData.wasVisualBlockMode(editor) && range.isMultiple()
? SelectionType.BLOCK_WISE
: SelectionType.CHARACTER_WISE;
return VimPlugin.getChange().changeRange(editor, caret, range, type);
}
});
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -26,6 +27,7 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
@@ -39,12 +41,13 @@ import java.util.Set;
*/
public class ChangeVisualLinesAction extends VimCommandAction {
public ChangeVisualLinesAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, context, lineRange, SelectionType.LINE_WISE);
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
}
});
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.change;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -26,7 +27,9 @@ import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
@@ -39,10 +42,10 @@ import java.util.Set;
*/
public class ChangeVisualLinesEndAction extends VimCommandAction {
public ChangeVisualLinesEndAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
if (range.isMultiple()) {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
if (EditorData.wasVisualBlockMode(editor) && range.isMultiple()) {
final int[] starts = range.getStartOffsets();
final int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
@@ -51,12 +54,12 @@ public class ChangeVisualLinesEndAction extends VimCommandAction {
}
}
final TextRange blockRange = new TextRange(starts, ends);
return VimPlugin.getChange().changeRange(editor, context, blockRange, SelectionType.BLOCK_WISE);
return VimPlugin.getChange().changeRange(editor, caret, blockRange, SelectionType.BLOCK_WISE);
}
else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().changeRange(editor, context, lineRange, SelectionType.LINE_WISE);
return VimPlugin.getChange().changeRange(editor, caret, lineRange, SelectionType.LINE_WISE);
}
}
});

View File

@@ -43,7 +43,9 @@ public class FilterMotionAction extends EditorAction {
if (argument == null) {
return false;
}
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(), argument, false);
TextRange range = MotionGroup
.getMotionRange(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd.getCount(), cmd.getRawCount(),
argument, false);
if (range == null) {
return false;
}
@@ -52,7 +54,7 @@ public class FilterMotionAction extends EditorAction {
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
if (current.line != start.line) {
MotionGroup.moveCaret(editor, range.getStartOffset());
MotionGroup.moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), range.getStartOffset());
}
int count;

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteCharacterAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, 1, false);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, 1, false);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteCharacterLeftAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, -count, false);
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, -count, false);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteCharacterRightAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, count, false);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteCharacter(editor, caret, count, false);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class DeleteEndOfLineAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteEndOfLine(editor, count);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteEndOfLine(editor, caret, count);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,12 +37,18 @@ public class DeleteJoinLinesAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().deleteJoinLines(editor, count, false);
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, false);
}
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,12 +37,18 @@ public class DeleteJoinLinesSpacesAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().deleteJoinLines(editor, count, true);
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, true);
}
}
}

View File

@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -37,10 +40,11 @@ import java.util.Set;
*/
public class DeleteJoinVisualLinesAction extends VimCommandAction {
public DeleteJoinVisualLinesAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, false);
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, false);
}
});
}

View File

@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -37,10 +40,11 @@ import java.util.Set;
*/
public class DeleteJoinVisualLinesSpacesAction extends VimCommandAction {
public DeleteJoinVisualLinesSpacesAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, range, true);
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, true);
}
});
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,12 +33,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class DeleteLineAction extends EditorAction {
public DeleteLineAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().deleteLine(editor, count);
}
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull Caret caret,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getChange().deleteLine(editor, caret, count);
}
});
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,15 @@ public class DeleteMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return argument != null && VimPlugin.getChange().deleteMotion(editor, context, count, rawCount, argument, false);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return argument != null &&
VimPlugin.getChange().deleteMotion(editor, caret, context, count, rawCount, argument, false);
}
}
}

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -27,6 +28,7 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
@@ -40,17 +42,18 @@ import java.util.Set;
*/
public class DeleteVisualAction extends VimCommandAction {
public DeleteVisualAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
if (mode == CommandState.SubMode.VISUAL_LINE) {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.fromSubMode(mode), false);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.fromSubMode(mode), false);
}
else {
return VimPlugin.getChange().deleteRange(editor, range, SelectionType.fromSubMode(mode), false);
return VimPlugin.getChange().deleteRange(editor, caret, range, SelectionType.fromSubMode(mode), false);
}
}
});

View File

@@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
@@ -27,6 +28,7 @@ import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
@@ -40,17 +42,20 @@ import java.util.Set;
*/
public class DeleteVisualLinesAction extends VimCommandAction {
public DeleteVisualLinesAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
final CommandState.SubMode mode = CommandState.getInstance(editor).getSubMode();
if (mode == CommandState.SubMode.VISUAL_BLOCK) {
return VimPlugin.getChange().deleteRange(editor, range, SelectionType.fromSubMode(mode), false);
return VimPlugin.getChange()
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), range, SelectionType.fromSubMode(mode),
false);
}
else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.LINE_WISE, false);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
}
}
});

View File

@@ -19,13 +19,16 @@
package com.maddyhome.idea.vim.action.change.delete;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.CommandState;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
@@ -39,10 +42,11 @@ import java.util.Set;
*/
public class DeleteVisualLinesEndAction extends VimCommandAction {
public DeleteVisualLinesEndAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
if (range.isMultiple()) {
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
if (CommandState.inVisualBlockMode(editor)) {
final int[] starts = range.getStartOffsets();
final int[] ends = range.getEndOffsets();
for (int i = 0; i < starts.length; i++) {
@@ -51,12 +55,13 @@ public class DeleteVisualLinesEndAction extends VimCommandAction {
}
}
final TextRange blockRange = new TextRange(starts, ends);
return VimPlugin.getChange().deleteRange(editor, blockRange, SelectionType.BLOCK_WISE, false);
return VimPlugin.getChange()
.deleteRange(editor, editor.getCaretModel().getPrimaryCaret(), blockRange, SelectionType.BLOCK_WISE, false);
}
else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getChange().deleteRange(editor, lineRange, SelectionType.LINE_WISE, false);
return VimPlugin.getChange().deleteRange(editor, caret, lineRange, SelectionType.LINE_WISE, false);
}
}
});

View File

@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class InsertAfterCursorAction extends EditorAction {
public InsertAfterCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().insertAfterCursor(editor, context);
return true;
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertAfterCursor(editor, context);
return true;
}
});
}
}

View File

@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class InsertAfterLineEndAction extends EditorAction {
public InsertAfterLineEndAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().insertAfterLineEnd(editor, context);
return true;
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertAfterLineEnd(editor, context);
return true;
}
});
}
}

View File

@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class InsertAtPreviousInsertAction extends EditorAction {
public InsertAtPreviousInsertAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().insertAtPreviousInsert(editor, context);
return true;
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertAtPreviousInsert(editor, context);
return true;
}
});
}
}

View File

@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class InsertBeforeFirstNonBlankAction extends EditorAction {
public InsertBeforeFirstNonBlankAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
return true;
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertBeforeFirstNonBlank(editor, context);
return true;
}
});
}
}

View File

@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -33,13 +36,19 @@ public class InsertCharacterAboveCursorAction extends EditorAction {
super(new Handler());
}
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, -1);
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, -1);
}
}
}

View File

@@ -19,12 +19,15 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -33,13 +36,19 @@ public class InsertCharacterBelowCursorAction extends EditorAction {
super(new Handler());
}
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().insertCharacterAroundCursor(editor, context, 1);
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, 1);
}
}
}

View File

@@ -19,12 +19,17 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -33,9 +38,15 @@ public class InsertDeleteInsertedTextAction extends EditorAction {
super(new Handler());
}
private static class Handler extends EditorActionHandlerBase {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return VimPlugin.getChange().insertDeleteInsertedText(editor);
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.INCREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().insertDeleteInsertedText(editor, caret);
}
}
}

View File

@@ -19,12 +19,17 @@
package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -33,9 +38,15 @@ public class InsertDeletePreviousWordAction extends EditorAction {
super(new Handler());
}
private static class Handler extends EditorActionHandlerBase {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return VimPlugin.getChange().insertDeletePreviousWord(editor);
private static class Handler extends ChangeEditorActionHandler {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getChange().insertDeletePreviousWord(editor, caret);
}
}
}

View File

@@ -21,7 +21,6 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
@@ -36,15 +35,16 @@ import java.util.Set;
public class InsertExitModeAction extends VimCommandAction {
private static final String ACTION_ID = "VimInsertExitMode";
public InsertExitModeAction() {
protected InsertExitModeAction() {
super(new EditorActionHandlerBase() {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processEscape(InjectedLanguageUtil.getTopLevelEditor(editor), context);
@Override
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getChange().processEscape(editor, context);
return true;
}
});
}
@NotNull
@Override
public Set<MappingMode> getMappingModes() {

View File

@@ -35,7 +35,7 @@ public class InsertInsertAction extends EditorAction {
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context);
VimPlugin.getChange().processInsert(InjectedLanguageUtil.getTopLevelEditor(editor));
}
}
}

View File

@@ -31,14 +31,16 @@ import org.jetbrains.annotations.Nullable;
*/
public class InsertLineStartAction extends EditorAction {
public InsertLineStartAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().insertLineStart(editor, context);
return true;
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertLineStart(editor, context);
return true;
}
});
}
}

View File

@@ -35,7 +35,8 @@ public class InsertNewLineBelowAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}

View File

@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertPreviousInsertAction extends EditorAction {
public InsertPreviousInsertAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, false);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertPreviousInsert(editor, context, false);
return true;
}
});
}
}

View File

@@ -21,21 +21,26 @@ package com.maddyhome.idea.vim.action.change.insert;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
public class InsertPreviousInsertExitAction extends EditorAction {
public InsertPreviousInsertExitAction() {
super(new Handler());
}
private static class Handler extends EditorActionHandler {
public void execute(@NotNull Editor editor, @NotNull DataContext context) {
VimPlugin.getChange().insertPreviousInsert(InjectedLanguageUtil.getTopLevelEditor(editor), context, true);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
VimPlugin.getChange().insertPreviousInsert(editor, context, true);
return false;
}
});
}
}

View File

@@ -38,9 +38,12 @@ import java.util.Set;
public class VisualBlockAppendAction extends VimCommandAction {
public VisualBlockAppendAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, true);
if (editor.isOneLineMode()) return false;
return VimPlugin.getChange().blockInsert(editor, context, range, true);
}
});
}

View File

@@ -38,9 +38,13 @@ import java.util.Set;
public class VisualBlockInsertAction extends VimCommandAction {
public VisualBlockInsertAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@Override
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().blockInsert(editor, context, range, false);
if (editor.isOneLineMode()) return false;
return VimPlugin.getChange().blockInsert(editor, context, range, false);
}
});
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -30,14 +32,14 @@ import org.jetbrains.annotations.Nullable;
/**
*/
public class AutoIndentLinesAction extends EditorAction {
public AutoIndentLinesAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().autoIndentLines(editor, context, count);
return true;
}
protected AutoIndentLinesAction() {
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().autoIndentLines(editor, caret, context, count);
return true;
}
});
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,20 +33,18 @@ import org.jetbrains.annotations.Nullable;
* @author Aleksey Lagoshin
*/
public class AutoIndentMotionAction extends EditorAction {
public AutoIndentMotionAction() {
super(new Handler());
}
protected AutoIndentMotionAction() {
super(new ChangeEditorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (argument == null) {
return false;
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
if (argument != null) {
VimPlugin.getChange().autoIndentMotion(editor, context, count, rawCount, argument);
VimPlugin.getChange().autoIndentMotion(editor, caret, context, count, rawCount, argument);
return true;
}
else {
return false;
}
}
});
}
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ShiftLeftLinesAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().indentLines(editor, context, count, -1);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().indentLines(editor, caret, context, count, -1);
return true;
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,9 +37,15 @@ public class ShiftLeftMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (argument != null) {
VimPlugin.getChange().indentMotion(editor, context, count, rawCount, argument, -1);
VimPlugin.getChange().indentMotion(editor, caret, context, count, rawCount, argument, -1);
return true;
}
else {

View File

@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.NotNull;
@@ -37,10 +39,11 @@ import java.util.Set;
*/
public class ShiftLeftVisualAction extends VimCommandAction {
public ShiftLeftVisualAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
VimPlugin.getChange().indentRange(editor, context, range, cmd.getCount(), -1);
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
VimPlugin.getChange().indentRange(editor, caret, context, range, cmd.getCount(), -1);
return true;
}
});

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,8 +37,14 @@ public class ShiftRightLinesAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().indentLines(editor, context, count, 1);
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
VimPlugin.getChange().indentLines(editor, caret, context, count, 1);
return true;
}

View File

@@ -19,10 +19,12 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -35,9 +37,15 @@ public class ShiftRightMotionAction extends EditorAction {
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
public Handler() {
super(true, CaretOrder.DECREASING_OFFSET);
}
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (argument != null) {
VimPlugin.getChange().indentMotion(editor, context, count, rawCount, argument, 1);
VimPlugin.getChange().indentMotion(editor, caret, context, count, rawCount, argument, 1);
return true;
}
else {

View File

@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.change.shift;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.VimCommandAction;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.CaretOrder;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import org.jetbrains.annotations.NotNull;
@@ -37,10 +39,10 @@ import java.util.Set;
*/
public class ShiftRightVisualAction extends VimCommandAction {
public ShiftRightVisualAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
VimPlugin.getChange().indentRange(editor, context, range, cmd.getCount(), 1);
super(new VisualOperatorActionHandler(true, CaretOrder.DECREASING_OFFSET) {
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
VimPlugin.getChange().indentRange(editor, caret, context, range, cmd.getCount(), 1);
return true;
}
});

View File

@@ -31,12 +31,12 @@ import org.jetbrains.annotations.Nullable;
*/
public class PutTextAfterCursorAction extends EditorAction {
public PutTextAfterCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getCopy().putTextAfterCursor(editor, context, count, true, false);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
return VimPlugin.getCopy().putText(editor, context, count, true, false, false);
}
});
}
}

View File

@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
*/
public class PutTextAfterCursorActionMoveCursor extends EditorAction {
public PutTextAfterCursorActionMoveCursor() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getCopy().putTextAfterCursor(editor, context, count, true, true);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getCopy().putText(editor, context, count, true, true, false);
}
});
}
}

View File

@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
*/
public class PutTextAfterCursorNoIndentAction extends EditorAction {
public PutTextAfterCursorNoIndentAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getCopy().putTextAfterCursor(editor, context, count, false, false);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getCopy().putText(editor, context, count, false, false, false);
}
});
}
}

View File

@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
*/
public class PutTextBeforeCursorAction extends EditorAction {
public PutTextBeforeCursorAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getCopy().putTextBeforeCursor(editor, context, count, true, false);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getCopy().putText(editor, context, count, true, false, true);
}
});
}
}

View File

@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
*/
public class PutTextBeforeCursorActionMoveCursor extends EditorAction {
public PutTextBeforeCursorActionMoveCursor() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getCopy().putTextBeforeCursor(editor, context, count, true, true);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getCopy().putText(editor, context, count, true, true, true);
}
});
}
}

View File

@@ -31,12 +31,15 @@ import org.jetbrains.annotations.Nullable;
*/
public class PutTextBeforeCursorNoIndentAction extends EditorAction {
public PutTextBeforeCursorNoIndentAction() {
super(new Handler());
}
private static class Handler extends ChangeEditorActionHandler {
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
return VimPlugin.getCopy().putTextBeforeCursor(editor, context, count, false, false);
}
super(new ChangeEditorActionHandler() {
@Override
public boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
int count,
int rawCount,
@Nullable Argument argument) {
return VimPlugin.getCopy().putText(editor, context, count, false, false, true);
}
});
}
}

View File

@@ -38,7 +38,10 @@ import java.util.Set;
public class PutVisualTextAction extends VimCommandAction {
public PutVisualTextAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@Override
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) {
return VimPlugin.getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, false);
}

View File

@@ -38,6 +38,7 @@ import java.util.Set;
public class PutVisualTextMoveCursorAction extends VimCommandAction {
public PutVisualTextMoveCursorAction() {
super(new VisualOperatorActionHandler() {
@Override
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@NotNull TextRange range) {
return VimPlugin.getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, true);

View File

@@ -38,7 +38,10 @@ import java.util.Set;
public class PutVisualTextNoIndentAction extends VimCommandAction {
public PutVisualTextNoIndentAction() {
super(new VisualOperatorActionHandler() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd,
@Override
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) {
return VimPlugin.getCopy().putVisualRange(editor, context, range, cmd.getCount(), false, false);
}

View File

@@ -37,8 +37,11 @@ public class YankMotionAction extends EditorAction {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
final Argument argument = cmd.getArgument();
return argument != null && VimPlugin.getCopy().yankMotion(editor, context, cmd.getCount(), cmd.getRawCount(),
argument);
if (argument == null) {
return false;
}
return VimPlugin.getCopy().yankMotion(editor, context, cmd.getCount(), cmd.getRawCount(), argument);
}
}
}

View File

@@ -28,7 +28,6 @@ import com.maddyhome.idea.vim.command.MappingMode;
import com.maddyhome.idea.vim.command.SelectionType;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
import com.maddyhome.idea.vim.helper.EditorHelper;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -48,9 +47,7 @@ public class YankVisualLinesAction extends VimCommandAction {
return VimPlugin.getCopy().yankRange(editor, range, SelectionType.fromSubMode(mode), true);
}
else {
final TextRange lineRange = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
return VimPlugin.getCopy().yankRange(editor, lineRange, SelectionType.LINE_WISE, true);
return VimPlugin.getCopy().yankRange(editor, range, SelectionType.LINE_WISE, true);
}
}
});

View File

@@ -28,6 +28,7 @@ import org.jetbrains.annotations.NotNull;
/**
*/
// TODO: Unused action. Delete it?
public class FileSaveAction extends EditorAction {
public FileSaveAction() {
super(new Handler());
@@ -35,7 +36,7 @@ public class FileSaveAction extends EditorAction {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getFile().saveFile(editor, context);
VimPlugin.getFile().saveFile(editor);
return true;
}

View File

@@ -35,7 +35,7 @@ public class FileSaveCloseAction extends EditorAction {
private static class Handler extends EditorActionHandlerBase {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
VimPlugin.getFile().saveFile(editor, context);
VimPlugin.getFile().saveFile(editor);
VimPlugin.getFile().closeFile(editor, context);
return true;

View File

@@ -0,0 +1,148 @@
package com.maddyhome.idea.vim.action.internal;
import com.intellij.ide.ui.AntialiasingType;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.editor.impl.FontInfo;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.util.Key;
import com.intellij.ui.JBColor;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.util.Random;
public class AddInlaysAction extends AnAction {
private static Random random = new Random();
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
DataContext dataContext = e.getDataContext();
Editor editor = getEditor(dataContext);
if (editor == null) return;
InlayModel inlayModel = editor.getInlayModel();
Document document = editor.getDocument();
int lineCount = document.getLineCount();
for (int i = random.nextInt(10); i < lineCount; ) {
int offset = document.getLineStartOffset(i);
// Mostly above
boolean above = random.nextInt(10) > 3;
// Mostly do one, but occasionally throw in a bunch
int count = random.nextInt(10) > 7 ? random.nextInt(5) : 1;
for (int j = 0; j < count; j++) {
float factor = Math.max(1.75f * random.nextFloat(), 0.9f);
String text = String.format("---------- %s line %d ----------", above ? "above" : "below", i + 1);
inlayModel.addBlockElement(offset, true, above, 0, new MyBlockRenderer(factor, text));
}
// Every 10 lines +/- 3 lines
i += 10 + (random.nextInt(6) - 3);
}
}
protected Editor getEditor(@NotNull DataContext dataContext) {
return CommonDataKeys.EDITOR.getData(dataContext);
}
private static class MyBlockRenderer implements EditorCustomElementRenderer {
private static Key<MyFontMetrics> HINT_FONT_METRICS = Key.create("DummyInlayFontMetrics");
private float factor;
private String text;
MyBlockRenderer(float factor, String text) {
this.factor = factor;
this.text = text;
}
@Override
public int calcWidthInPixels(@NotNull Inlay inlay) {
Editor editor = inlay.getEditor();
FontMetrics fontMetrics = getFontMetrics(editor).metrics;
return doCalcWidth(text, fontMetrics);
}
@Override
public int calcHeightInPixels(@NotNull Inlay inlay) {
Editor editor = inlay.getEditor();
FontMetrics fontMetrics = getFontMetrics(editor).metrics;
return fontMetrics.getHeight();
}
@Override
public void paint(@NotNull Inlay inlay,
@NotNull Graphics g,
@NotNull Rectangle targetRegion,
@NotNull TextAttributes textAttributes) {
Editor editor = inlay.getEditor();
FontMetrics fontMetrics = getFontMetrics(editor).metrics;
LineMetrics lineMetrics = fontMetrics.getLineMetrics(text, g);
g.setColor(JBColor.GRAY);
g.setFont(fontMetrics.getFont());
g.drawString(text, 0, targetRegion.y + (int)(lineMetrics.getHeight() - lineMetrics.getDescent()));
g.setColor(JBColor.LIGHT_GRAY);
g.drawRect(targetRegion.x, targetRegion.y, targetRegion.width, targetRegion.height);
}
private MyFontMetrics getFontMetrics(Editor editor) {
String familyName = UIManager.getFont("Label.font").getFamily();
int size = (int)(Math.max(1, editor.getColorsScheme().getEditorFontSize() - 1) * factor);
MyFontMetrics metrics = editor.getUserData(HINT_FONT_METRICS);
if (metrics != null && !metrics.isActual(editor, familyName, size)) {
metrics = null;
}
if (metrics == null) {
metrics = new MyFontMetrics(editor, familyName, size);
editor.putUserData(HINT_FONT_METRICS, metrics);
}
return metrics;
}
private int doCalcWidth(String text, FontMetrics fontMetrics) {
return (text == null) ? 0 : fontMetrics.stringWidth(text);
}
protected class MyFontMetrics {
private FontMetrics metrics;
MyFontMetrics(Editor editor, String familyName, int size) {
Font font = UIUtil.getFontWithFallback(familyName, Font.PLAIN, size);
FontRenderContext context = getCurrentContext(editor);
metrics = FontInfo.getFontMetrics(font, context);
// We assume this will be a better approximation to a real line height for a given font
}
public boolean isActual(Editor editor, String familyName, int size) {
Font font = metrics.getFont();
if (!familyName.equals(font.getFamily()) || size != font.getSize()) return false;
FontRenderContext currentContext = getCurrentContext(editor);
return currentContext.equals(metrics.getFontRenderContext());
}
private FontRenderContext getCurrentContext(Editor editor) {
FontRenderContext editorContext = FontInfo.getFontRenderContext(editor.getContentComponent());
return new FontRenderContext(editorContext.getTransform(),
AntialiasingType.getKeyForCurrentScope(false), editor instanceof EditorImpl
? ((EditorImpl)editor).myFractionalMetricsHintValue
: RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
}
}
}
}

View File

@@ -19,10 +19,14 @@
package com.maddyhome.idea.vim.action.motion;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.ExecuteMethodNotOverriddenException;
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -32,8 +36,9 @@ public abstract class MotionEditorAction extends EditorAction {
this.handler = handler;
}
public int getOffset(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return handler.getOffset(editor, context, count, rawCount, argument);
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) throws ExecuteMethodNotOverriddenException {
return handler.getOffset(editor, caret, context, count, rawCount, argument);
}
private final MotionEditorActionHandler handler;

View File

@@ -19,11 +19,13 @@
package com.maddyhome.idea.vim.action.motion;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.handler.TextObjectActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -35,8 +37,9 @@ public abstract class TextObjectAction extends EditorAction {
}
@Nullable
public TextRange getRange(Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return handler.getRange(editor, context, count, rawCount, argument);
public TextRange getRange(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return handler.getRange(editor, caret, context, count, rawCount, argument);
}
private final TextObjectActionHandler handler;

View File

@@ -19,14 +19,16 @@
package com.maddyhome.idea.vim.action.motion.leftright;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.motion.MotionEditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.command.Command;
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
import com.maddyhome.idea.vim.helper.EditorData;
import com.maddyhome.idea.vim.helper.CaretData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -36,12 +38,20 @@ public class MotionColumnAction extends MotionEditorAction {
}
private static class Handler extends MotionEditorActionHandler {
public int getOffset(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return VimPlugin.getMotion().moveCaretToColumn(editor, count - 1, false);
public Handler() {
super(true);
}
protected void postMove(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
EditorData.setLastColumn(editor, cmd.getCount() - 1);
@Override
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getMotion().moveCaretToColumn(editor, caret, count - 1, false);
}
@Override
protected void postMove(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd) {
CaretData.setLastColumn(editor, caret, cmd.getCount() - 1);
}
}
}

View File

@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.motion.leftright;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.motion.MotionEditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +36,14 @@ public class MotionFirstColumnAction extends MotionEditorAction {
}
private static class Handler extends MotionEditorActionHandler {
public int getOffset(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return VimPlugin.getMotion().moveCaretToLineStart(editor);
public Handler() {
super(true);
}
@Override
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getMotion().moveCaretToLineStart(editor, caret);
}
}
}

View File

@@ -19,12 +19,14 @@
package com.maddyhome.idea.vim.action.motion.leftright;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.action.motion.MotionEditorAction;
import com.maddyhome.idea.vim.command.Argument;
import com.maddyhome.idea.vim.handler.MotionEditorActionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
*/
@@ -34,8 +36,14 @@ public class MotionFirstNonSpaceAction extends MotionEditorAction {
}
private static class Handler extends MotionEditorActionHandler {
public int getOffset(@NotNull Editor editor, DataContext context, int count, int rawCount, Argument argument) {
return VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor);
public Handler() {
super(true);
}
@Override
public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
return VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor, caret);
}
}
}

Some files were not shown because too many files have changed in this diff Show More