Commit Graph

921 Commits

Author SHA1 Message Date
Marcus Tillmanns
015d12ccf3 FakeVim: Accept suggestion with Tab Key
* Changed signals to callbacks as only one receiver was ever added
* Added "tabPressedInInsertMode" callback to allow accepting
  a suggestion with the Tab Key

Fixes: QTCREATORBUG-28830
Change-Id: Ie70ba595b8802b6100fff495164d8e0471b1354c
Reviewed-by: hjk <hjk@qt.io>
2023-05-02 06:53:54 +00:00
Marcus Tillmanns
9f0919c4a3 FakeVim: Block Suggestions
Block suggestions when FakeVim is enabled and the mode
is not "Insert" or "Replace".

Change-Id: I778eb25d9570b76e42652f9d938a8c580033c462
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-02 06:04:53 +00:00
Marcus Tillmanns
1a658eff26 FakeVim: Clear suggestions on mode change
Change-Id: I5d3a37ab61f83a70e055063de397654f5621401d
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-04-27 06:56:47 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Jarek Kobus
e54fb7ab64 Replace missing qAsConst with std::as_const()
Patch missing leftovers after recent batch patch.

Amends 8eb4d52342

Change-Id: I5469b8c10e6844cd1911f719ce3dddbb42697f95
Reviewed-by: hjk <hjk@qt.io>
2022-10-10 14:14:02 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Jarek Kobus
bc4c1faf73 Fix logical XOR
The '^' is the bitwise XOR, we should use logical XOR in
these contexts. The operator!=() should serve for it.

More info and reasoning:
https://stackoverflow.com/questions/24542

Change-Id: I1bd70bdcab25455f409594f0f14c209d1de11d18
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-07 07:42:22 +00:00
Jarek Kobus
392585f76d FakeVim: Replace foreach with ranged for loop
Change-Id: I0de9620ebf837be25e153bfd282b6564d4d2b115
Reviewed-by: hjk <hjk@qt.io>
2022-10-05 13:50:35 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
hjk
2e85c48944 FakeVim: Partially implement multi repeat command (:g, :v)
Change-Id: Ifed113e80103b9fdd109cb4a5a6a31098f77d74c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-06-27 14:43:42 +00:00
hjk
0ae2e48ff1 FakeVim: Fix crash with debug build of Qt 6
915be6606ead2 in Qt base introduced an assert that triggers
occasionally.

This here moves the original check to the fakevim side, without
changing (possibly wrong) functionality.

Change-Id: I435ea53ecc0ba1a905dee2f4e3f8feb3c6dc7db3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-06-20 12:06:13 +00:00
hjk
27ce8d6177 FakeVim: Simplify calling external processes
Change-Id: I5157e2e73654df8bef65d72b7209c487e8b0c881
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-06-20 08:42:51 +00:00
hjk
5af00873cf FakeVim: Support backslashes in substitute command patterns
Change-Id: Ibfcea7fdc550082e4975e1fc4d2fba6563dbfd02
Done-by: Jochen Baier
Fixes: QTCREATORBUG-26955
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-03 11:25:12 +00:00
Christian Stenger
e158bfe618 FakeVim: Improve handling of content changes
..when indenter or auto completer may interfere.

Task-number: QTCREATORBUG-26195
Change-Id: Iaf0eefd74344423409fa0c22f8e3ea618b4c9930
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2021-12-07 07:10:46 +00:00
Jarek Kobus
91605c3613 Use QtcProcess inside fake vim handler
Change-Id: I14af193bbf9e7fda9e5b0ba0a1647e19069c40e2
Reviewed-by: hjk <hjk@qt.io>
2021-10-29 18:54:05 +00:00
Orgad Shaneh
3871e40f43 Fix qHash-related size compatibility warnings by MSVC
Change-Id: I3b7981ce78b67db4b996f99682284a0b911d8cd7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-10-20 15:03:51 +00:00
hjk
e1a69fccb1 FakeVim: Only drop full-line comments
This is not what real vim does, but :help comments looks scary,
we don't support more complex scripts anyway, and full-line
comments at least allow some commenting.

Fixes: QTCREATORBUG-26254
Change-Id: I9018d06d2a929fad6d3d301240928b6a8b109710
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: hjk <hjk@qt.io>
2021-10-13 14:39:04 +00:00
hjk
7a76f7edbf Revert "FakeVim: Also record NoVisualMode as last visual mode"
This reverts commit e5dd24322f
which caused QTCREATORBUG-26214.

Fixes: QTCREATORBUG-26214
Change-Id: I0d285b4df8fa428201fb6c48bbbad81f8195a941
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-11 06:05:23 +00:00
hjk
f9893f5883 FakeVim: Update visual marks when mark settings have changed
To test: ":set sm",  "ma", "<Down>",  ":set nosm"

Change-Id: I75d2c3ded04ddf3bc656574a3cff136db144df2b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-21 06:44:28 +00:00
hjk
e5dd24322f FakeVim: Also record NoVisualMode as last visual mode
Fixes: QTCREATORBUG-25822
Change-Id: I9a63726d357e3ea3d92b05a5d77cad5221c03f93
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-18 09:17:43 +00:00
Eike Ziller
4151f091e3 Merge remote-tracking branch 'origin/4.15'
Change-Id: If0dbebdf37b0ffea2528bf6ce6d34d88554f8dfb
2021-03-16 10:55:54 +01:00
Eike Ziller
05701491a1 FakeVim: Fix compilation with Qt 6
By using recursive QHash instead of recursive QMap, which has issues
compiling under some circumstances with MSVC.

Change-Id: I545a5eb9002f247a5015e7ea5e59cf74895b1e21
Reviewed-by: hjk <hjk@qt.io>
2021-03-16 08:50:40 +00:00
Lukas Holecek
e3d95ac094 FakeVim: Fix Windows build
Standalone FakeVim library fails to build on Windows due to missing
operator+ for "QString" and "const char *" arguments.

This is problem even if using `QT_RESTRICTED_CAST_FROM_ASCII`.

Change-Id: I0ec13d7dfa8ef99d98fa737456d12f16facc5427
Reviewed-by: hjk <hjk@qt.io>
2021-03-03 15:55:43 +00:00
hjk
50f93710b7 FakeVim: Aspectify settings
Change-Id: Ic73edce82e192779ed3efe86a5cb747a52d94d36
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-03 07:12:21 +00:00
Tom Praschan
f600386732 Fix dot command for pasting with 'P' being 'p'
Change-Id: Ic491f3a198a03fd08a680e044c4e8f2f5ebe2866
Reviewed-by: hjk <hjk@qt.io>
2021-02-22 06:06:49 +00:00
Leander Schulten
213ad8368a Fix build
Change-Id: If4593342cd92716fb2238d633e5b25135a02ce57
Reviewed-by: hjk <hjk@qt.io>
2021-02-18 06:28:55 +00:00
Tom Praschan
1085d6b508 FakeVim: Add emulation for vim-surround plugin
Change-Id: If450d04dd89a1707ab05806522fbf4cc987d454b
Reviewed-by: hjk <hjk@qt.io>
2021-02-17 08:50:21 +00:00
Tom Praschan
d7acee920d FakeVim: Add emulation for argtextobj.vim plugin
Change-Id: I319d2b9fe9f0d145c2560cf03fecc50629c99006
Reviewed-by: hjk <hjk@qt.io>
2021-02-12 08:36:29 +00:00
Christian Stenger
c058ceead4 FakeVim: Fix compile
Amends f83eeb0548.

Change-Id: Ia709c45800c63375de0ef995ee8bd37d54c45d26
Reviewed-by: hjk <hjk@qt.io>
2021-02-11 07:58:27 +00:00
Jarek Kobus
a3677c15e7 Compile fix - use Utils::optional
Amends f83eeb0548

Change-Id: Iad1ca06bf546405873aaf8daebbdb76b79f4c0ff
Reviewed-by: hjk <hjk@qt.io>
2021-02-11 07:47:54 +00:00
Tom Praschan
f83eeb0548 FakeVim: Add emulation of vim-exchange plugin
Change-Id: I844c9bf11231ab842cee020a0e7a29af8ed209eb
Reviewed-by: hjk <hjk@qt.io>
2021-02-10 16:11:50 +00:00
Tom Praschan
509d5895f8 FakeVim: Merge comments when joining lines with 'J'
This is the default behavior in vim as well

Change-Id: Ia4d56e3cfc7f91fc353078daefaabeada9a86bed
Reviewed-by: hjk <hjk@qt.io>
2021-02-09 08:56:47 +00:00
Tom Praschan
b6f26ed67a FakeVim: Add emulation for ReplaceWithRegister plugin
Change-Id: Iaaeef6ff51fe858b759c10adaac582f5858b6210
Reviewed-by: hjk <hjk@qt.io>
2021-02-09 07:33:03 +00:00
Leander Schulten
4ae93a9d27 FakeVim: Fix Qt6 build
Amends f626e27370

Change-Id: Id4681dc771a132bc6143b7e1f0b566a3930706e2
Reviewed-by: hjk <hjk@qt.io>
2021-02-04 12:15:18 +00:00
Tom Praschan
f626e27370 FakeVim: Add emulation for vim-commentary
Change-Id: I34f222182835ae160e6c4c66ad0bada79d8abeff
Reviewed-by: hjk <hjk@qt.io>
2021-02-03 17:58:22 +00:00
Tom Praschan
b1f1ecb1b5 FakeVim: Fix dot command for pasting
Fixes: QTCREATORBUG-25281
Change-Id: Ic36b87672889442520941bcefa0f5ee14b77fbc6
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: hjk <hjk@qt.io>
2021-02-03 17:58:02 +00:00
Timon Riedelbauch
002db1fa42 add special characters \u \U \l \L to fakevim substitute command
vim substitute (:s/) hast the option to use special characters
\u \U \l \L in the replacement part to change the case of the
following letters. This was not present in fakevim.

Change-Id: I13785db24018283c242d94fd7892765657570176
Reviewed-by: hjk <hjk@qt.io>
2021-02-03 09:34:54 +00:00
hjk
289a18f56f FakeVim: Change shortcuts from Alt-V,X to Alt-Y,X
Alt-V is taken by the Views menu nowadays.

Also, fix the instruction to quit FakeVim on Mac.

Fixes: QTCREATORBUG-24694
Change-Id: I5268760f45e34f973b3b38b19d2577c0c655b000
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-10 12:29:14 +00:00
hjk
eb45b8f9b9 Avoid more uses of non-explicit QChar(int) constructor
Will be gone in Qt6.

Task-number: QTCREATORBUG-24098
Change-Id: Id76b15bb11879b2e8ff0f71af45acbfb1720f763
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-10 12:27:36 +00:00
hjk
81c4d59346 FakeVim: Fix use of implicit QChar(int) constructor
Change-Id: I79a778a1e32dae8b2c1f7d49d4c4e655cf51b1fb
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-06 14:59:33 +00:00
Lukas Holecek
4e28aed405 FakeVim: Fix deleting selection on search command-line
Change-Id: Ie01dd84cf87db2d999c10352285c0ee8366aadc1
Reviewed-by: hjk <hjk@qt.io>
2020-11-02 07:56:56 +00:00
hjk
35932385bc FakeVim: Allow AltGr as modifier to produce normal key values
Task-number: QTCREATORBUG-24673
Change-Id: I6d1aa5badd3077f0885d5b2470527c006096809d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-08 06:24:46 +00:00
Eike Ziller
6225d33c28 Fix build issues with Qt6
Change from QStringRef to QStringView at various places.

Task-number: QTCREATORBUG-24098
Change-Id: Ia7a634fa26464fbb2962724d5f0e188cecc68801
Reviewed-by: hjk <hjk@qt.io>
2020-09-18 14:41:32 +00:00
hjk
cc7caee133 FakeVim: Fix case insensitivity handling for forward searching
Change-Id: I1f5b13022f3ae06916434b48cf3c6ba6d4722746
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-17 06:17:38 +00:00
hjk
fd2236a59a More Qt 6 fixes
Task-number: QTCREATORBUG-24098
Change-Id: I1e30b49218b18f426aea6e4cd3680be513894746
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-23 07:59:46 +00:00
hjk
6027c62ab2 FakeVim: Finish port to QRegularExpression
Change-Id: Id4eaab8f41be3b724ddf22f74384a60995cf4aa5
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-23 07:52:37 +00:00
hjk
86b7e287d6 FakeVim: Port more from QRegExp to QRegularExpression
QRegExp will not be available in Qt 6.

Task-number: QTCREATORBUG-24098
Change-Id: Ia1aec515615ecaf8e92ae1a3a1dad92cb999bfb1
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-23 07:33:48 +00:00
hjk
da829f3fe7 FakeVim: Use QStringView instead of QStringRef
QStringRef will not exist in Qt 6.

Change-Id: I439240fbb4c87fbe71c9fa42596c9aaadb75a05e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-18 13:35:17 +00:00
hjk
c5a64bd4de FakeVim: Replace QRegExp use in handleExSubstituteCommand()
Task-number: QTCREATORBUG-24098
Change-Id: I4176b614a7de73a675d5252344b68ce61dc340c2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 06:15:38 +00:00