fakevim: small fixes

This commit is contained in:
hjk
2010-05-10 09:01:30 +02:00
parent 0dd38fb829
commit 16f6fda51a

View File

@@ -1481,7 +1481,8 @@ void FakeVimHandler::Private::updateMiniBuffer()
int linesInDoc = linesInDocument(); int linesInDoc = linesInDocument();
int l = cursorLineInDocument(); int l = cursorLineInDocument();
QString status; QString status;
const QString pos = QString::fromLatin1("%1,%2").arg(l + 1).arg(physicalCursorColumnInDocument() + 1); const QString pos = QString::fromLatin1("%1,%2")
.arg(l + 1).arg(physicalCursorColumnInDocument() + 1);
// FIXME: physical "-" logical // FIXME: physical "-" logical
if (linesInDoc != 0) { if (linesInDoc != 0) {
status = FakeVimHandler::tr("%1%2%").arg(pos, -10).arg(l * 100 / linesInDoc, 4); status = FakeVimHandler::tr("%1%2%").arg(pos, -10).arg(l * 100 / linesInDoc, 4);
@@ -2882,12 +2883,6 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const QString &line)
bool FakeVimHandler::Private::handleExMapCommand(const QString &line) // :map bool FakeVimHandler::Private::handleExMapCommand(const QString &line) // :map
{ {
const int pos1 = line.indexOf(QLatin1Char(' ')); const int pos1 = line.indexOf(QLatin1Char(' '));
const int pos2 = line.indexOf(QLatin1Char(' '), pos1 + 1);
if (pos1 == -1 || pos2 == -1) {
// FIXME: Dump mappings here.
//qDebug() << g.mappings;
return true;;
}
QByteArray modes; QByteArray modes;
enum Type { Map, Noremap, Unmap } type; enum Type { Map, Noremap, Unmap } type;
@@ -2930,6 +2925,13 @@ bool FakeVimHandler::Private::handleExMapCommand(const QString &line) // :map
else else
return false; return false;
const int pos2 = line.indexOf(QLatin1Char(' '), pos1 + 1);
if (pos1 == -1 || pos2 == -1) {
// FIXME: Dump mappings here.
//qDebug() << g.mappings;
return true;;
}
QString lhs = line.mid(pos1 + 1, pos2 - pos1 - 1); QString lhs = line.mid(pos1 + 1, pos2 - pos1 - 1);
QString rhs = line.mid(pos2 + 1); QString rhs = line.mid(pos2 + 1);
Inputs key; Inputs key;
@@ -3313,7 +3315,8 @@ static void vimPatternToQtPattern(QString *needle, QTextDocument::FindFlags *fla
void FakeVimHandler::Private::search(const QString &needle0, bool forward, void FakeVimHandler::Private::search(const QString &needle0, bool forward,
bool incSearch) bool incSearch)
{ {
showBlackMessage(QLatin1Char(forward ? '/' : '?') + needle0); //showBlackMessage(QLatin1Char(forward ? '/' : '?') + needle0);
showBlackMessage(needle0);
CursorPosition origPosition = cursorPosition(); CursorPosition origPosition = cursorPosition();
QTextDocument::FindFlags flags = QTextDocument::FindCaseSensitively; QTextDocument::FindFlags flags = QTextDocument::FindCaseSensitively;
if (!forward) if (!forward)