mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-10 15:40:37 +02:00
Add mode, submode and caret colour checks to doTest method
This commit is contained in:
parent
7ed7ac817d
commit
6fe6e83cb9
test/org/jetbrains/plugins/ideavim
VimTestCase.java
action
ChangeActionTest.javaChangeNumberActionTest.javaMotionActionTest.java
change
motion
ex/handler
extension/surround
@ -215,9 +215,16 @@ public abstract class VimTestCase extends UsefulTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void doTest(final List<KeyStroke> keys, String before, String after) {
|
||||
public void doTest(final List<KeyStroke> keys,
|
||||
String before,
|
||||
String after,
|
||||
CommandState.Mode modeAfter,
|
||||
CommandState.SubMode subModeAfter) {
|
||||
configureByText(before);
|
||||
typeText(keys);
|
||||
myFixture.checkResult(after);
|
||||
assertCaretsColour();
|
||||
assertMode(modeAfter);
|
||||
assertSubMode(subModeAfter);
|
||||
}
|
||||
}
|
||||
|
@ -31,12 +31,14 @@ import static com.maddyhome.idea.vim.helper.StringHelper.stringToKeys;
|
||||
public class ChangeActionTest extends VimTestCase {
|
||||
// |c| |t|
|
||||
public void testChangeLinesTillForwards() {
|
||||
doTest(parseKeys("ct(", "for "), "<caret>if (condition) {\n" + "}\n", "for (condition) {\n" + "}\n");
|
||||
doTest(parseKeys("ct(", "for "), "<caret>if (condition) {\n" + "}\n", "for (condition) {\n" + "}\n",
|
||||
CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-276 |c| |T|
|
||||
public void testChangeLinesTillBackwards() {
|
||||
doTest(parseKeys("cT("), "if (condition) {<caret>\n" + "}\n", "if (\n" + "}\n");
|
||||
doTest(parseKeys("cT("), "if (condition) {<caret>\n" + "}\n", "if (\n" + "}\n", CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-276 |c| |F|
|
||||
@ -44,34 +46,30 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("cFc"),
|
||||
"if (condition) {<caret>\n" +
|
||||
"}\n",
|
||||
"if (\n" +
|
||||
"}\n");
|
||||
"if (\n" + "}\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-620 |i_CTRL-O|
|
||||
public void testInsertSingleCommandAndInserting() {
|
||||
doTest(parseKeys("i", "<C-O>", "a", "123", "<Esc>", "x"),
|
||||
"abc<caret>d\n",
|
||||
"abcd12\n");
|
||||
doTest(parseKeys("i", "<C-O>", "a", "123", "<Esc>", "x"), "abc<caret>d\n", "abcd12\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-620 |i_CTRL-O|
|
||||
public void testInsertSingleCommandAndNewLineInserting() {
|
||||
doTest(parseKeys("i", "<C-O>", "o", "123", "<Esc>", "x"),
|
||||
"abc<caret>d\n",
|
||||
"abcd\n12\n");
|
||||
"abc<caret>d\n", "abcd\n12\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-311 |i_CTRL-O|
|
||||
public void testInsertSingleCommand() {
|
||||
doTest(parseKeys("i", "def", "<C-O>", "d2h", "x"),
|
||||
"abc<caret>.\n",
|
||||
"abcdx.\n");
|
||||
"abc<caret>.\n", "abcdx.\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-321 |d| |count|
|
||||
public void testDeleteEmptyRange() {
|
||||
doTest(parseKeys("d0"), "<caret>hello\n", "hello\n");
|
||||
doTest(parseKeys("d0"), "<caret>hello\n", "hello\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-112 |i| |i_CTRL-W|
|
||||
@ -84,38 +82,44 @@ public class ChangeActionTest extends VimTestCase {
|
||||
|
||||
// VIM-157 |~|
|
||||
public void testToggleCharCase() {
|
||||
doTest(parseKeys("~~"), "<caret>hello world\n", "HEllo world\n");
|
||||
doTest(parseKeys("~~"), "<caret>hello world\n", "HEllo world\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-157 |~|
|
||||
public void testToggleCharCaseLineEnd() {
|
||||
doTest(parseKeys("~~"),
|
||||
"hello wor<caret>ld\n",
|
||||
"hello worLD\n");
|
||||
"hello wor<caret>ld\n", "hello worLD\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testToggleCaseMotion() {
|
||||
doTest(parseKeys("g~w"), "<caret>FooBar Baz\n", "fOObAR Baz\n");
|
||||
doTest(parseKeys("g~w"), "<caret>FooBar Baz\n", "fOObAR Baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testChangeUpperCase() {
|
||||
doTest(parseKeys("gUw"), "<caret>FooBar Baz\n", "FOOBAR Baz\n");
|
||||
doTest(parseKeys("gUw"), "<caret>FooBar Baz\n", "FOOBAR Baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testChangeLowerCase() {
|
||||
doTest(parseKeys("guw"), "<caret>FooBar Baz\n", "foobar Baz\n");
|
||||
doTest(parseKeys("guw"), "<caret>FooBar Baz\n", "foobar Baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testToggleCaseVisual() {
|
||||
doTest(parseKeys("ve~"), "<caret>FooBar Baz\n", "fOObAR Baz\n");
|
||||
doTest(parseKeys("ve~"), "<caret>FooBar Baz\n", "fOObAR Baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testChangeUpperCaseVisual() {
|
||||
doTest(parseKeys("veU"), "<caret>FooBar Baz\n", "FOOBAR Baz\n");
|
||||
doTest(parseKeys("veU"), "<caret>FooBar Baz\n", "FOOBAR Baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testChangeLowerCaseVisual() {
|
||||
doTest(parseKeys("veu"), "<caret>FooBar Baz\n", "foobar Baz\n");
|
||||
doTest(parseKeys("veu"), "<caret>FooBar Baz\n", "foobar Baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-85 |i| |gi| |gg|
|
||||
@ -123,8 +127,8 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("i", "hello", "<Esc>", "gg", "gi", " world! "), "one\n" +
|
||||
"two <caret>three\n" +
|
||||
"four\n", "one\n" +
|
||||
"two hello world! three\n" +
|
||||
"four\n");
|
||||
"two hello world! three\n" + "four\n",
|
||||
CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-312 |d| |w|
|
||||
@ -132,14 +136,14 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("dw"),
|
||||
"one\n" +
|
||||
"<caret>two\n",
|
||||
"one\n" +
|
||||
"\n");
|
||||
"one\n" + "\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
assertOffset(4);
|
||||
}
|
||||
|
||||
// |d| |w|
|
||||
public void testDeleteLastWordBeforeEOL() {
|
||||
doTest(parseKeys("dw"), "one <caret>two\n" + "three\n", "one \n" + "three\n");
|
||||
doTest(parseKeys("dw"), "one <caret>two\n" + "three\n", "one \n" + "three\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-105 |d| |w|
|
||||
@ -147,8 +151,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("dw"), "one <caret>two\n" +
|
||||
"\n" +
|
||||
"three\n", "one \n" +
|
||||
"\n" +
|
||||
"three\n");
|
||||
"\n" + "three\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-105 |d| |w|
|
||||
@ -156,39 +159,42 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("dw"),
|
||||
"one <caret>two\n" +
|
||||
" three\n",
|
||||
"one \n" +
|
||||
" three\n");
|
||||
"one \n" + " three\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
assertOffset(3);
|
||||
}
|
||||
|
||||
// VIM-105 |d| |w| |count|
|
||||
public void testDeleteTwoWordsOnTwoLines() {
|
||||
doTest(parseKeys("d2w"), "one <caret>two\n" + "three four\n", "one four\n");
|
||||
doTest(parseKeys("d2w"), "one <caret>two\n" + "three four\n", "one four\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-200 |c| |w|
|
||||
public void testChangeWordAtLastChar() {
|
||||
doTest(parseKeys("cw"), "on<caret>e two three\n", "on<caret> two three\n");
|
||||
doTest(parseKeys("cw"), "on<caret>e two three\n", "on<caret> two three\n", CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-1380 |c| |w| |count|
|
||||
public void testChangeTwoWordsAtLastChar() {
|
||||
doTest(parseKeys("c2w"), "on<caret>e two three\n", "on<caret> three\n");
|
||||
doTest(parseKeys("c2w"), "on<caret>e two three\n", "on<caret> three\n", CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-1380 |d| |w| |count|
|
||||
public void testDeleteTwoWordsAtLastChar() {
|
||||
doTest(parseKeys("d2w"), "on<caret>e two three\n", "on<caret>three\n");
|
||||
doTest(parseKeys("d2w"), "on<caret>e two three\n", "on<caret>three\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-515 |c| |W|
|
||||
public void testChangeBigWordWithPunctuationAndAlpha() {
|
||||
doTest(parseKeys("cW"), "foo<caret>(bar baz\n", "foo baz\n");
|
||||
doTest(parseKeys("cW"), "foo<caret>(bar baz\n", "foo baz\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-300 |c| |w|
|
||||
public void testChangeWordTwoWordsWithoutWhitespace() {
|
||||
doTest(parseKeys("cw"), "<caret>$value\n", "value\n");
|
||||
doTest(parseKeys("cw"), "<caret>$value\n", "value\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-296 |cc|
|
||||
@ -196,8 +202,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("cc"),
|
||||
"foo\n" +
|
||||
"<caret>bar\n",
|
||||
"foo\n" +
|
||||
"\n");
|
||||
"foo\n" + "\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
assertOffset(4);
|
||||
}
|
||||
|
||||
@ -206,18 +211,19 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("ccbaz"),
|
||||
"<caret>foo\n" +
|
||||
"bar\n",
|
||||
"baz\n" +
|
||||
"bar\n");
|
||||
"baz\n" + "bar\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-394 |d| |v_aw|
|
||||
public void testDeleteIndentedWordBeforePunctuation() {
|
||||
doTest(parseKeys("daw"), "foo\n" + " <caret>bar, baz\n", "foo\n" + " , baz\n");
|
||||
doTest(parseKeys("daw"), "foo\n" + " <caret>bar, baz\n", "foo\n" + " , baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |d| |v_aw|
|
||||
public void testDeleteLastWordAfterPunctuation() {
|
||||
doTest(parseKeys("daw"), "foo(<caret>bar\n" + "baz\n", "foo(\n" + "baz\n");
|
||||
doTest(parseKeys("daw"), "foo(<caret>bar\n" + "baz\n", "foo(\n" + "baz\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-244 |d| |l|
|
||||
@ -225,74 +231,68 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("dl"),
|
||||
"fo<caret>o\n" +
|
||||
"bar\n",
|
||||
"fo\n" +
|
||||
"bar\n");
|
||||
"fo\n" + "bar\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
assertOffset(1);
|
||||
}
|
||||
|
||||
// VIM-393 |d|
|
||||
public void testDeleteBadArgument() {
|
||||
doTest(parseKeys("dD", "dd"), "one\n" + "two\n", "two\n");
|
||||
doTest(parseKeys("dD", "dd"), "one\n" + "two\n", "two\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-262 |i_CTRL-R|
|
||||
public void testInsertFromRegister() {
|
||||
VimPlugin.getRegister().setKeys('a', stringToKeys("World"));
|
||||
doTest(parseKeys("A", ", ", "<C-R>", "a", "!"), "<caret>Hello\n", "Hello, World!\n");
|
||||
doTest(parseKeys("A", ", ", "<C-R>", "a", "!"), "<caret>Hello\n", "Hello, World!\n", CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-421 |c| |w|
|
||||
public void testChangeLastWordInLine() {
|
||||
doTest(parseKeys("cw"),
|
||||
"ab.<caret>cd\n",
|
||||
"ab.<caret>\n");
|
||||
"ab.<caret>cd\n", "ab.<caret>\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-421 |c| |iw|
|
||||
public void testChangeLastInnerWordInLine() {
|
||||
doTest(parseKeys("c", "iw", "baz"),
|
||||
"foo bar bo<caret>o\n",
|
||||
"foo bar baz\n");
|
||||
"foo bar bo<caret>o\n", "foo bar baz\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-421 |c| |w|
|
||||
public void testChangeLastCharInLine() {
|
||||
doTest(parseKeys("cw"), "fo<caret>o\n", "fo<caret>\n");
|
||||
doTest(parseKeys("cw"), "fo<caret>o\n", "fo<caret>\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-404 |O|
|
||||
public void testInsertNewLineAboveFirstLine() {
|
||||
doTest(parseKeys("O", "bar"),
|
||||
"fo<caret>o\n",
|
||||
"bar\nfoo\n");
|
||||
"fo<caret>o\n", "bar\nfoo\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-472 |v|
|
||||
public void testVisualSelectionRightMargin() {
|
||||
doTest(parseKeys("v", "k$d"),
|
||||
"foo\n<caret>bar\n",
|
||||
"fooar\n");
|
||||
"foo\n<caret>bar\n", "fooar\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-569 |a| |i_CTRL-W|
|
||||
public void testDeletePreviousWordDotEOL() {
|
||||
doTest(parseKeys("a", "<C-W>"),
|
||||
"this is a sentence<caret>.\n",
|
||||
"this is a sentence<caret>\n");
|
||||
"this is a sentence<caret>.\n", "this is a sentence<caret>\n", CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-569 |a| |i_CTRL-W|
|
||||
public void testDeletePreviousWordLastAfterWhitespace() {
|
||||
doTest(parseKeys("A", "<C-W>"),
|
||||
"<caret>this is a sentence\n",
|
||||
"this is a <caret>\n");
|
||||
"<caret>this is a sentence\n", "this is a <caret>\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-513 |A| |i_CTRL-W|
|
||||
public void testDeletePreviousWordEOL() {
|
||||
doTest(parseKeys("A", "<C-W>"),
|
||||
"<caret>$variable\n",
|
||||
"$<caret>\n");
|
||||
"<caret>$variable\n", "$<caret>\n", CommandState.Mode.INSERT, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-632 |CTRL-V| |v_d|
|
||||
@ -304,8 +304,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
"quux\n",
|
||||
"<caret>o\n" +
|
||||
"r\n" +
|
||||
"z\n" +
|
||||
"quux\n");
|
||||
"z\n" + "quux\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteCharVisualBlock() {
|
||||
@ -316,8 +315,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
"quux\n",
|
||||
"<caret>o\n" +
|
||||
"r\n" +
|
||||
"z\n" +
|
||||
"quux\n");
|
||||
"z\n" + "quux\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteJoinLinesSpaces() {
|
||||
@ -326,8 +324,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
" b 2\n" +
|
||||
" c 3\n" +
|
||||
"quux\n",
|
||||
" a 1 b 2 c 3\n" +
|
||||
"quux\n");
|
||||
" a 1 b 2 c 3\n" + "quux\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteJoinLines() {
|
||||
@ -336,23 +333,20 @@ public class ChangeActionTest extends VimTestCase {
|
||||
" b 2\n" +
|
||||
" c 3\n" +
|
||||
"quux\n",
|
||||
" a 1 b 2 c 3\n" +
|
||||
"quux\n");
|
||||
" a 1 b 2 c 3\n" + "quux\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteJoinLinesWithTrailingSpaceThenEmptyLine() {
|
||||
doTest(parseKeys("3J"),
|
||||
"foo \n" +
|
||||
"\n" +
|
||||
"bar",
|
||||
"foo bar");
|
||||
"bar", "foo bar", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteJoinLinesWithTwoTrailingSpaces() {
|
||||
doTest(parseKeys("J"),
|
||||
"foo \n" +
|
||||
"bar",
|
||||
"foo bar");
|
||||
"bar", "foo bar", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteJoinVisualLinesSpaces() {
|
||||
@ -361,8 +355,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
" b 2\n" +
|
||||
" c 3\n" +
|
||||
"quux\n",
|
||||
" a 1 b 2 c 3\n" +
|
||||
"quux\n");
|
||||
" a 1 b 2 c 3\n" + "quux\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteJoinVisualLines() {
|
||||
@ -371,20 +364,17 @@ public class ChangeActionTest extends VimTestCase {
|
||||
" b 2\n" +
|
||||
" c 3\n" +
|
||||
"quux\n",
|
||||
" a 1 b 2 c 3\n" +
|
||||
"quux\n");
|
||||
" a 1 b 2 c 3\n" + "quux\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteCharVisualBlockOnLastCharOfLine() {
|
||||
doTest(parseKeys("<C-V>", "x"),
|
||||
"fo<caret>o\n",
|
||||
"fo\n");
|
||||
"fo<caret>o\n", "fo\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteCharVisualBlockOnEmptyLinesDoesntDeleteAnything() {
|
||||
doTest(parseKeys("<C-V>", "j", "x"),
|
||||
"\n\n",
|
||||
"\n\n");
|
||||
"\n\n", "\n\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-781 |CTRL-V| |j|
|
||||
@ -394,8 +384,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
"\n" +
|
||||
"bar\n",
|
||||
"fo\n" +
|
||||
"\n" +
|
||||
"br\n");
|
||||
"\n" + "br\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-781 |CTRL-V| |j|
|
||||
@ -405,8 +394,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
"x\n" +
|
||||
"bar\n",
|
||||
"fo\n" +
|
||||
"x\n" +
|
||||
"br\n");
|
||||
"x\n" + "br\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-845 |CTRL-V| |x|
|
||||
@ -421,22 +409,19 @@ public class ChangeActionTest extends VimTestCase {
|
||||
// |r|
|
||||
public void testReplaceOneChar() {
|
||||
doTest(parseKeys("rx"),
|
||||
"b<caret>ar\n",
|
||||
"b<caret>xr\n");
|
||||
"b<caret>ar\n", "b<caret>xr\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |r|
|
||||
public void testReplaceMultipleCharsWithCount() {
|
||||
doTest(parseKeys("3rX"),
|
||||
"fo<caret>obar\n",
|
||||
"fo<caret>XXXr\n");
|
||||
"fo<caret>obar\n", "fo<caret>XXXr\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |r|
|
||||
public void testReplaceMultipleCharsWithCountPastEndOfLine() {
|
||||
doTest(parseKeys("6rX"),
|
||||
"fo<caret>obar\n",
|
||||
"fo<caret>obar\n");
|
||||
"fo<caret>obar\n", "fo<caret>obar\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |r|
|
||||
@ -444,8 +429,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("v", "ll", "j", "rZ"),
|
||||
"fo<caret>obar\n" +
|
||||
"foobaz\n",
|
||||
"foZZZZ\n" +
|
||||
"ZZZZZz\n");
|
||||
"foZZZZ\n" + "ZZZZZz\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |r|
|
||||
@ -454,8 +438,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
" fo<caret>obar\n" +
|
||||
"foobaz\n",
|
||||
" fo\n" +
|
||||
" bar\n" +
|
||||
"foobaz\n");
|
||||
" bar\n" + "foobaz\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |r|
|
||||
@ -464,22 +447,19 @@ public class ChangeActionTest extends VimTestCase {
|
||||
" fo<caret>obar\n" +
|
||||
"foobaz\n",
|
||||
" fo\n" +
|
||||
" r\n" +
|
||||
"foobaz\n");
|
||||
" r\n" + "foobaz\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |s|
|
||||
public void testReplaceOneCharWithText() {
|
||||
doTest(parseKeys("sxy<Esc>"),
|
||||
"b<caret>ar\n",
|
||||
"bx<caret>yr\n");
|
||||
"b<caret>ar\n", "bx<caret>yr\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |s|
|
||||
public void testReplaceMultipleCharsWithTextWithCount() {
|
||||
doTest(parseKeys("3sxy<Esc>"),
|
||||
"fo<caret>obar\n",
|
||||
"fox<caret>yr\n");
|
||||
"fo<caret>obar\n", "fox<caret>yr\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |s|
|
||||
@ -487,29 +467,26 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("99sxyz<Esc>"),
|
||||
"foo<caret>bar\n" +
|
||||
"biff\n",
|
||||
"fooxy<caret>z\n" +
|
||||
"biff\n");
|
||||
"fooxy<caret>z\n" + "biff\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |R|
|
||||
public void testReplaceMode() {
|
||||
doTest(parseKeys("Rbaz<Esc>"),
|
||||
"foo<caret>bar\n",
|
||||
"fooba<caret>z\n");
|
||||
"foo<caret>bar\n", "fooba<caret>z\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |R| |i_<Insert>|
|
||||
public void testReplaceModeSwitchToInsertModeAndBack() {
|
||||
doTest(parseKeys("RXXX<Ins>YYY<Ins>ZZZ<Esc>"),
|
||||
"aaa<caret>bbbcccddd\n",
|
||||
"aaaXXXYYYZZ<caret>Zddd\n");
|
||||
"aaa<caret>bbbcccddd\n", "aaaXXXYYYZZ<caret>Zddd\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |i| |i_<Insert>|
|
||||
public void testInsertModeSwitchToReplaceModeAndBack() {
|
||||
doTest(parseKeys("iXXX<Ins>YYY<Ins>ZZZ<Esc>"),
|
||||
"aaa<caret>bbbcccddd\n",
|
||||
"aaaXXXYYYZZ<caret>Zcccddd\n");
|
||||
"aaa<caret>bbbcccddd\n", "aaaXXXYYYZZ<caret>Zcccddd\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-511 |.|
|
||||
@ -517,8 +494,7 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("ce", "foo", "<BS><BS><BS>", "foo", "<Esc>", "j0", "."),
|
||||
"<caret>foo baz\n" +
|
||||
"baz quux\n",
|
||||
"foo baz\n" +
|
||||
"fo<caret>o quux\n");
|
||||
"foo baz\n" + "fo<caret>o quux\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-511 |.|
|
||||
@ -636,7 +612,8 @@ public class ChangeActionTest extends VimTestCase {
|
||||
}
|
||||
|
||||
public void testRepeatChangeWordDoesNotBreakNextRepeatFind() {
|
||||
doTest(parseKeys("fXcfYPATATA<Esc>fX.;."), "<caret>aaaaXBBBBYaaaaaaaXBBBBYaaaaaaXBBBBYaaaaaaaa\n", "aaaaPATATAaaaaaaaPATATAaaaaaaPATATAaaaaaaaa\n");
|
||||
doTest(parseKeys("fXcfYPATATA<Esc>fX.;."), "<caret>aaaaXBBBBYaaaaaaaXBBBBYaaaaaaXBBBBYaaaaaaaa\n",
|
||||
"aaaaPATATAaaaaaaaPATATAaaaaaaPATATAaaaaaaaa\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testRepeatReplace() {
|
||||
@ -652,47 +629,47 @@ public class ChangeActionTest extends VimTestCase {
|
||||
doTest(parseKeys("ld^j"),
|
||||
"lorem <caret>ipsum dolor sit amet\n" +
|
||||
"lorem ipsum dolor sit amet",
|
||||
"psum dolor sit amet\n" +
|
||||
"<caret>lorem ipsum dolor sit amet");
|
||||
"psum dolor sit amet\n" + "<caret>lorem ipsum dolor sit amet", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void ignoredDownMovementAfterDeletionToPrevWord() {
|
||||
doTest(parseKeys("ldbj"),
|
||||
"lorem<caret> ipsum dolor sit amet\n" +
|
||||
"lorem ipsum dolor sit amet",
|
||||
"ipsum dolor sit amet\n" +
|
||||
"<caret>lorem ipsum dolor sit amet");
|
||||
"ipsum dolor sit amet\n" + "<caret>lorem ipsum dolor sit amet", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void ignoredDownMovementAfterChangeToPrevWord() {
|
||||
doTest(parseKeys("lcb<Esc>j"),
|
||||
"lorem<caret> ipsum dolor sit amet\n" +
|
||||
"lorem ipsum dolor sit amet",
|
||||
"ipsum dolor sit amet\n" +
|
||||
"<caret>lorem ipsum dolor sit amet");
|
||||
"ipsum dolor sit amet\n" + "<caret>lorem ipsum dolor sit amet", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void ignoredDownMovementAfterChangeToLineStart() {
|
||||
doTest(parseKeys("lc^<Esc>j"),
|
||||
"lorem<caret> ipsum dolor sit amet\n" +
|
||||
"lorem ipsum dolor sit amet",
|
||||
"ipsum dolor sit amet\n" +
|
||||
"<caret>lorem ipsum dolor sit amet");
|
||||
"ipsum dolor sit amet\n" + "<caret>lorem ipsum dolor sit amet", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void ignoredUpMovementAfterDeletionToStart() {
|
||||
doTest(parseKeys("ld^k"),
|
||||
"lorem ipsum dolor sit amet\n" +
|
||||
"lorem <caret>ipsum dolor sit amet",
|
||||
"<caret>lorem ipsum dolor sit amet\n" +
|
||||
"psum dolor sit amet");
|
||||
"<caret>lorem ipsum dolor sit amet\n" + "psum dolor sit amet", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void ignoredUpMovementAfterChangeToPrevWord() {
|
||||
doTest(parseKeys("lcb<Esc>k"),
|
||||
"lorem ipsum dolor sit amet\n" +
|
||||
"lorem<caret> ipsum dolor sit amet",
|
||||
"<caret>lorem ipsum dolor sit amet\n" +
|
||||
"ipsum dolor sit amet");
|
||||
"<caret>lorem ipsum dolor sit amet\n" + "ipsum dolor sit amet", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action;
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase;
|
||||
|
||||
import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys;
|
||||
@ -27,114 +28,122 @@ import static com.maddyhome.idea.vim.helper.StringHelper.parseKeys;
|
||||
*/
|
||||
public class ChangeNumberActionTest extends VimTestCase {
|
||||
public void testIncrementDecimalZero() {
|
||||
doTest(parseKeys("<C-A>"), "0", "1");
|
||||
doTest(parseKeys("<C-A>"), "0", "1", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementHexZero() {
|
||||
doTest(parseKeys("<C-A>"), "0x0", "0x1");
|
||||
doTest(parseKeys("<C-A>"), "0x0", "0x1", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementZero() {
|
||||
doTest(parseKeys("<C-X>"), "0", "-1");
|
||||
doTest(parseKeys("<C-X>"), "0", "-1", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementDecimal() {
|
||||
doTest(parseKeys("<C-A>"), "199", "200");
|
||||
doTest(parseKeys("<C-A>"), "199", "200", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementDecimal() {
|
||||
doTest(parseKeys("<C-X>"), "1000", "999");
|
||||
doTest(parseKeys("<C-X>"), "1000", "999", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementOctal() {
|
||||
doTest(parseKeys("<C-A>"), "0477", "0500");
|
||||
doTest(parseKeys("<C-A>"), "0477", "0500", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementOctal() {
|
||||
doTest(parseKeys("<C-X>"), "010", "007");
|
||||
doTest(parseKeys("<C-X>"), "010", "007", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementHex() {
|
||||
doTest(parseKeys("<C-A>"), "0xff", "0x100");
|
||||
doTest(parseKeys("<C-A>"), "0xff", "0x100", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementHex() {
|
||||
doTest(parseKeys("<C-X>"), "0xa100", "0xa0ff");
|
||||
doTest(parseKeys("<C-X>"), "0xa100", "0xa0ff", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementNegativeDecimal() {
|
||||
doTest(parseKeys("<C-A>"), "-199", "-198");
|
||||
doTest(parseKeys("<C-A>"), "-199", "-198", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementNegativeDecimal() {
|
||||
doTest(parseKeys("<C-X>"), "-1000", "-1001");
|
||||
doTest(parseKeys("<C-X>"), "-1000", "-1001", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementNegativeOctal() {
|
||||
doTest(parseKeys("<C-A>"), "-0477", "-0500");
|
||||
doTest(parseKeys("<C-A>"), "-0477", "-0500", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementNegativeOctal() {
|
||||
doTest(parseKeys("<C-X>"), "-010", "-007");
|
||||
doTest(parseKeys("<C-X>"), "-010", "-007", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementNegativeHex() {
|
||||
doTest(parseKeys("<C-A>"), "-0xff", "-0x100");
|
||||
doTest(parseKeys("<C-A>"), "-0xff", "-0x100", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementNegativeHex() {
|
||||
doTest(parseKeys("<C-X>"), "-0xa100", "-0xa0ff");
|
||||
doTest(parseKeys("<C-X>"), "-0xa100", "-0xa0ff", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementWithCount() {
|
||||
doTest(parseKeys("123<C-A>"), "456", "579");
|
||||
doTest(parseKeys("123<C-A>"), "456", "579", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDecrementWithCount() {
|
||||
doTest(parseKeys("200<C-X>"), "100", "-100");
|
||||
doTest(parseKeys("200<C-X>"), "100", "-100", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementAlphaWithoutNumberFormatAlpha() {
|
||||
doTest(parseKeys("<C-A>"), "foo", "foo");
|
||||
doTest(parseKeys("<C-A>"), "foo", "foo", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementAlphaWithNumberFormatAlpha() {
|
||||
doTest(parseKeys(":set nf=alpha<Enter>", "<C-A>"), "foo", "goo");
|
||||
doTest(parseKeys(":set nf=alpha<Enter>", "<C-A>"), "foo", "goo", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementZWithNumberFormatAlpha() {
|
||||
doTest(parseKeys(":set nf=alpha<Enter>", "<C-A>"), "zzz", "zzz");
|
||||
doTest(parseKeys(":set nf=alpha<Enter>", "<C-A>"), "zzz", "zzz", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementXInHexNumberWithNumberFormatAlphaButNotHex() {
|
||||
doTest(parseKeys(":set nf=alpha<Enter>", "<C-A>"), "0<caret>x1", "0y1");
|
||||
doTest(parseKeys(":set nf=alpha<Enter>", "<C-A>"), "0<caret>x1", "0y1", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementXInHexNumberWithNumberFormatHexAlpha() {
|
||||
doTest(parseKeys(":set nf=alpha,hex<Enter>", "<C-A>"), "0<caret>x1", "0x2");
|
||||
doTest(parseKeys(":set nf=alpha,hex<Enter>", "<C-A>"), "0<caret>x1", "0x2", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementHexNumberWithoutNumberFormatHex() {
|
||||
doTest(parseKeys(":set nf=octal<Enter>", "<C-A>"), "0x42", "1x42");
|
||||
doTest(parseKeys(":set nf=octal<Enter>", "<C-A>"), "0x42", "1x42", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementOctalNumberWithoutNumberFormatOctal() {
|
||||
doTest(parseKeys(":set nf=hex<Enter>", "<C-A>"), "077", "078");
|
||||
doTest(parseKeys(":set nf=hex<Enter>", "<C-A>"), "077", "078", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementNegativeOctalNumberWithoutNumberFormatOctal() {
|
||||
doTest(parseKeys(":set nf=hex<Enter>", "<C-A>"), "-077", "-076");
|
||||
doTest(parseKeys(":set nf=hex<Enter>", "<C-A>"), "-077", "-076", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementHexPreservesCaseOfX() {
|
||||
doTest(parseKeys("<C-A>"), "0X88", "0X89");
|
||||
doTest(parseKeys("<C-A>"), "0X88", "0X89", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementHexTakesCaseFromLastLetter() {
|
||||
doTest(parseKeys("<C-A>"), "0xaB0", "0xAB1");
|
||||
doTest(parseKeys("<C-A>"), "0xaB0", "0xAB1", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testIncrementLocatesNumberOnTheSameLine() {
|
||||
doTest(parseKeys("<C-A>"), "foo ->* bar 123\n", "foo ->* bar 12<caret>4\n");
|
||||
doTest(parseKeys("<C-A>"), "foo ->* bar 123\n", "foo ->* bar 12<caret>4\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import com.intellij.json.JsonFileType;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.VisualPosition;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase;
|
||||
|
||||
import static com.maddyhome.idea.vim.command.CommandState.Mode.COMMAND;
|
||||
@ -1021,8 +1022,7 @@ public class MotionActionTest extends VimTestCase {
|
||||
"four \n",
|
||||
"one \n" +
|
||||
"two \n" +
|
||||
"thre<caret>e \n" +
|
||||
"four \n");
|
||||
"thre<caret>e \n" + "four \n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// |3g_|
|
||||
@ -1034,8 +1034,7 @@ public class MotionActionTest extends VimTestCase {
|
||||
"four \n",
|
||||
"one \n" +
|
||||
"two \n" +
|
||||
"thre<caret>e \n" +
|
||||
"four \n");
|
||||
"thre<caret>e \n" + "four \n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-646 |gv|
|
||||
|
@ -40,7 +40,7 @@ class ChangeVisualActionTest : VimTestCase() {
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent()
|
||||
doTest(keys, before, after)
|
||||
doTest(keys, before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test change visual action`() {
|
||||
@ -58,7 +58,9 @@ class ChangeVisualActionTest : VimTestCase() {
|
||||
"bar bar\n",
|
||||
("fo_quux_foo\n" +
|
||||
"\n" +
|
||||
"ba_quux_bar\n"))
|
||||
"ba_quux_bar\n"),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
|
||||
@ -70,6 +72,8 @@ class ChangeVisualActionTest : VimTestCase() {
|
||||
"bar bar\n",
|
||||
("fo_quux_foo\n" +
|
||||
"x\n" +
|
||||
"ba_quux_bar\n"))
|
||||
"ba_quux_bar\n"),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.change.change.number
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -36,7 +37,9 @@ class ChangeVisualNumberAvalancheDecActionTest : VimTestCase() {
|
||||
${c}number 1
|
||||
number 1
|
||||
number 1
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test dec visual avalanche multiple times`() {
|
||||
@ -50,6 +53,8 @@ class ChangeVisualNumberAvalancheDecActionTest : VimTestCase() {
|
||||
${c}number 1
|
||||
number 1
|
||||
number 1
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.change.change.number
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -36,7 +37,9 @@ class ChangeVisualNumberAvalancheIncActionTest : VimTestCase() {
|
||||
${c}number 2
|
||||
number 3
|
||||
number 4
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test inc visual avalanche multiple times`() {
|
||||
@ -50,6 +53,8 @@ class ChangeVisualNumberAvalancheIncActionTest : VimTestCase() {
|
||||
${c}number 3
|
||||
number 5
|
||||
number 7
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.change.change.number
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -28,19 +29,25 @@ class ChangeVisualNumberDecActionTest : VimTestCase() {
|
||||
fun `test dec visual full number`() {
|
||||
doTest(parseKeys("V<C-X>"),
|
||||
"${c}12345",
|
||||
"${c}12344")
|
||||
"${c}12344",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test dec visual multiple numbers`() {
|
||||
doTest(parseKeys("v10w<C-X>"),
|
||||
"11 <- should not be decremented |${c}11| should not be decremented -> 12",
|
||||
"11 <- should not be decremented |${c}10| should not be decremented -> 12")
|
||||
"11 <- should not be decremented |${c}10| should not be decremented -> 12",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test dec visual part of number`() {
|
||||
doTest(parseKeys("v4l<C-X>"),
|
||||
"11111${c}33333111111",
|
||||
"11111${c}33332111111")
|
||||
"11111${c}33332111111",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test dec visual multiple lines`() {
|
||||
@ -64,7 +71,9 @@ class ChangeVisualNumberDecActionTest : VimTestCase() {
|
||||
no dec 1
|
||||
no dec 1
|
||||
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE
|
||||
)
|
||||
}
|
||||
|
||||
@ -79,13 +88,17 @@ class ChangeVisualNumberDecActionTest : VimTestCase() {
|
||||
${c}999
|
||||
999
|
||||
999
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test dec visual multiple numbers on line`() {
|
||||
doTest(parseKeys("V<C-X>"),
|
||||
"1 should$c not be decremented -> 2",
|
||||
"${c}0 should not be decremented -> 2")
|
||||
"${c}0 should not be decremented -> 2",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test change number dec visual action`() {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.change.change.number
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -28,19 +29,25 @@ class ChangeVisualNumberIncActionTest : VimTestCase() {
|
||||
fun `test inc visual full number`() {
|
||||
doTest(parseKeys("V<C-A>"),
|
||||
"${c}12345",
|
||||
"${c}12346")
|
||||
"${c}12346",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test inc visual multiple numbers`() {
|
||||
doTest(parseKeys("v10w<C-A>"),
|
||||
"11 <- should not be incremented |${c}11| should not be incremented -> 12",
|
||||
"11 <- should not be incremented |${c}12| should not be incremented -> 12")
|
||||
"11 <- should not be incremented |${c}12| should not be incremented -> 12",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test inc visual part of number`() {
|
||||
doTest(parseKeys("v4l<C-A>"),
|
||||
"11111${c}22222111111",
|
||||
"11111${c}22223111111")
|
||||
"11111${c}22223111111",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test inc visual multiple lines`() {
|
||||
@ -64,7 +71,9 @@ class ChangeVisualNumberIncActionTest : VimTestCase() {
|
||||
no inc 1
|
||||
no inc 1
|
||||
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE
|
||||
)
|
||||
}
|
||||
|
||||
@ -79,13 +88,17 @@ class ChangeVisualNumberIncActionTest : VimTestCase() {
|
||||
${c}1000
|
||||
1000
|
||||
1000
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test inc visual multiple numbers on line`() {
|
||||
doTest(parseKeys("V<C-A>"),
|
||||
"1 should$c not be incremented -> 2",
|
||||
"${c}2 should not be incremented -> 2")
|
||||
"${c}2 should not be incremented -> 2",
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test change number inc visual multiple cursor`() {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -43,7 +44,7 @@ class DeleteVisualActionTest : VimTestCase() {
|
||||
wh||t was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent()
|
||||
doTest(keys, before, after)
|
||||
doTest(keys, before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test delete block SW direction`() {
|
||||
@ -64,7 +65,7 @@ class DeleteVisualActionTest : VimTestCase() {
|
||||
wh||t was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent()
|
||||
doTest(keys, before, after)
|
||||
doTest(keys, before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test delete block NW direction`() {
|
||||
@ -85,7 +86,7 @@ class DeleteVisualActionTest : VimTestCase() {
|
||||
wh||t was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent()
|
||||
doTest(keys, before, after)
|
||||
doTest(keys, before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test delete block NE direction`() {
|
||||
@ -106,6 +107,6 @@ class DeleteVisualActionTest : VimTestCase() {
|
||||
wh||t was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent()
|
||||
doTest(keys, before, after)
|
||||
doTest(keys, before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE)
|
||||
}
|
||||
}
|
@ -54,7 +54,9 @@ class InsertAfterLineEndActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,Hell${c}o
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
}
|
@ -40,7 +40,9 @@ class InsertBeforeFirstNonBlankActionTest : VimTestCase() {
|
||||
Hell${c}oall rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
}
|
@ -56,7 +56,9 @@ class VisualBlockAppendActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,Hell${c}o
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
}
|
@ -55,7 +55,9 @@ Xbar
|
||||
|
||||
ba_quux_r
|
||||
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
// VIM-632 |CTRL-V| |v_b_I|
|
||||
@ -72,7 +74,9 @@ Xbar
|
||||
${c}quux baz quux
|
||||
quux spam eggs
|
||||
|
||||
""".trimIndent()))
|
||||
""".trimIndent()),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test visual block insert`() {
|
||||
@ -105,7 +109,9 @@ Xbar
|
||||
x
|
||||
ba_quux_r
|
||||
|
||||
""".trimIndent()))
|
||||
""".trimIndent()),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test insert in non block mode`() {
|
||||
@ -125,7 +131,9 @@ Xbar
|
||||
Hell${c}oall rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
}
|
@ -22,9 +22,9 @@ class SelectEnableBlockModeActionHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_BLOCK)
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test entering select mode at the end of file`() {
|
||||
@ -42,9 +42,9 @@ class SelectEnableBlockModeActionHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_BLOCK)
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test entering select mode on empty line`() {
|
||||
@ -62,9 +62,9 @@ class SelectEnableBlockModeActionHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_BLOCK)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test entering select mode multicaret`() {
|
||||
@ -82,8 +82,8 @@ class SelectEnableBlockModeActionHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was ${s}s$c${se}ettled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_BLOCK)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
}
|
@ -22,9 +22,9 @@ class SelectEnableCharacterModeActionHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test entering select mode at the end of file`() {
|
||||
@ -42,9 +42,9 @@ class SelectEnableCharacterModeActionHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test entering select mode on empty line`() {
|
||||
@ -62,9 +62,9 @@ class SelectEnableCharacterModeActionHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test entering select mode multicaret`() {
|
||||
@ -82,8 +82,8 @@ class SelectEnableCharacterModeActionHandlerTest : VimTestCase() {
|
||||
${s}I$c$se found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was ${s}s$c${se}ettled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
}
|
@ -22,9 +22,9 @@ class SelectEnableLineModeActionHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test entering select mode at the end of file`() {
|
||||
@ -42,9 +42,9 @@ class SelectEnableLineModeActionHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
${s}hard by the torrent of a mountain pass$c.$se""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
${s}hard by the torrent of a mountain pass$c.$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test entering select mode on empty line`() {
|
||||
@ -62,9 +62,9 @@ class SelectEnableLineModeActionHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test entering select mode multicaret`() {
|
||||
@ -82,8 +82,8 @@ class SelectEnableLineModeActionHandlerTest : VimTestCase() {
|
||||
$s${c}I found it in a legendary land$se
|
||||
all rocks and lavender and tufted grass,
|
||||
${s}where it was ${c}settled on some sodden sand$se
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
}
|
@ -23,7 +23,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -44,7 +46,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -65,7 +69,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -86,7 +92,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -107,7 +115,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -128,7 +138,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks a${c}nd lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -149,7 +161,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -170,7 +184,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -191,7 +207,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -212,7 +230,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -233,7 +253,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks ${c}and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
||||
@ -254,7 +276,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertFalse(myFixture.editor.caretModel.allCarets.any(Caret::hasSelection))
|
||||
assertEquals(1, myFixture.editor.caretModel.caretCount)
|
||||
assertCaretsColour()
|
||||
@ -278,7 +302,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all ${c}rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertFalse(myFixture.editor.caretModel.allCarets.any(Caret::hasSelection))
|
||||
assertEquals(1, myFixture.editor.caretModel.caretCount)
|
||||
assertCaretsColour()
|
||||
@ -302,7 +328,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted${c} grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertFalse(myFixture.editor.caretModel.allCarets.any(Caret::hasSelection))
|
||||
assertEquals(1, myFixture.editor.caretModel.caretCount)
|
||||
assertCaretsColour()
|
||||
@ -326,7 +354,9 @@ class SelectEscapeActionTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand12${c}3
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertFalse(myFixture.editor.caretModel.allCarets.any(Caret::hasSelection))
|
||||
assertEquals(1, myFixture.editor.caretModel.caretCount)
|
||||
assertCaretsColour()
|
||||
|
@ -27,7 +27,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test char mode on empty line`() {
|
||||
@ -48,7 +50,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test char mode multicaret`() {
|
||||
@ -69,7 +73,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
all rocks and ${typed}vender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test line mode`() {
|
||||
@ -90,7 +96,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test line mode empty line`() {
|
||||
@ -111,7 +119,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test line mode multicaret`() {
|
||||
@ -132,7 +142,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
Hello
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test type in select block mode`() {
|
||||
@ -153,8 +165,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
${typed}l rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
assertCaretsColour()
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
@VimBehaviourDiffers(originalVimAfter = """
|
||||
@ -183,8 +196,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
${typed}ll rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
assertCaretsColour()
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test block mode longer line`() {
|
||||
@ -205,8 +219,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tu${typed}d grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
assertCaretsColour()
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.INSERT,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test block mode longer line with esc`() {
|
||||
@ -227,7 +242,9 @@ class SelectKeyHandlerTest : VimTestCase() {
|
||||
all rocks and lavender and tuHell${c}od grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
assertCaretsColour()
|
||||
assertMode(CommandState.Mode.COMMAND)
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
I ${s}found$c$se it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test switch to select mode characterwise multicaret`() {
|
||||
@ -40,9 +40,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
I ${s}found$c$se it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was ${s}settled$c$se on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test switch to visual mode characterwise`() {
|
||||
@ -60,9 +60,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
I ${s}foun${c}d$se it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.VISUAL)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.VISUAL,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test switch to visual mode characterwise multicaret`() {
|
||||
@ -80,9 +80,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
I ${s}foun${c}d$se it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was ${s}sett${c}l${se}ed on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.VISUAL)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_CHARACTER)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.VISUAL,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test switch to select mode linewise`() {
|
||||
@ -100,9 +100,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
${s}I found$c it in a legendary land$se
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test switch to select mode linewise multicaret`() {
|
||||
@ -120,9 +120,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
${s}I found$c it in a legendary land$se
|
||||
all rocks and lavender and tufted grass,
|
||||
${s}where it was settled$c on some sodden sand$se
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test switch to visual mode linewise`() {
|
||||
@ -140,9 +140,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
${s}I found it in a legendary lan${c}d$se
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.VISUAL)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.VISUAL,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test switch to visual mode linewise multicaret`() {
|
||||
@ -160,9 +160,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
${s}I found it in a legendary lan${c}d$se
|
||||
all rocks and lavender and tufted grass,
|
||||
${s}where it was settled on some sodden san${c}d$se
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.VISUAL)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_LINE)
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.VISUAL,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test switch to select mode blockwise`() {
|
||||
@ -180,10 +180,9 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
I ${s}found$c$se it in a legendary land
|
||||
al${s}l roc$c${se}ks and lavender and tufted grass,
|
||||
wh${s}ere i$c${se}t was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.SELECT)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_BLOCK)
|
||||
assertCaretsColour()
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test switch to visual mode blockwise`() {
|
||||
@ -201,9 +200,8 @@ class SelectToggleVisualModeHandlerTest : VimTestCase() {
|
||||
I ${s}foun${c}d$se it in a legendary land
|
||||
al${s}l ro${c}c${se}ks and lavender and tufted grass,
|
||||
wh${s}ere ${c}i${se}t was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertMode(CommandState.Mode.VISUAL)
|
||||
assertSubMode(CommandState.SubMode.VISUAL_BLOCK)
|
||||
assertCaretsColour()
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.VISUAL,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -21,7 +22,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
a$c${se}ll rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char select move to empty line`() {
|
||||
@ -41,7 +44,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char select move from empty line`() {
|
||||
@ -61,7 +66,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char select move to file end`() {
|
||||
@ -79,7 +86,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard ${s}b$c${se}y the torrent of a mountain pass.""".trimIndent())
|
||||
hard ${s}b$c${se}y the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char select move multicaret`() {
|
||||
@ -97,7 +106,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
I ${s}found it in a legendary land
|
||||
all$c$se rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard ${s}b$c${se}y the torrent of a mountain pass.""".trimIndent())
|
||||
hard ${s}b$c${se}y the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test line select simple move`() {
|
||||
@ -117,7 +128,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
${c}all rocks and lavender and tufted grass,$se
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line select to empty line`() {
|
||||
@ -137,7 +150,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line select from empty line`() {
|
||||
@ -157,7 +172,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line select to file end`() {
|
||||
@ -175,7 +192,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
${s}hard by the ${c}torrent of a mountain pass.$se""".trimIndent())
|
||||
${s}hard by the ${c}torrent of a mountain pass.$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line select multicaret`() {
|
||||
@ -193,7 +212,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
${s}I found it in a legendary land
|
||||
all rock${c}s and lavender and tufted grass,$se
|
||||
where it was settled on some sodden sand
|
||||
${s}hard by the ${c}torrent of a mountain pass.$se""".trimIndent())
|
||||
${s}hard by the ${c}torrent of a mountain pass.$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test block select simple move`() {
|
||||
@ -211,7 +232,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
I found ${s}i$c${se}t in a legendary land
|
||||
all rock${s}s$c$se and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test block select to empty line`() {
|
||||
@ -229,7 +252,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test block select from empty line`() {
|
||||
@ -247,7 +272,9 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
$s$c${se}I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test block select to file end`() {
|
||||
@ -265,6 +292,8 @@ class SelectExtendDownTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the ${s}t$c${se}orrent of a mountain pass.""".trimIndent())
|
||||
hard by the ${s}t$c${se}orrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -21,7 +22,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test double motion char mode`() {
|
||||
@ -41,7 +44,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test at line start char mode`() {
|
||||
@ -61,7 +66,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test at file start char mode`() {
|
||||
@ -81,7 +88,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char mode multicaret`() {
|
||||
@ -101,7 +110,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted gras$s${c}s$se,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test simple motion line mode`() {
|
||||
@ -121,7 +132,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test to line start line mode`() {
|
||||
@ -141,7 +154,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test to file start line mode`() {
|
||||
@ -161,7 +176,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line mode multicaret`() {
|
||||
@ -181,7 +198,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
${s}all rocks$c and lavender and tufted grass,$se
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test simple motion block mode`() {
|
||||
@ -201,7 +220,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test twice motion block mode`() {
|
||||
@ -221,7 +242,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test at line start block mode`() {
|
||||
@ -241,7 +264,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test at file start block mode`() {
|
||||
@ -261,7 +286,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test multiline with empty line block mode`() {
|
||||
@ -281,7 +308,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
assertCaretsColour()
|
||||
}
|
||||
|
||||
@ -302,7 +331,9 @@ class SelectExtendToLeftTest : VimTestCase() {
|
||||
all $s${c}ro${se}cks and lavender and tufted grass,
|
||||
wher$s${c}e ${se}it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
assertCaretsColour()
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -21,7 +22,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test at the lineend char mode`() {
|
||||
@ -41,7 +44,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test out of line char mode`() {
|
||||
@ -61,7 +66,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test file end char mode`() {
|
||||
@ -79,7 +86,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent())
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test file char mode multicaret`() {
|
||||
@ -97,7 +106,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
I ${s}fou$c${se}nd it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent())
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test simple motion line mode`() {
|
||||
@ -117,7 +128,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test lineend line mode`() {
|
||||
@ -137,7 +150,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test out of line line mode`() {
|
||||
@ -157,7 +172,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test fileend line mode`() {
|
||||
@ -175,7 +192,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
${s}hard by the torrent of a mountain pass.$c$se""".trimIndent())
|
||||
${s}hard by the torrent of a mountain pass.$c$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line mode multicaret`() {
|
||||
@ -193,7 +212,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
${s}I found i${c}t in a legendary land$se
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
${s}hard by the torrent of a mountain pass.$c$se""".trimIndent())
|
||||
${s}hard by the torrent of a mountain pass.$c$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test simple motion block mode`() {
|
||||
@ -213,7 +234,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test at the lineend block mode`() {
|
||||
@ -233,7 +256,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test out of line block mode`() {
|
||||
@ -253,7 +278,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test file end block mode`() {
|
||||
@ -271,7 +298,9 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent())
|
||||
hard by the torrent of a mountain pass$s.$c$se""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test to longer line block mode`() {
|
||||
@ -289,7 +318,8 @@ class SelectExtendToRightTest : VimTestCase() {
|
||||
I found it in a legendary lan${s}d$se
|
||||
all rocks and lavender and tu${s}fted$c$se grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.""".trimIndent())
|
||||
assertCaretsColour()
|
||||
hard by the torrent of a mountain pass.""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -21,7 +22,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
${se}all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char mode to empty line`() {
|
||||
@ -41,7 +44,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char mode from empty line`() {
|
||||
@ -61,7 +66,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char mode on file start`() {
|
||||
@ -81,7 +88,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test char mode multicaret`() {
|
||||
@ -101,7 +110,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and $s${c}lavender and tufted grass,
|
||||
where it was ${se}settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_CHARACTER)
|
||||
}
|
||||
|
||||
fun `test line mode simple motion`() {
|
||||
@ -121,7 +132,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,${se}
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line mode to empty line`() {
|
||||
@ -141,7 +154,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line mode from empty line`() {
|
||||
@ -161,7 +176,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line mode to line start`() {
|
||||
@ -181,7 +198,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test line mode multicaret`() {
|
||||
@ -201,7 +220,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,$se
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_LINE)
|
||||
}
|
||||
|
||||
fun `test block mode simple motion`() {
|
||||
@ -221,7 +242,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
${s}a$c${se}ll rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test block mode to empty line`() {
|
||||
@ -241,7 +264,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test block mode from empty line`() {
|
||||
@ -261,7 +286,9 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
|
||||
fun `test block mode to line start`() {
|
||||
@ -281,6 +308,8 @@ class SelectExtendUpTest : VimTestCase() {
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.SELECT,
|
||||
CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.motion.updown
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -43,6 +44,6 @@ class MotionDownActionTest : VimTestCase() {
|
||||
wh|${s}e${se}re i|t was settled on some sodden sand
|
||||
ha|${s}r${se}d by| the torrent of a mountain pass.
|
||||
""".trimIndent()
|
||||
doTest(keys, before, after)
|
||||
doTest(keys, before, after, CommandState.Mode.VISUAL, CommandState.SubMode.VISUAL_BLOCK)
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.ideavim.ex.handler
|
||||
|
||||
import com.maddyhome.idea.vim.command.CommandState
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
|
||||
@ -20,7 +21,9 @@ class JoinLinesHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land$c all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test simple join full command`() {
|
||||
@ -39,7 +42,9 @@ class JoinLinesHandlerTest : VimTestCase() {
|
||||
I found it in a legendary land$c all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test join with range`() {
|
||||
@ -57,7 +62,9 @@ class JoinLinesHandlerTest : VimTestCase() {
|
||||
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass, where it was settled on some sodden sand$c hard by the torrent of a mountain pass.
|
||||
""".trimIndent())
|
||||
""".trimIndent(),
|
||||
CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE)
|
||||
}
|
||||
|
||||
fun `test join multicaret`() {
|
||||
|
@ -43,11 +43,10 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
"if <caret>(condition) {\n" +
|
||||
"}\n";
|
||||
|
||||
doTest(parseKeys("yseb"), before, after);
|
||||
doTest(parseKeys("yse)"), before, after);
|
||||
doTest(parseKeys("yseb"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("yse)"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("yse("), before,
|
||||
"if ( condition ) {\n" +
|
||||
"}\n");
|
||||
"if ( condition ) {\n" + "}\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testSurroundWORDBlock() {
|
||||
@ -56,10 +55,10 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"if (condition) {return;}\n";
|
||||
|
||||
doTest(parseKeys("ysEB"), before, after);
|
||||
doTest(parseKeys("ysE}"), before, after);
|
||||
doTest(parseKeys("ysE{"), before,
|
||||
"if (condition) { return; }\n");
|
||||
doTest(parseKeys("ysEB"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ysE}"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ysE{"), before, "if (condition) { return; }\n", CommandState.Mode.COMMAND,
|
||||
CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testSurroundWordArray() {
|
||||
@ -68,10 +67,9 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"int foo = bar[index];";
|
||||
|
||||
doTest(parseKeys("yser"), before, after);
|
||||
doTest(parseKeys("yse]"), before, after);
|
||||
doTest(parseKeys("yse["), before,
|
||||
"int foo = bar[ index ];");
|
||||
doTest(parseKeys("yser"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("yse]"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("yse["), before, "int foo = bar[ index ];", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testSurroundWordAngle() {
|
||||
@ -80,8 +78,8 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"foo = new Bar<Baz>();";
|
||||
|
||||
doTest(parseKeys("ysea"), before, after);
|
||||
doTest(parseKeys("yse>"), before, after);
|
||||
doTest(parseKeys("ysea"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("yse>"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testSurroundQuotes() {
|
||||
@ -90,8 +88,8 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"foo = \"new Bar.Baz\";";
|
||||
|
||||
doTest(parseKeys("yst;\""), before, after);
|
||||
doTest(parseKeys("ys4w\""), before, after);
|
||||
doTest(parseKeys("yst;\""), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ys4w\""), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testSurroundTag() {
|
||||
@ -124,13 +122,12 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
"if <caret>(condition) {\n" +
|
||||
"}\n";
|
||||
|
||||
doTest(parseKeys("veSb"), before, after);
|
||||
doTest(parseKeys("veSb"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
assertMode(CommandState.Mode.COMMAND);
|
||||
doTest(parseKeys("veS)"), before, after);
|
||||
doTest(parseKeys("veS)"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
assertMode(CommandState.Mode.COMMAND);
|
||||
doTest(parseKeys("veS("), before,
|
||||
"if ( condition ) {\n" +
|
||||
"}\n");
|
||||
"if ( condition ) {\n" + "}\n", CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
assertMode(CommandState.Mode.COMMAND);
|
||||
}
|
||||
|
||||
@ -144,9 +141,9 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
"if condition {\n" +
|
||||
"}\n";
|
||||
|
||||
doTest(parseKeys("dsb"), before, after);
|
||||
doTest(parseKeys("ds("), before, after);
|
||||
doTest(parseKeys("ds)"), before, after);
|
||||
doTest(parseKeys("dsb"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds("), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds)"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteSurroundingQuote() {
|
||||
@ -157,7 +154,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
"if (<caret>foo.equals(foo)) {\n" +
|
||||
"}\n";
|
||||
|
||||
doTest(parseKeys("ds\""), before, after);
|
||||
doTest(parseKeys("ds\""), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteSurroundingBlock() {
|
||||
@ -166,9 +163,9 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"if (condition) return;\n";
|
||||
|
||||
doTest(parseKeys("dsB"), before, after);
|
||||
doTest(parseKeys("ds}"), before, after);
|
||||
doTest(parseKeys("ds{"), before, after);
|
||||
doTest(parseKeys("dsB"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds}"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds{"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteSurroundingArray() {
|
||||
@ -177,9 +174,9 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"int foo = barindex;";
|
||||
|
||||
doTest(parseKeys("dsr"), before, after);
|
||||
doTest(parseKeys("ds]"), before, after);
|
||||
doTest(parseKeys("ds["), before, after);
|
||||
doTest(parseKeys("dsr"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds]"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds["), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteSurroundingAngle() {
|
||||
@ -188,9 +185,9 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"foo = new BarBaz();";
|
||||
|
||||
doTest(parseKeys("dsa"), before, after);
|
||||
doTest(parseKeys("ds>"), before, after);
|
||||
doTest(parseKeys("ds<"), before, after);
|
||||
doTest(parseKeys("dsa"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds>"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
doTest(parseKeys("ds<"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testDeleteSurroundingTag() {
|
||||
@ -199,7 +196,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"<div><caret>Foo</div>";
|
||||
|
||||
doTest(parseKeys("dst"), before, after);
|
||||
doTest(parseKeys("dst"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-1085
|
||||
@ -211,7 +208,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
"Foo\n" +
|
||||
"Seq\"-Yrangepos\"\n";
|
||||
|
||||
doTest(parseKeys("dsb"), before, after);
|
||||
doTest(parseKeys("dsb"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// VIM-1085
|
||||
@ -229,7 +226,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
" other\n" +
|
||||
"Baz\n";
|
||||
|
||||
doTest(parseKeys("dsb"), before, after);
|
||||
doTest(parseKeys("dsb"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
|
||||
@ -255,7 +252,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
"if [condition] {\n" +
|
||||
"}\n";
|
||||
|
||||
doTest(parseKeys("csbr"), before, after);
|
||||
doTest(parseKeys("csbr"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testChangeSurroundingBlock() {
|
||||
@ -264,7 +261,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"if (condition) (return;)";
|
||||
|
||||
doTest(parseKeys("csBb"), before, after);
|
||||
doTest(parseKeys("csBb"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testChangeSurroundingTagSimple() {
|
||||
@ -273,7 +270,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"<div><caret>(Foo)</div>";
|
||||
|
||||
doTest(parseKeys("cstb"), before, after);
|
||||
doTest(parseKeys("cstb"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
public void testChangeSurroundingTagAnotherTag() {
|
||||
@ -282,7 +279,7 @@ public class VimSurroundExtensionTest extends VimTestCase {
|
||||
final String after =
|
||||
"<div><caret><b>Foo</b></div>";
|
||||
|
||||
doTest(parseKeys("cst\\<b>"), before, after);
|
||||
doTest(parseKeys("cst\\<b>"), before, after, CommandState.Mode.COMMAND, CommandState.SubMode.NONE);
|
||||
}
|
||||
|
||||
// TODO if/when we add proper repeat support
|
||||
|
Loading…
Reference in New Issue
Block a user