forked from qt-creator/qt-creator
FakeVim: Don't try to read from file which could not be opened
Change-Id: I3468d1a4c9e3ba7bcfd6526f5541b3ec4e84a3e4 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1964,7 +1964,7 @@ void FakeVimPluginPrivate::handleExCommand(FakeVimHandler *handler, bool *handle
|
|||||||
saved = !editor->document()->isModified();
|
saved = !editor->document()->isModified();
|
||||||
if (saved) {
|
if (saved) {
|
||||||
QFile file3(fileName);
|
QFile file3(fileName);
|
||||||
file3.open(QIODevice::ReadOnly);
|
if (file3.open(QIODevice::ReadOnly)) {
|
||||||
const QByteArray ba = file3.readAll();
|
const QByteArray ba = file3.readAll();
|
||||||
handler->showMessage(MessageInfo, Tr::tr("\"%1\" %2 %3L, %4C written")
|
handler->showMessage(MessageInfo, Tr::tr("\"%1\" %2 %3L, %4C written")
|
||||||
.arg(fileName).arg(' ').arg(ba.count('\n')).arg(ba.size()));
|
.arg(fileName).arg(' ').arg(ba.count('\n')).arg(ba.size()));
|
||||||
@@ -1972,6 +1972,7 @@ void FakeVimPluginPrivate::handleExCommand(FakeVimHandler *handler, bool *handle
|
|||||||
delayedQuitRequested(cmd.hasBang, m_editorToHandler.key(handler));
|
delayedQuitRequested(cmd.hasBang, m_editorToHandler.key(handler));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!saved)
|
if (!saved)
|
||||||
handler->showMessage(MessageError, Tr::tr("File not saved"));
|
handler->showMessage(MessageError, Tr::tr("File not saved"));
|
||||||
|
|||||||
Reference in New Issue
Block a user