forked from qt-creator/qt-creator
fakevim: hot fix for the 'must change tabsize in fakevim, too'-problem
This commit is contained in:
@@ -386,7 +386,7 @@ public:
|
||||
void installEventFilter();
|
||||
void passShortcuts(bool enable);
|
||||
void setupWidget();
|
||||
void restoreWidget();
|
||||
void restoreWidget(int tabSize);
|
||||
|
||||
friend class FakeVimHandler;
|
||||
static int shift(int key) { return key + 32; }
|
||||
@@ -815,7 +815,6 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
|
||||
void FakeVimHandler::Private::installEventFilter()
|
||||
{
|
||||
EDITOR(installEventFilter(q));
|
||||
updateEditor();
|
||||
}
|
||||
|
||||
void FakeVimHandler::Private::setupWidget()
|
||||
@@ -855,7 +854,7 @@ void FakeVimHandler::Private::updateEditor()
|
||||
EDITOR(setTabStopWidth(charWidth * config(ConfigTabStop).toInt()));
|
||||
}
|
||||
|
||||
void FakeVimHandler::Private::restoreWidget()
|
||||
void FakeVimHandler::Private::restoreWidget(int tabSize)
|
||||
{
|
||||
//showBlackMessage(QString());
|
||||
//updateMiniBuffer();
|
||||
@@ -863,6 +862,8 @@ void FakeVimHandler::Private::restoreWidget()
|
||||
EDITOR(setReadOnly(m_wasReadOnly));
|
||||
EDITOR(setCursorWidth(m_cursorWidth));
|
||||
EDITOR(setOverwriteMode(false));
|
||||
const int charWidth = QFontMetrics(EDITOR(font())).width(QChar(' '));
|
||||
EDITOR(setTabStopWidth(charWidth * tabSize));
|
||||
|
||||
if (isVisualLineMode()) {
|
||||
m_tc = EDITOR(textCursor());
|
||||
@@ -3988,9 +3989,9 @@ void FakeVimHandler::setupWidget()
|
||||
d->setupWidget();
|
||||
}
|
||||
|
||||
void FakeVimHandler::restoreWidget()
|
||||
void FakeVimHandler::restoreWidget(int tabSize)
|
||||
{
|
||||
d->restoreWidget();
|
||||
d->restoreWidget(tabSize);
|
||||
}
|
||||
|
||||
void FakeVimHandler::handleCommand(const QString &cmd)
|
||||
|
||||
@@ -57,14 +57,14 @@ public slots:
|
||||
void showRedMessage(const QString &msg);
|
||||
|
||||
// This executes an "ex" style command taking context
|
||||
// information from widget;
|
||||
// information from the current widget.
|
||||
void handleCommand(const QString &cmd);
|
||||
|
||||
void installEventFilter();
|
||||
|
||||
// Convenience
|
||||
void setupWidget();
|
||||
void restoreWidget();
|
||||
void restoreWidget(int tabSize);
|
||||
|
||||
// Test only
|
||||
int physicalIndentation(const QString &line) const;
|
||||
|
||||
@@ -757,8 +757,7 @@ void FakeVimPluginPrivate::findNext(bool reverse)
|
||||
triggerAction(Find::Constants::FIND_NEXT);
|
||||
}
|
||||
|
||||
// this class defers deletion of a child FakeVimHandler using 'deleteLater'
|
||||
// - direct children QObject's would be 'delete'ed immediately before their parents
|
||||
// This class defers deletion of a child FakeVimHandler using deleteLater().
|
||||
class DeferredDeleter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -767,8 +766,7 @@ class DeferredDeleter : public QObject
|
||||
|
||||
public:
|
||||
DeferredDeleter(QObject *parent, FakeVimHandler *handler)
|
||||
: QObject(parent)
|
||||
, m_handler(handler)
|
||||
: QObject(parent), m_handler(handler)
|
||||
{}
|
||||
|
||||
virtual ~DeferredDeleter()
|
||||
@@ -861,8 +859,10 @@ void FakeVimPluginPrivate::setUseFakeVim(const QVariant &value)
|
||||
} else {
|
||||
Core::EditorManager::instance()->hideEditorStatusBar(
|
||||
QLatin1String(Constants::MINI_BUFFER));
|
||||
TextEditor::TabSettings ts =
|
||||
TextEditor::TextEditorSettings::instance()->tabSettings();
|
||||
foreach (Core::IEditor *editor, m_editorToHandler.keys())
|
||||
m_editorToHandler[editor]->restoreWidget();
|
||||
m_editorToHandler[editor]->restoreWidget(ts.m_tabSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user