diff options
author | hjk <hjk@qt.io> | 2021-10-13 08:32:06 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2021-10-13 14:39:04 +0000 |
commit | e1a69fccb15a87ffc637898cf2248358edb01258 (patch) | |
tree | bcb66da54fd0f717f39c553f84d6e692724c0efc /src/plugins/fakevim | |
parent | 6dd66e012b49f634541457aafffc2367e91d95e7 (diff) |
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>
Diffstat (limited to 'src/plugins/fakevim')
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index ae9cfc173f2..f0ab3becb03 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -6598,13 +6598,12 @@ bool FakeVimHandler::Private::handleExSourceCommand(const ExCommand &cmd) while (!file.atEnd() || !line.isEmpty()) { QByteArray nextline = !file.atEnd() ? file.readLine() : QByteArray(); - // remove comment - int i = nextline.lastIndexOf('"'); - if (i != -1) - nextline = nextline.remove(i, nextline.size() - i); - nextline = nextline.trimmed(); + // remove full line comment. for being precise, check :help comment in vim. + if (nextline.startsWith('"')) + continue; + // multi-line command? if (nextline.startsWith('\\')) { line += nextline.mid(1); |