Search in visual mode should select text up to matched position.
Using commands should work with search movement; e.g. 'd2/needle<CR>'.
Commands should be also properly canceled if search movement fails.
Change-Id: Ic695dccaf3f36ccae2f2b1a93f888d5ba9805a78
Reviewed-by: hjk <hjk121@nokiamail.com>
Since there is now separate configuration for tests
(f3ca72f989) it became obvious that
indentation options are disabled by default.
Change-Id: If13b16b05c5f11171aa49d6964d7e55e2a790646
Reviewed-by: hjk <hjk121@nokiamail.com>
On some keyboards, '>' character can be produced using Shift key. But
recorded macro shouldn't contain '<S->>', which cannot be properly
parsed, instead it will be '<S-<GT>>' (as '<LT>' for '<').
Change-Id: Iac3759029b6ff8c9e690c4728e35048c0b6046f9
Reviewed-by: hjk <hjk121@nokiamail.com>
Implements :omap (and :onoremap) for defining user mappings for movement
while in operator-pending mode (after commands 'c', 'd', '>' and
others).
Change-Id: I07a1e90bf5c649ef5bb53d1de873817dc7348e19
Reviewed-by: hjk <hjk121@nokiamail.com>
Use QTextDocument::onContentsChanged() to monitor text inserted and
removed in insert mode for dot command (or just repeat with 2i, 3o etc.)
to re-insert same text.
Works even if auto-completion is replacing '.' with '->' for pointers.
Change-Id: Ie39edcdc9ec60bcf6c7d10f021248c3a0aee76b6
Reviewed-by: hjk <hjk121@nokiamail.com>
Set correct position for commands I, A in visual mode.
Don't repeat insert mode [count] times if cursor moved in insert mode
(or after <C-O> command).
Don't repeat movement in insert mode ([count] is used only to repeat
the first inserted text).
Dot command for insert mode should be cleared if cursor moved and user
started inserting a text.
Change-Id: I4dbd0fa4e7ecedc6623838c9ad855f83276da2ce
Reviewed-by: hjk <hjk121@nokiamail.com>
Set new text cursor and scroll in editor widget only if it's only
needed. Sometimes these action can have side-effects.
Set new cursor and scroll especially after no pending input and commands
are available to process for FakeVim.
Change-Id: I47df4d0328ac990e2e5c6981955ea7d1bd608c71
Reviewed-by: hjk <hjk121@nokiamail.com>
Don't use QTextCursor::beginEditBlock() and others since it can change
the behavior of underlying editor widget. Use these methods only for
interrupting current edit block.
Change-Id: I848d6287faeeaad9c04a76758bd0b2cc673ad2ef
Reviewed-by: hjk <hjk121@nokiamail.com>
Emulate Vim scrolling behavior. Consider only fully visible lines in
editor widget.
Don't ignore last empty line in document.
Change-Id: Id2c4fd744fb3c4c69324ea6456db424186563bc9
Reviewed-by: hjk <hjk121@nokiamail.com>
Option to pass some key presses in insert mode to editor widget
(replaces 'passnewline'). This allows to rename symbols in insert mode,
complete parenthesis blocks, expand comments etc.
Macro expansion and code-completion works with dot command.
Task-number:QTCREATORBUG-4828
Change-Id: I5ff43818d4f7f183cd6f4ed8cc3a4586469ab65d
Reviewed-by: hjk <hjk121@nokiamail.com>
Don't handle user mappings in commands that cannot be followed by
movement command. For example, key "<SPACE>" in after "t" command cannot
be handled as user mapping.
Change-Id: I97582d23ae637b30b1058b9d2b381a869bbebb79
Reviewed-by: hjk <hjk121@nokiamail.com>
Record macro with 'q{0-9a-zA-Z"}' command and replay it with
'@{0-9a-z".*+}'. Replaying with prompt ('=' instead of register) not
supported.
Change-Id: I49965a99d10910e8df09e62020ed496542e3b249
Reviewed-by: hjk <hjk121@nokiamail.com>
Option 'passnewline' ('pnl') passes new line in insert mode and on 'o'
and 'O' commands to editor widget. This way the editor widget can handle
the indentation or insert characters (e.g. asterisk if in C block
comment).
Change-Id: I06afab6b20b49e1b4d31447826c847d36d32806f
Reviewed-by: hjk <hjk121@nokiamail.com>
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>
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>
Restore selection and cursor position (may have been changed externally)
before any text processing.
Change-Id: I424523512f8f83c276e7d29760aad29bf7921dab
Reviewed-by: hjk <qthjk@ovi.com>
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>
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>
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>
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>