if (Recording == FALSE) /* start recording */
{
- /* registers 0-9, a-z and " are allowed */
+ /* registers 0-9, a-z and " are allowed */
if (c < 0 || (!ASCII_ISALNUM(c) && c != '"'))
retval = FAIL;
else
if (oap->block_mode)
{
struct block_def bd2;
+ int did_indent = FALSE;
/* If indent kicked in, the firstline might have changed
* but only do that, if the indent actually increased. */
{
bd.textcol += ind_post - ind_pre;
bd.start_vcol += ind_post - ind_pre;
+ did_indent = TRUE;
}
/* The user may have moved the cursor before inserting something, try
- * to adjust the block for that. */
- if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX)
+ * to adjust the block for that. But only do it, if the difference
+ * does not come from indent kicking in. */
+ if (oap->start.lnum == curbuf->b_op_start_orig.lnum
+ && !bd.is_MAX && !did_indent)
{
if (oap->op_type == OP_INSERT
&& oap->start.col
--- /dev/null
+" Test for block inserting
+"
+" TODO: rewrite test39.in into this new style test
+
+func Test_blockinsert_indent()
+ new
+ filetype plugin indent on
+ setlocal sw=2 et ft=vim
+ call setline(1, ['let a=[', ' ''eins'',', ' ''zwei'',', ' ''drei'']'])
+ call cursor(2, 3)
+ exe "norm! \<c-v>2jI\\ \<esc>"
+ call assert_equal(['let a=[', ' \ ''eins'',', ' \ ''zwei'',', ' \ ''drei'']'],
+ \ getline(1,'$'))
+ " reset to sane state
+ filetype off
+ bwipe!
+endfunc
+
+
+" vim: shiftwidth=2 sts=2 expandtab