Commit Graph

759 Commits

Author SHA1 Message Date
hluk
92bd228e95 FakeVim: Correct range mode for registers
Change-Id: Ib58ced12ab8cff5917e17b8fc5022147d6f99f38
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-18 17:16:39 +01:00
hluk
474459f45f FakeVim: Refactored user mappings code
Change-Id: Ib32a97814ce5dc36a5d5ae3cba59bf4968525bad
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-18 17:15:08 +01:00
hluk
4f20799af2 FakeVim: Clear count after insert mode
Change-Id: If02aaecbbbb5e25001d5bafafd0d4228bba5d63e
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-18 17:13:45 +01:00
hluk
dab57db8f4 FakeVim: Properly clear bad mapping
Change-Id: Ia2a1b04962976b119d2190a02aba0ec01b451e43
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-18 17:13:02 +01:00
hluk
70adf53fbd FakeVim: Option 'passnewline' (not in Vim)
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>
2013-03-18 17:11:53 +01:00
hluk
f2f0bf5376 FakeVim: Emulate Vim option "tildeop" ("top")
Change-Id: I61a07f5edc0e2a062ca10cb17f489ac3ce113d9f
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-14 16:22:17 +01:00
hluk
0a86efb8a0 FakeVim: Tilde command moves text cursor to the right
Change-Id: Ieff36ffa06b39dd7ff55551dd0fec627b8561939
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-14 16:21:31 +01:00
Lukas Holecek
ca5b956ab5 FakeVim: Emulate Vim option ignorecase
Change-Id: I0dc87f8a34fa458a9eab14440f7ad2ac2cfe0a98
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-13 12:35:44 +01:00
Lukas Holecek
4394b798bb FakeVim: Correct position after :read
Change-Id: Ibffc3c271c6690653a47fcbe47c29acf6d93a113
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-13 12:14:35 +01:00
Lukas Holecek
db8722fdd8 FakeVim: Emulate Vim option "scrolloff" ("so")
Change-Id: Ied0a85ec834232a040b447d70f113daca9e4c035
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-12 08:35:26 +01:00
Lukas Holecek
96ad87376c FakeVim: Fix commands z., zz, zb, z- (swapped center and bottom)
Change-Id: I0b2064c2d8006435038deafed35fb0169b45e47e
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-12 08:18:03 +01:00
hjk
d44bac6f43 FakeVim: Make plugin standalone if necessary
It's possible to use FakeVim as standalone plugin for a QTextEdit or
QPlainTextEdit widget, so there should be minimum dependencies on
Qt Creator code.

Change-Id: I415ed87f5e4d97ea78d9d25a8f0c82701ef1f70d
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-08 17:53:14 +01:00
Friedemann Kleint
d1fde7ab2c Fix Krazy-warning about non-const ref iterator in fakevim.
Change-Id: I9b9ec78d75d3ea4e00f94b715995d65a7c75e674
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-03-08 10:26:44 +01:00
Lukas Holecek
128fa2d64d FakeVim: Correctly parse delete key as user input
Change-Id: I8e0b5cb1c360bd02a48becf87e27398631c414e2
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-28 16:04:53 +01:00
Lukas Holecek
5b4066aff2 FakeVim: <S-Insert> to insert text from clipboard
Mapping <S-Insert> is alias of 'p' in command mode and inserts clipboard
content in insert mode.

Change-Id: Id53890ee4e7df0140fe1e0791d620bda315f3924
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-28 15:39:17 +01:00
Lukas Holecek
a2be7db81c FakeVim: Fix usage of copy/paste registers with tests
Change-Id: I9b860a40a9b18286a25e1d919dab1c21ea5def10
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-28 15:13:20 +01:00
Debao Zhang
f5dcd55117 Qt5: Don't use the deprecated {QString,QChar}::fromAscii()
Change-Id: Ic1d302c2186b11ffec5139f4f491d477d334ec8f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-02-26 15:24:26 +01:00
Lukas Holecek
8d295948e0 FakeVim: Correct key mappings with Qt 5
Task-number: QTCREATORBUG-8774
Change-Id: I4b7e90a99e9ff2f56f14f28636fe32fe39b4d4b8
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-23 22:47:21 +01:00
Lukas Holecek
d58415ed3e FakeVim: Fix search in Qt 5
In Qt 5, QTextCursor::movePosition() with QTextCursor::Right as move
operation will not move the cursor if it's at the end of line/block.

Change-Id: I5fce9674f2031d54c69d89f93ffaa9d2e89b4fc4
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-23 12:52:15 +01:00
Lukas Holecek
9b79adc4ba FakeVim: Handle unicode mappings and properly fail on bad mapping
Task-number: QTCREATORBUG-8774
Change-Id: Ic57a01fc13a073f2b13d16daecba9e070e186779
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-19 18:41:32 +01:00
Oswald Buddenhagen
1ffe15a471 Merge remote-tracking branch 'origin/2.7'
Conflicts:
	qtcreator.pri
	qtcreator.qbs

Change-Id: I84145b02bf4f80848c0c1d762de34738f08bb78f
2013-02-18 14:16:53 +01:00
Lukas Holecek
e46a63b93e FakeVim: Fixes for visual delete with end of line selected
Change-Id: I486aff7cf6a81b125a9b3b179505656efe997789
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-18 13:05:23 +01:00
Lukas Holecek
0db85db378 FakeVim: Check if input is [count] for a command properly
Change-Id: I831b87733ca96a31cd9da10375d10998a1722c12
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-18 12:34:30 +01:00
Robert Loehning
80a4fdf329 String fix
Change-Id: Ida86e0e2968d223130d6c081364965eb6a116bcb
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-11 12:42:20 +01:00
Leena Miettinen
d3eddd329b UI text: fixed FakeVim messages
Fixed capitalization and punctualization.

Change-Id: Ib99f8a8cef9f1b92789531aa46e964e0828eaea1
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
2013-02-08 16:17:28 +01:00
Kai Koehne
da3b57b83a Fix clang compiler warning
Fix warning 'suggest a space before ";" or explicit braces around
empty body in "for" statement'

Change-Id: Ib4bff046cbdb6756fbcf66000a9197863d4f3b41
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-07 13:51:10 +01:00
Lukas Holecek
e5b304c808 FakeVim: Change current window with count
Implemented commands like <c-w>2<left> (and 2<c-w><left>).

Change-Id: Ic11f3b306fc3f794093a3ee5cad4b8a3563315d2
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-06 14:48:05 +01:00
Oswald Buddenhagen
1fda2111d4 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in
	src/plugins/debugger/qtmessageloghandler.cpp
	src/plugins/debugger/qtmessagelogwindow.cpp
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
	src/plugins/qmldesigner/designercore/include/widgetqueryview.h
	src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
	src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
	src/plugins/qnx/bardescriptormagicmatcher.h
	src/plugins/qt4projectmanager/profilekeywords.cpp
	src/plugins/remotelinux/deployablefilesperprofile.cpp
	src/plugins/remotelinux/deployablefilesperprofile.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/deploymentsettingsassistant.cpp
	src/plugins/remotelinux/profilesupdatedialog.cpp
	tests/auto/icheckbuild/ichecklib.cpp
	tests/auto/icheckbuild/parsemanager.cpp
	tests/auto/icheckbuild/parsemanager.h

Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
2013-01-31 16:25:33 +01:00
Robert Loehning
298531e370 Incremented year in copyright info
Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-01-29 16:27:03 +01:00
Friedemann Kleint
e7aded4052 Fix tr()-usage in fakevim.
Change-Id: I21b2fcbe6b638b0b07341c23aac6028607de4fdf
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-01-23 10:49:14 +01:00
Lukas Holecek
2622eb2415 FakeVim: Remember that cursor is at the end of line
Change-Id: I62098a409028593664b813931d5974de5e787993
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-17 11:03:33 +01:00
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
hjk
26275fb175 FakeVim: initialize variables
Compiler complains about potential use of uninitialized value.

Change-Id: I120329351983ab795f0dae0ebcc87cd53762f0bd
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-16 19:22:34 +01:00
Orgad Shaneh
29a93998df Remove braces for single lines of conditions
#!/usr/bin/env ruby

Dir.glob('**/*.cpp') { |file|
  # skip ast (excluding paste, astpath, and canv'ast'imer)
  next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
  s = File.read(file)
  next if s.include?('qlalr')
  orig = s.dup
  s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
    res = $&
    if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
      res
    else
      res.gsub!('} else', 'else')
      res.gsub!(/\n +} *\n/m, "\n")
      res.gsub(/ *{$/, '')
    end
  }
  s.gsub!(/ *$/, '')
  File.open(file, 'wb').write(s) if s != orig
}

Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 10:48:18 +01:00
Lukas Holecek
2af8015941 FakeVim: Allow to delete selected text in command buffer
Change-Id: Ia3074053da465b5ce999955f428c970f1b01a265
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-30 16:08:36 +01:00
hjk
a570e7327f FakeVim: handle keyboard selection in command buffer
Change-Id: I6a1f605fc77b9af596ee60c5f98e1b3252333284
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-30 11:18:39 +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
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
c50c4269ad fakevim: Display visual block selection correctly
Change-Id: Id33544265c0266e0a43a811b5a00aa94dfcc4f37
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-05 19:35:47 +01:00
Lukas Holecek
f50dc8e06f fakevim: Restore last selection with proper position
Command 'gv' restores proper position in selection -- except in visual
line mode ('V') only positions at beginning and end are supported.

Change-Id: I0810808606c340b5c18fe7551a2d5fda29abfeca
Reviewed-by: hjk <qthjk@ovi.com>
2012-12-05 19:35:09 +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
61c3de01a8 fakevim: Commands '[z' and ']z' to move to top or bottom of fold
Commands '[z' and ']z' to move [count] times to top or bottom of current
folds.

Change-Id: Ia087e47bd5f9d63a2b9a4b2ffd3fc57559dfba6b
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-30 14:34:43 +01:00
Lukas Holecek
9d2f1f6769 fakevim: Commands 'zj' and 'zk' to move [count] folds down and up
It's possible to do '2dzj' to delete everything up to beginning of
second unfolded block or whole folded block.

Change-Id: I080c9ec4d12471faf09cabea3c96b448b5fc7f4d
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-30 14:33:44 +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