forked from qt-creator/qt-creator
fakevim: add option to show positions of marks in the main text editor
This commit is contained in:
@@ -214,6 +214,14 @@ FakeVimSettings *theFakeVimSettings()
|
|||||||
"FakeVim properties..."));
|
"FakeVim properties..."));
|
||||||
instance->insertItem(SettingsDialog, item);
|
instance->insertItem(SettingsDialog, item);
|
||||||
|
|
||||||
|
// Invented here.
|
||||||
|
item = new SavedAction(instance);
|
||||||
|
item->setDefaultValue(false);
|
||||||
|
item->setValue(false);
|
||||||
|
item->setSettingsKey(group, _("ShowMarks"));
|
||||||
|
item->setCheckable(true);
|
||||||
|
instance->insertItem(ConfigShowMarks, item, _("showmarks"), _("sm"));
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ enum FakeVimSettingsCode
|
|||||||
|
|
||||||
// other actions
|
// other actions
|
||||||
SettingsDialog,
|
SettingsDialog,
|
||||||
|
ConfigShowMarks,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FakeVimSettings : public QObject
|
class FakeVimSettings : public QObject
|
||||||
|
|||||||
@@ -103,8 +103,6 @@
|
|||||||
# define UNDO_DEBUG(s)
|
# define UNDO_DEBUG(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define DEBUG_MARKS 1
|
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace FakeVim {
|
namespace FakeVim {
|
||||||
@@ -978,9 +976,10 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
|
|||||||
EDITOR(setTextCursor(m_tc));
|
EDITOR(setTextCursor(m_tc));
|
||||||
m_oldPosition = m_tc.position();
|
m_oldPosition = m_tc.position();
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_MARKS
|
|
||||||
|
if (hasConfig(ConfigShowMarks))
|
||||||
updateSelection();
|
updateSelection();
|
||||||
#endif
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1425,7 +1424,7 @@ void FakeVimHandler::Private::updateSelection()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//qDebug() << "SELECTION: " << selections;
|
//qDebug() << "SELECTION: " << selections;
|
||||||
#ifdef DEBUG_MARKS
|
if (hasConfig(ConfigShowMarks)) {
|
||||||
for (QHashIterator<int, int> it(m_marks); it.hasNext(); ) {
|
for (QHashIterator<int, int> it(m_marks); it.hasNext(); ) {
|
||||||
it.next();
|
it.next();
|
||||||
QTextEdit::ExtraSelection sel;
|
QTextEdit::ExtraSelection sel;
|
||||||
@@ -1437,7 +1436,7 @@ void FakeVimHandler::Private::updateSelection()
|
|||||||
sel.format.setBackground(Qt::green);
|
sel.format.setBackground(Qt::green);
|
||||||
selections.append(sel);
|
selections.append(sel);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
emit q->selectionChanged(selections);
|
emit q->selectionChanged(selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QCheckBox" name="checkBoxShowMarks">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show position of text marks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="checkBoxSmartTab">
|
<widget class="QCheckBox" name="checkBoxSmartTab">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
|
|||||||
m_ui.checkBoxHlSearch);
|
m_ui.checkBoxHlSearch);
|
||||||
m_group.insert(theFakeVimSetting(ConfigShiftWidth),
|
m_group.insert(theFakeVimSetting(ConfigShiftWidth),
|
||||||
m_ui.spinBoxShiftWidth);
|
m_ui.spinBoxShiftWidth);
|
||||||
|
m_group.insert(theFakeVimSetting(ConfigShowMarks),
|
||||||
|
m_ui.checkBoxShowMarks);
|
||||||
|
|
||||||
m_group.insert(theFakeVimSetting(ConfigSmartTab),
|
m_group.insert(theFakeVimSetting(ConfigSmartTab),
|
||||||
m_ui.checkBoxSmartTab);
|
m_ui.checkBoxSmartTab);
|
||||||
@@ -198,8 +200,8 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
|
|||||||
QTextStream(&m_searchKeywords)
|
QTextStream(&m_searchKeywords)
|
||||||
<< ' ' << m_ui.checkBoxAutoIndent->text()
|
<< ' ' << m_ui.checkBoxAutoIndent->text()
|
||||||
<< ' ' << m_ui.checkBoxExpandTab->text()
|
<< ' ' << m_ui.checkBoxExpandTab->text()
|
||||||
|
<< ' ' << m_ui.checkBoxShowMarks->text()
|
||||||
<< ' ' << m_ui.checkBoxSmartIndent->text()
|
<< ' ' << m_ui.checkBoxSmartIndent->text()
|
||||||
<< ' ' << m_ui.checkBoxExpandTab->text()
|
|
||||||
<< ' ' << m_ui.checkBoxHlSearch->text()
|
<< ' ' << m_ui.checkBoxHlSearch->text()
|
||||||
<< ' ' << m_ui.checkBoxIncSearch->text()
|
<< ' ' << m_ui.checkBoxIncSearch->text()
|
||||||
<< ' ' << m_ui.checkBoxSmartTab->text()
|
<< ' ' << m_ui.checkBoxSmartTab->text()
|
||||||
|
|||||||
Reference in New Issue
Block a user