FakeVim: Emulate Vim option "tildeop" ("top")

Change-Id: I61a07f5edc0e2a062ca10cb17f489ac3ce113d9f
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hluk
2013-03-13 19:01:22 +01:00
committed by hjk
parent 0a86efb8a0
commit f2f0bf5376
4 changed files with 14 additions and 1 deletions

View File

@@ -1604,6 +1604,9 @@ void FakeVimPlugin::test_vim_letter_case()
TestData data;
setup(&data);
// set command ~ not to behave as g~
data.doCommand("set notildeop");
// upper- and lower-case
data.setText("abc DEF");
KEYS("~", "A" X "bc DEF");
@@ -1616,6 +1619,12 @@ void FakeVimPlugin::test_vim_letter_case()
KEYS(".", "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");
KEYS("lv3l~", "a" X "BC dEF");
KEYS("v4lU", "a" X "BC DEF");

View File

@@ -195,6 +195,7 @@ FakeVimSettings *theFakeVimSettings()
createAction(s, ConfigSmartCase, false, _("SmartCase"), _("scs"));
createAction(s, ConfigIgnoreCase, false, _("IgnoreCase"), _("ic"));
createAction(s, ConfigWrapScan, true, _("WrapScan"), _("ws"));
createAction(s, ConfigTildeOp, false, _("TildeOp"), _("top"));
createAction(s, ConfigShowCmd, true, _("ShowCmd"), _("sc"));
createAction(s, ConfigScrollOff, 0, _("ScrollOff"), _("so"));
createAction(s, ConfigBackspace, _("indent,eol,start"), _("ConfigBackspace"), _("bs"));

View File

@@ -78,6 +78,9 @@ enum FakeVimSettingsCode
ConfigIgnoreCase,
ConfigWrapScan,
// command ~ behaves as g~
ConfigTildeOp,
// indent allow backspacing over autoindent
// eol allow backspacing over line breaks (join lines)
// start allow backspacing over the start of insert; CTRL-W and CTRL-U

View File

@@ -3826,7 +3826,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
else if (input.is('U'))
m_submode = UpCaseSubMode;
finishMovement();
} else if (m_gflag) {
} else if (m_gflag || (input.is('~') && hasConfig(ConfigTildeOp))) {
setUndoPosition();
if (atEndOfLine())
moveLeft();