forked from qt-creator/qt-creator
fakevim: fix :!cmd if there is no selection
Change-Id: Ieafb77ecc4d211f97b7b8321fc84fd7d6c81dfc0 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -3727,15 +3727,19 @@ bool FakeVimHandler::Private::handleExBangCommand(const ExCommand &cmd) // :!
|
|||||||
proc.closeWriteChannel();
|
proc.closeWriteChannel();
|
||||||
proc.waitForFinished();
|
proc.waitForFinished();
|
||||||
QString result = QString::fromUtf8(proc.readAllStandardOutput());
|
QString result = QString::fromUtf8(proc.readAllStandardOutput());
|
||||||
beginEditBlock();
|
if (text.isEmpty()) {
|
||||||
removeText(currentRange());
|
emit q->extraInformationChanged(result);
|
||||||
insertText(result);
|
} else {
|
||||||
setPosition(targetPosition);
|
beginEditBlock();
|
||||||
endEditBlock();
|
removeText(currentRange());
|
||||||
leaveVisualMode();
|
insertText(result);
|
||||||
//qDebug() << "FILTER: " << command;
|
setPosition(targetPosition);
|
||||||
showBlackMessage(FakeVimHandler::tr("%n lines filtered", 0,
|
endEditBlock();
|
||||||
text.count('\n')));
|
leaveVisualMode();
|
||||||
|
//qDebug() << "FILTER: " << command;
|
||||||
|
showBlackMessage(FakeVimHandler::tr("%n lines filtered", 0,
|
||||||
|
text.count('\n')));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3866,13 +3870,14 @@ void FakeVimHandler::Private::handleExCommand(const QString &line0)
|
|||||||
}
|
}
|
||||||
if (beginLine != -1 && endLine == -1)
|
if (beginLine != -1 && endLine == -1)
|
||||||
endLine = beginLine;
|
endLine = beginLine;
|
||||||
const int beginPos = firstPositionInLine(beginLine);
|
|
||||||
const int endPos = lastPositionInLine(endLine);
|
|
||||||
ExCommand cmd;
|
ExCommand cmd;
|
||||||
cmd.setContentsFromLine(line);
|
cmd.setContentsFromLine(line);
|
||||||
cmd.range = Range(beginPos, endPos, RangeLineMode);
|
if (beginLine != -1) {
|
||||||
if (beginLine != -1)
|
const int beginPos = firstPositionInLine(beginLine);
|
||||||
|
const int endPos = lastPositionInLine(endLine);
|
||||||
|
cmd.range = Range(beginPos, endPos, RangeLineMode);
|
||||||
cmd.count = beginLine;
|
cmd.count = beginLine;
|
||||||
|
}
|
||||||
//qDebug() << "CMD: " << cmd;
|
//qDebug() << "CMD: " << cmd;
|
||||||
|
|
||||||
enterCommandMode();
|
enterCommandMode();
|
||||||
|
Reference in New Issue
Block a user