785
785
DoTest("Three. Different. Sentences.", "viscX", "X Different. Sentences.");
786
786
DoTest("Three. Different. Sentences.", "vapcX", "X");
787
787
DoTest("Three. Different. Sentences.", "vipcX", "X");
788
DoTest("Hello.\n", "vap\\esciX", "Hello.\nX");
790
// Get the range right.
791
DoTest("\n", "vjcX", "X");
792
DoTest("Hello.\nWorld", "2lvjcX", "HeXld");
793
DoTest("Three. Different. Sentences.\n\n", "vapcX", "X");
790
796
void ViModeTest::ReplaceModeTests()
792
// TODO - more of these!
793
DoTest("foo bar", "R\\ctrl-\\rightX", "foo Xar");
794
DoTest("foo bar", "R\\ctrl-\\right\\ctrl-\\rightX", "foo barX");
795
DoTest("foo bar", "R\\ctrl-\\leftX", "Xoo bar");
796
DoTest("foo bar", "R\\ctrl-\\left\\delete", "oo bar");
798
DoTest("foo\nbar\nbaz", "R\\downX", "foo\nXar\nbaz");
799
DoTest("foo\nbar\nbaz", "jjR\\upX", "foo\nXar\nbaz");
799
DoTest("", "Rqwerty", "qwerty");
800
DoTest("qwerty", "R\\rightXX", "qXXrty");
802
// Enter replace and go to the next/previous word.
803
DoTest("foo bar", "R\\ctrl-\\rightX", "foo Xar");
804
DoTest("foo bar", "R\\ctrl-\\right\\ctrl-\\rightX", "foo barX");
805
DoTest("foo bar", "R\\ctrl-\\leftX", "Xoo bar");
806
DoTest("foo bar", "R\\ctrl-\\left\\delete", "oo bar");
808
// Enter replace mode and go up/down.
809
DoTest("foo\nbar\nbaz", "R\\downX", "foo\nXar\nbaz");
810
DoTest("foo\nbar\nbaz", "jjR\\upX", "foo\nXar\nbaz");
813
DoTest("", "R\\backspace", "");
814
DoTest("qwerty", "lR\\backspaceX", "Xwerty");
815
DoTest("qwerty", "lRX\\backspace\\backspaceX", "Xwerty");
817
// Ctrl-E: replace the current column with the column of the next line.
818
DoTest("", "R\\ctrl-e", "");
819
DoTest("\n", "jR\\ctrl-e", "\n");
820
DoTest("\nqwerty", "R\\ctrl-e\\ctrl-e", "qw\nqwerty");
821
DoTest("a\nbb", "R\\ctrl-e\\ctrl-e", "bb\nbb");
822
DoTest("aa\n b", "R\\ctrl-e\\ctrl-e", " b\n b");
823
DoTest("\n\tb", "R\\ctrl-e\\ctrl-e", "\tb\n\tb");
825
// Ctrl-Y: replace the current column with the column of the previous line.
826
DoTest("", "R\\ctrl-y", "");
827
DoTest("qwerty\n", "jR\\ctrl-y\\ctrl-y", "qwerty\nqw");
828
DoTest("aa\nb", "jR\\ctrl-y\\ctrl-y", "aa\naa");
829
DoTest(" a\nbb", "jR\\ctrl-y\\ctrl-y", " a\n a");
830
DoTest("\tb\n", "jR\\ctrl-y\\ctrl-y", "\tb\n\tb");
802
834
void ViModeTest::InsertModeTests() {
2885
2917
QApplication::sendPostedEvents();
2886
2918
FinishTest("foo bar");
2920
// Mapping the u and the U commands to other keys.
2922
KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "t", "u", KateViGlobal::Recursive);
2923
KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "r", "U", KateViGlobal::Recursive);
2924
DoTest("", "ihello\\esct", "");
2925
DoTest("", "ihello\\esctr", "hello");
2888
2927
// Clear mappings for subsequent tests.
2889
2928
clearAllMappings();