forked from qt-creator/qt-creator
FakeVim: Emulate Vim option "tildeop" ("top")
Change-Id: I61a07f5edc0e2a062ca10cb17f489ac3ce113d9f Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1604,6 +1604,9 @@ void FakeVimPlugin::test_vim_letter_case()
|
|||||||
TestData data;
|
TestData data;
|
||||||
setup(&data);
|
setup(&data);
|
||||||
|
|
||||||
|
// set command ~ not to behave as g~
|
||||||
|
data.doCommand("set notildeop");
|
||||||
|
|
||||||
// upper- and lower-case
|
// upper- and lower-case
|
||||||
data.setText("abc DEF");
|
data.setText("abc DEF");
|
||||||
KEYS("~", "A" X "bc DEF");
|
KEYS("~", "A" X "bc DEF");
|
||||||
@@ -1616,6 +1619,12 @@ void FakeVimPlugin::test_vim_letter_case()
|
|||||||
KEYS(".", "aBC de" X "F" N "ghi");
|
KEYS(".", "aBC de" X "F" N "ghi");
|
||||||
KEYS("h.", "aBC dE" X "f" N "ghi");
|
KEYS("h.", "aBC dE" X "f" N "ghi");
|
||||||
|
|
||||||
|
// set command ~ to behave as g~
|
||||||
|
data.doCommand("set tildeop");
|
||||||
|
|
||||||
|
data.setText("abc DEF" N "ghi JKL");
|
||||||
|
KEYS("ll~j", "ABC def" N "GHI jkl");
|
||||||
|
|
||||||
data.setText("abc DEF");
|
data.setText("abc DEF");
|
||||||
KEYS("lv3l~", "a" X "BC dEF");
|
KEYS("lv3l~", "a" X "BC dEF");
|
||||||
KEYS("v4lU", "a" X "BC DEF");
|
KEYS("v4lU", "a" X "BC DEF");
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ FakeVimSettings *theFakeVimSettings()
|
|||||||
createAction(s, ConfigSmartCase, false, _("SmartCase"), _("scs"));
|
createAction(s, ConfigSmartCase, false, _("SmartCase"), _("scs"));
|
||||||
createAction(s, ConfigIgnoreCase, false, _("IgnoreCase"), _("ic"));
|
createAction(s, ConfigIgnoreCase, false, _("IgnoreCase"), _("ic"));
|
||||||
createAction(s, ConfigWrapScan, true, _("WrapScan"), _("ws"));
|
createAction(s, ConfigWrapScan, true, _("WrapScan"), _("ws"));
|
||||||
|
createAction(s, ConfigTildeOp, false, _("TildeOp"), _("top"));
|
||||||
createAction(s, ConfigShowCmd, true, _("ShowCmd"), _("sc"));
|
createAction(s, ConfigShowCmd, true, _("ShowCmd"), _("sc"));
|
||||||
createAction(s, ConfigScrollOff, 0, _("ScrollOff"), _("so"));
|
createAction(s, ConfigScrollOff, 0, _("ScrollOff"), _("so"));
|
||||||
createAction(s, ConfigBackspace, _("indent,eol,start"), _("ConfigBackspace"), _("bs"));
|
createAction(s, ConfigBackspace, _("indent,eol,start"), _("ConfigBackspace"), _("bs"));
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ enum FakeVimSettingsCode
|
|||||||
ConfigIgnoreCase,
|
ConfigIgnoreCase,
|
||||||
ConfigWrapScan,
|
ConfigWrapScan,
|
||||||
|
|
||||||
|
// command ~ behaves as g~
|
||||||
|
ConfigTildeOp,
|
||||||
|
|
||||||
// indent allow backspacing over autoindent
|
// indent allow backspacing over autoindent
|
||||||
// eol allow backspacing over line breaks (join lines)
|
// eol allow backspacing over line breaks (join lines)
|
||||||
// start allow backspacing over the start of insert; CTRL-W and CTRL-U
|
// start allow backspacing over the start of insert; CTRL-W and CTRL-U
|
||||||
|
|||||||
@@ -3826,7 +3826,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
|
|||||||
else if (input.is('U'))
|
else if (input.is('U'))
|
||||||
m_submode = UpCaseSubMode;
|
m_submode = UpCaseSubMode;
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (m_gflag) {
|
} else if (m_gflag || (input.is('~') && hasConfig(ConfigTildeOp))) {
|
||||||
setUndoPosition();
|
setUndoPosition();
|
||||||
if (atEndOfLine())
|
if (atEndOfLine())
|
||||||
moveLeft();
|
moveLeft();
|
||||||
|
|||||||
Reference in New Issue
Block a user