FakeVim: Indent block correctly

In situation:

    void f() {
    // Cursor is HERE.
    }

the code after ">i{" command is indented as (with shiftwidth=4):

    void f() {
        // Cursor is HERE.
    }

Change-Id: I48283c91c32fc407bbdb24349f2491461e401ee9
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Lukas Holecek
2014-11-17 15:32:33 +01:00
committed by hjk
parent 5881f6cb79
commit 0e83172b0b
2 changed files with 75 additions and 7 deletions

View File

@@ -1829,6 +1829,59 @@ void FakeVimPlugin::test_vim_indent()
data.setText("abc");
KEYS(">>", "\t\t abc");
INTEGRITY(false);
// indent inner block
data.doCommand("set expandtab");
data.doCommand("set shiftwidth=2");
data.setText("int main()" N
"{" N
"int i = 0;" N
X "return i;" N
"}" N
"");
KEYS(">i{",
"int main()" N
"{" N
" " X "int i = 0;" N
" return i;" N
"}" N
"");
KEYS(">i}",
"int main()" N
"{" N
" " X "int i = 0;" N
" return i;" N
"}" N
"");
KEYS("<i}",
"int main()" N
"{" N
" " X "int i = 0;" N
" return i;" N
"}" N
"");
data.doCommand("set expandtab");
data.doCommand("set shiftwidth=2");
data.setText("int main() {" N
"return i;" N
X "}" N
"");
KEYS("l>i{",
"int main() {" N
" " X "return i;" N
"}" N
"");
KEYS("l>i}",
"int main() {" N
" " X "return i;" N
"}" N
"");
KEYS("l<i}",
"int main() {" N
" " X "return i;" N
"}" N
"");
}
void FakeVimPlugin::test_vim_marks()