Commit Graph

53 Commits

Author SHA1 Message Date
Lukas Holecek
402affa9c2 FakeVim: First <Delete> is part of dot command in insert mode
Change-Id: I9324c65333c0f893541043e953456e83a9986bf7
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-17 11:02:45 +01:00
Lukas Holecek
b74ae13491 fakevim: Set correct cursor column after a command
Set cursor column after some commands and position the cursor on same
column after vertical movement. If line is too short set cursor to the
end of line but don't remember the new cursor column.

Change-Id: I4f5592925b9b360e7393f6ac966025f1466f483d
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-26 15:58:44 +01:00
Lukas Holecek
9a774254bf fakevim: Escape insert command and correct undo position for "I"
Escape inserted string for repeatition, e.g. command "2i<up>" will
insert text "<up><up>".

Undo position for "I" is start of selection or line.

Change-Id: Ic7e6d8dbf712197b36be20b17ef6d1c0814b1a51
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-21 01:10:22 +01:00
Lukas Holecek
3eedd06ce5 fakevim: Restore FakeVim state before any text processing
Restore selection and cursor position (may have been changed externally)
before any text processing.

Change-Id: I424523512f8f83c276e7d29760aad29bf7921dab
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-18 19:41:12 +01:00
Lukas Holecek
f377264128 fakevim: Use _ instead of QLatin1String
Change-Id: Ibc00ed4cbc54fc78fa815277387c01a3436cc688
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-18 19:23:28 +01:00
Orgad Shaneh
1f74468a56 FakeVim: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I5ed7bb6f39689d5657709e2ab4a2fa90594abb0e
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Lukas Holecek <hluk@email.cz>
2012-12-09 22:08:51 +01:00
Lukas Holecek
05261e4d0b fakevim: Fix word selection in visual mode
Change-Id: I11a9831f2178f818639e04d7aad0eeb6c3f627fc
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-04 23:40:06 +01:00
Lukas Holecek
234a04f814 fakevim: Correct movement mode for yanking lines
Change-Id: I936574d9220d11031e1f68600bec6e33c88808a5
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-04 22:23:48 +01:00
Lukas Holecek
baa4db2499 fakevim: Fix insert mode after visual block selection
Commands in visual block mode '[count]A', '[count]I' and 's' (ignores
[count]) are repeated on every selected line (before or after the block
selection).

Task-number: QTCREATORBUG-8366
Change-Id: I9832656248a8706d1bd4066bd8cf49beded1d8aa
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-04 22:23:14 +01:00
Lukas Holecek
00a10fcfa8 fakevim: Correct undo/redo position for changing numbers
Restore position on undo and redo after <C-A> and <C-X> commands.

Do not set dot command if no number was found.

Change-Id: Ia4e6d53ecfbd7f56e874d6a39c0939557f6cdc3d
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-29 22:44:43 +01:00
Lukas Holecek
5919416eab fakevim: Increase/decrease octal and hexadecimal numbers
Hexadecimal (prefix '0x' or '0X') and octal (prefix '0') numbers are
unsigned. Decimal number can be signed (with leading '-').

Preserve width of hexadecimal and octal numbers (i.e. append leading
zeroes if result is shorter or remove leading zeroes if any and result
is longer).

Change-Id: I93769546ff40a586458986909fcee1e4e9143bc2
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-29 16:53:44 +01:00
Lukas Holecek
ec3f4d3801 fakevim: Handle completion in insert and replace modes
Text inserted without FakeVim's intervention (code completion) is
handled in insert and replace mode so that '.' command also inserts any
externally inserted text.

After movement in insert mode last command (initiated by '.') is not
cleared until new text is inserted.

Deletion in insert mode is part of dot command.

Change-Id: Ic55b3cdecaf4323e88cd321b218fae661de7a63e
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-29 10:40:04 +01:00
Lukas Holecek
0e6041ed45 fakevim: Paragraph movement using '{' and '}'
Change-Id: Ie156438b6633b7e9680e028fca7eca1b8788a63d
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-27 08:19:35 +01:00
Lukas Holecek
6868fedf4d fakevim: Yank with up/down movement ends in same column
Yank followed by vertical movement ends in same column as at the
beginning of the command (or at the end of line if line ha less
columns).

Change-Id: I573a8435ba9b76430fa3778e536726882f4c6ce1
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-27 08:18:27 +01:00
Lukas Holecek
ece5a4a33b fakevim: Merge marks on undo so new marks are not lost
Overwriting a mark with new position and undoing restores the previous
state of the mark.

Creating new mark (not overwriting old value) on a position and undoing
won't remove the mark.

Change-Id: I673874ef9df0aae16f86efe8599a43a77aae19ee
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-26 17:17:37 +01:00
Lukas Holecek
9ed83d4e2b fakevim: Correct visual selection of a quoted object
Change-Id: I76eb6d39efb384cb706847b07bb282a8b2f1a6d3
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-26 17:16:52 +01:00
Lukas Holecek
6e5018ef5d fakevim: Fix inclusive/exclusive delete
Change-Id: I1b46bda3f70a533d149cf38de02d89e2cf706f3f
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-26 17:13:42 +01:00
Lukas Holecek
a99874c0db fakevim: Correct cursor position after 'J'
Change-Id: Iff0c719c6b301dac333a55acfb073c7d1e1a27c8
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-26 17:12:53 +01:00
Lukas Holecek
477285b93c fakevim: Correct cursor position after yank
Change-Id: I845eeebe44ed859cc96d69fbd660fce56cc1418b
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-26 17:11:05 +01:00
Lukas Holecek
611be1ae19 fakevim: Command 's' has exclusive motion
Change-Id: I3d4642ebf69055722568cf0e59f5480ad5b2c418
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-26 17:10:29 +01:00
Lukas Holecek
c9afad98ef fakevim: Continue consolidation of both test suites
Change-Id: I59b991766a5c1a7579059ff652e27340b65f2c84
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-23 17:09:09 +01:00
Lukas Holecek
ab7ef16030 fakevim: Correct visual selection of a text object
Change-Id: Ib4996a88d1bbbec25ab864a37f62825e5b0a2b27
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-22 18:39:11 +01:00
Lukas Holecek
f302f3b8c2 fakevim: <C-O> to execute single command and return to insert mode
After Ctrl+O combination in insert or replace mode enter command mode
and after a single command (can consist of entering Ex command or can be
switch to other buffer) or escape key return to previous insert or
replace mode. One exception is that if entering insert mode is part of
the command after <C-O> pressing escape key will exit to command mode
(Vim behavior).

Change-Id: I37d684b691157001e2cab156687d6771afdec7b9
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-22 08:26:11 +01:00
Lukas Holecek
cd7c91d440 fakevim: Match same text with same regular expression
Match same text on same regex in forward and backward search modes.
E.g. with '\w\{2}' Vim regex and 'abc' text always match '<ab>c'
(should never match 'a<bc>' as with QTextDocument::find()).

Change-Id: Ie920c76540f3be426fc7b842d38137e95c1a65b2
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-19 08:54:10 +01:00
Lukas Holecek
88814c64b5 fakevim: Stop dot command or mapping after an unhandled input
Stop processing dot command or user mapping after it's no longer valid.

For example do not process the "text" part of command "ci)text" if
cursor is not in parenthesis block or "ctXtext" if character 'X' was not
found on current line after cursor. In these cases insert mode is not
set.

Change-Id: I54588f3beeb803e42a566f6381352aff7bb602c7
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-07 18:11:17 +01:00
Lukas Holecek
709c142717 fakevim: Fix commands ci* and di*
Commands ciw and diw should work on a single character.

Commands ci), di" and similar should work on in an empty block.

Change-Id: Id166a3fb80fc5ba2672231638ce126bd88b4f3ff
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-06 17:34:16 +01:00
Lukas Holecek
67bf8aa863 fakevim: Fix crash when setting cursor position in edit block
Workaround for crash when setting text cursor position while in edit
block (after QTextCursor::beginEditBlock() call and before
QTextCursor::endEditBlock() call).

Task-number: QTCREATORBUG-8148
Change-Id: I7faab2e878efea4106e375b32526ecd5984feac2
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-06 16:27:14 +01:00
Lukas Holecek
f4626e6850 fakevim: Fix exclusive movement type for some commands
Change-Id: Ia9dc3a7063b921bd90bddd52e1df1e6b8b8b3796
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-02 17:41:32 +01:00
hjk
376ddd5d74 fakevim: start consolidation of both test suites
This moves the stand-alone tests into the plugin.

Change-Id: Ic6da45236b080b6c905849898729b19df54a1527
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-01 17:16:15 +01:00
Lukas Holecek
94d36078aa fakevim: Better input key comparison
Change-Id: I47ca07f8ef54f8f7f38d467ea0aa2c087ee95a37
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-31 19:03:53 +01:00
Lukas Holecek
c55620000c fakevim: Undo/redo last selection and cleanup
Change-Id: I09b825349c01e2cbcebc446fdf8843aaf8793e6f
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-31 15:04:17 +01:00
Lukas Holecek
f7fa450a1c fakevim: Improved range modifying Ex commands.
Added change and join Ex commands.

Ex command range and address with /.../, ?...?, \/, \? and \&.

Change-Id: I23f16d3e454f28bcfcf87aeab500830136546345
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-29 10:04:57 +01:00
Lukas Holecek
8994bb2d4a fakevim: Added move and yank Ex commands
Change-Id: I4138a2035e338b665d91704b7c53117c4d924472
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-26 09:31:10 +02:00
Lukas Holecek
49a337f235 fakevim: Fix last position and selection (marks)
Change-Id: If75164be930dac3c4f3b9c26179ee54aa643ab4e
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-25 00:29:20 +02:00
Lukas Holecek
80b737252b fakevim: Fix substitute command
Command separator (bar character) shouldn't break substitute command.

Escape substitution text.

Change-Id: I9a793ab2df167d5d8a2b4de22329d061fc169785
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-23 08:16:11 +02:00
Lukas Holecek
5a809353d9 fakevim: Fix insert modes
Change-Id: I8efb89e6931be2c37cfaf82f0aa053317c6b8d93
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-21 13:11:00 +02:00
Lukas Holecek
ba86ddcc44 fakevim: Ignore user mappings with 'r' and other commands
Task-number: QTCREATORBUG-7913
Change-Id: Ic9efd579556acc78736d7562c46adee83e971074
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-21 13:09:43 +02:00
Lukas Holecek
1586737596 fakevim: Single command integrity (undo, redo, repeat)
Change-Id: I7e12092fd8928f34306a40b76a8ec7e6afe4a050
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-20 14:57:12 +02:00
Lukas Holecek
8e8c8e49ce fakevim: Various fixes
Automatic indentation, change letter case, correct position after
command.

Change-Id: I3e9659fca82fbc3fa443d593f915931bf7f17e93
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-18 09:51:34 +02:00
Lukas Holecek
49e7ec748e fakevim: Use internal editor widget in tests
Use internal editor with highlighting and folding support for tests to
be able to check folding commands.

Change-Id: Iaab3bc9edb65c8e2a5a7efc4456e021c8a178d7f
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-17 20:30:20 +02:00
Lukas Holecek
8bed5c33f9 fakevim: Fix cursor position after pasting text at end of line
Change-Id: I5017d5f6987cea12b1eb26212fbe5fe813bf73cb
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-09 13:15:39 +02:00
Tobias Hunger
3b80507af3 License changes
Change-Id: Ie8d2adaa2b20473d2e3e16d1f44ad951ff2744be
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2012-10-09 12:23:22 +02:00
Lukas Holecek
1e6cd8af47 fakevim: Improved number transformations in Vim
Allow increasing/decreasing the first number after cursor position
(cursor doesn't have to be on the number).

Increase/decrease number by [count].

Change-Id: I5f4d41fed43556a46c3b63bea4efcdd6a66a81a4
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-04 18:00:09 +02:00
Lukas Holecek
d2bf853ca1 fakevim: Star and hash search with g
Added g* and g# commands to search without \<, \>.

Change-Id: I74f010f2415e4d493be9925ab047a1c06f35d7a9
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-04 09:43:36 +02:00
Lukas Holecek
f357502984 fakevim: Improved repeat command
Repeat commands in visual mode correctly.

Task-number: QTCREATORBUG-7248
Change-Id: I937688f669f9bb9e1ad5f64b42dc0ee56dc3ca38
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-04 09:43:01 +02:00
Lukas Holecek
ceaedb0883 fakevim: Correct Undo/Redo position for large editing operations
Change-Id: Ie5d354a0e7f59c61646d14da79bf7059821c12e5
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-02 12:09:53 +02:00
Lukas Holecek
37c3dbc57d fakevim: Fix text indentation commands
Fixed indentation commands with movement and correct behavior in tests.

Change-Id: Idb77427c556f54c75658f806bb6c94402cab52ea
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-02 09:03:09 +02:00
Lukas Holecek
6268f943d0 fakevim: Improve Ex command handling
Multi-line commands (lines starting with backslash).

Subcommands separated by bar character (|).

Task-number: QTCREATORBUG-7376
Change-Id: I947b10ee5043824278c6ba71e8ebb19dc5787328
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-01 09:40:33 +02:00
Lukas Holecek
e767fb28fa fakevim: Improved mappings handling
Implemented special key names (e.g. <left>, <space>, <leader>,
<backspace>).

Disallow mapping with <nop>.

Change-Id: I8f4cdc84cb469db0b5cddd9059484cce7aa1b17f
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-12 14:23:05 +02:00
Lukas Holecek
3841b85418 fakevim: Fix searching
While searching for expression that is not found keep text cursor on
position before search.

Make search work with visual mode.

Clear message on escape from search mode.

Change-Id: I44e843a5a16bcc45a1bdc573ecc409654c4eb910
Reviewed-by: hjk <qthjk@ovi.com>
2012-09-10 12:05:07 +02:00