Commit d2bf853c authored by Lukas Holecek's avatar Lukas Holecek Committed by hjk
Browse files

fakevim: Star and hash search with g

Added g* and g# commands to search without \<, \>.

Change-Id: I74f010f2415e4d493be9925ab047a1c06f35d7a9
Reviewed-by: default avatarhjk <>
parent f3575029
......@@ -502,6 +502,19 @@ void FakeVimPlugin::test_vim_search()
data.setText("abc" N "def" N "ab" X "c" N "ghi abc jkl");
KEYS("#", X "abc" N "def" N "abc" N "ghi abc jkl");
// search with g* and g#
data.doCommand("set nows");
data.setText("bc" N "abc" N "abcd" N "bc" N "b");
KEYS("g*", "bc" N "a" X "bc" N "abcd" N "bc" N "b");
KEYS("n", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
KEYS("n", "bc" N "abc" N "abcd" N X "bc" N "b");
KEYS("n", "bc" N "abc" N "abcd" N X "bc" N "b");
KEYS("g#", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
KEYS("n", "bc" N "a" X "bc" N "abcd" N "bc" N "b");
KEYS("N", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
KEYS("3n", "bc" N "abc" N "a" X "bcd" N "bc" N "b");
KEYS("2n", X "bc" N "abc" N "abcd" N "bc" N "b");
data.setText("abc abc abc abc");
KEYS("$?abc<CR>", "abc abc abc " X "abc");
......@@ -2774,7 +2774,10 @@ EventResult FakeVimHandler::Private::handleCommandMode1(const Input &input)
QString needle;
QTextCursor tc = cursor();;
needle = "\\<" + tc.selection().toPlainText() + "\\>";
if (m_gflag)
needle = tc.selection().toPlainText();
needle = "\\<" + tc.selection().toPlainText() + "\\>";
setAnchorAndPosition(tc.position(), tc.anchor());
m_lastSearch = needle;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment