FakeVim: Fix a deprecation warning

... and re-organize surrounding code a bit.

Change-Id: I0c3af5b2a434c5088ed165fed97d562f468d16fc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-03-04 11:48:02 +01:00
parent 014789d994
commit 475e7b1283

View File

@@ -2155,6 +2155,7 @@ public:
bool handleExWriteCommand(const ExCommand &cmd);
bool handleExEchoCommand(const ExCommand &cmd);
void setTabSize(int tabSize);
void setupCharClass();
int charClass(QChar c, bool simple) const;
signed char m_charClass[256];
@@ -2686,17 +2687,22 @@ void FakeVimHandler::Private::ensureCursorVisible()
void FakeVimHandler::Private::updateEditor()
{
const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' ');
EDITOR(setTabStopWidth(charWidth * config(ConfigTabStop).toInt()));
setTabSize(config(ConfigTabStop).toInt());
setupCharClass();
}
void FakeVimHandler::Private::setTabSize(int tabSize)
{
const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' ');
const int width = charWidth * tabSize;
EDITOR(setTabStopDistance(width));
}
void FakeVimHandler::Private::restoreWidget(int tabSize)
{
//EDITOR(removeEventFilter(q));
//EDITOR(setReadOnly(m_wasReadOnly));
const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' ');
EDITOR(setTabStopWidth(charWidth * tabSize));
setTabSize(tabSize);
g.visualMode = NoVisualMode;
// Force "ordinary" cursor.
setThinCursor();