summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_cindent.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-02 20:30:35 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-02 20:30:35 +0200
commite2e69e48134cbfdedea7802810932f8592705024 (patch)
tree5de70fd649143a4e94584ef3a648b1877900b02f /src/testdir/test_cindent.vim
parent3653822546fb0f1005c32bb5b70dc9bfacdfc954 (diff)
patch 8.0.1041: bogus characters when indenting during visual-block appendv8.0.1041
Problem: Bogus characters appear when indenting kicks in while doing a visual-block append. Solution: Recompute when indenting is done. (Christian Brabandt)
Diffstat (limited to 'src/testdir/test_cindent.vim')
-rw-r--r--src/testdir/test_cindent.vim24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim
index d352e8feff..7c2c5e341c 100644
--- a/src/testdir/test_cindent.vim
+++ b/src/testdir/test_cindent.vim
@@ -71,7 +71,7 @@ func Test_cino_extern_c()
bwipe!
endfunc
-func! Test_cindent_rawstring()
+func Test_cindent_rawstring()
new
setl cindent
call feedkeys("i" .
@@ -81,5 +81,25 @@ func! Test_cindent_rawstring()
\ "statement;\<Esc>", "x")
call assert_equal("\tstatement;", getline(line('.')))
bw!
-endfunction
+endfunc
+
+func Test_cindent_expr()
+ new
+ func! MyIndentFunction()
+ return v:lnum == 1 ? shiftwidth() : 0
+ endfunc
+ setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction()
+ call setline(1, ['var_a = something()', 'b = something()'])
+ call cursor(1, 1)
+ call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
+ call assert_equal([' var_a = something();', 'b = something();'], getline(1, '$'))
+
+ %d
+ call setline(1, [' var_a = something()', ' b = something()'])
+ call cursor(1, 1)
+ call feedkeys("^\<c-v>j$A;\<esc>", 'tnix')
+ call assert_equal([' var_a = something();', ' b = something()'], getline(1, '$'))
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab