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