Commit 93c60417 authored by hjk's avatar hjk
Browse files

use QTextEdit's "overwriteMode" instead of playing around with the

cursor width manually.
parent 00a3b537
...@@ -157,10 +157,7 @@ void FakeVimPlugin::installHandler() ...@@ -157,10 +157,7 @@ void FakeVimPlugin::installHandler()
return; return;
plainTextEdit->removeEventFilter(m_handler); plainTextEdit->removeEventFilter(m_handler);
plainTextEdit->installEventFilter(m_handler); plainTextEdit->installEventFilter(m_handler);
QFont font = plainTextEdit->font(); plainTextEdit->setOverwriteMode(true);
//font.setFamily("Monospace");
m_savedCursorWidth = plainTextEdit->cursorWidth();
plainTextEdit->setCursorWidth(QFontMetrics(font).width(QChar('x')));
//QMainWindow mw; //QMainWindow mw;
connect(m_handler, SIGNAL(commandBufferChanged(QString)), connect(m_handler, SIGNAL(commandBufferChanged(QString)),
...@@ -175,7 +172,7 @@ void FakeVimPlugin::removeHandler(QObject *ob) ...@@ -175,7 +172,7 @@ void FakeVimPlugin::removeHandler(QObject *ob)
QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(ob); QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(ob);
if (!plainTextEdit) if (!plainTextEdit)
return; return;
plainTextEdit->setCursorWidth(m_savedCursorWidth); plainTextEdit->setOverwriteMode(false);
} }
void FakeVimPlugin::showCommandBuffer(const QString &contents) void FakeVimPlugin::showCommandBuffer(const QString &contents)
......
...@@ -74,7 +74,6 @@ private: ...@@ -74,7 +74,6 @@ private:
FakeVimHandler *m_handler; FakeVimHandler *m_handler;
ExtensionSystem::PluginManager *m_pm; ExtensionSystem::PluginManager *m_pm;
QAction *m_installHandlerAction; QAction *m_installHandlerAction;
int m_savedCursorWidth;
}; };
} // namespace Internal } // namespace Internal
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment