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