To: vim_dev@googlegroups.com Subject: Patch 8.0.1682 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1682 Problem: Auto indenting breaks inserting a block. Solution: Do not check for cursor movement if indent was changed. (Christian Brabandt, closes #2778) Files: src/testdir/test_blockedit.vim, src/testdir/Make_all.mak, src/Makefile, src/ops.c *** ../vim-8.0.1681/src/testdir/test_blockedit.vim 2018-04-10 13:02:19.626486356 +0200 --- src/testdir/test_blockedit.vim 2018-04-10 12:52:31.278642233 +0200 *************** *** 0 **** --- 1,20 ---- + " 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! \2jI\\ \" + call assert_equal(['let a=[', ' \ ''eins'',', ' \ ''zwei'',', ' \ ''drei'']'], + \ getline(1,'$')) + " reset to sane state + filetype off + bwipe! + endfunc + + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.0.1681/src/testdir/Make_all.mak 2018-03-11 14:43:53.084536821 +0100 --- src/testdir/Make_all.mak 2018-04-10 12:53:18.014306368 +0200 *************** *** 72,77 **** --- 72,78 ---- test_autocmd.res \ test_autoload.res \ test_backspace_opt.res \ + test_blockedit.res \ test_breakindent.res \ test_bufwintabinfo.res \ test_cdo.res \ *** ../vim-8.0.1681/src/Makefile 2018-03-17 15:55:21.993428480 +0100 --- src/Makefile 2018-04-10 12:54:22.213847136 +0200 *************** *** 2127,2132 **** --- 2131,2137 ---- test_autocmd \ test_autoload \ test_backspace_opt \ + test_blockedit \ test_breakindent \ test_bufline \ test_bufwintabinfo \ *** ../vim-8.0.1681/src/ops.c 2018-04-08 16:34:18.003712778 +0200 --- src/ops.c 2018-04-10 12:57:07.288675846 +0200 *************** *** 1093,1099 **** if (Recording == FALSE) /* start recording */ { ! /* registers 0-9, a-z and " are allowed */ if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) retval = FAIL; else --- 1093,1099 ---- if (Recording == FALSE) /* start recording */ { ! /* registers 0-9, a-z and " are allowed */ if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) retval = FAIL; else *************** *** 2702,2707 **** --- 2702,2708 ---- 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. */ *************** *** 2710,2720 **** { bd.textcol += ind_post - ind_pre; bd.start_vcol += ind_post - ind_pre; } /* 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) { if (oap->op_type == OP_INSERT && oap->start.col --- 2711,2724 ---- { 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. 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 *** ../vim-8.0.1681/src/version.c 2018-04-10 12:42:41.027042171 +0200 --- src/version.c 2018-04-10 13:02:27.638430525 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1682, /**/ -- I wish there was a knob on the TV to turn up the intelligence. There's a knob called "brightness", but it doesn't seem to work. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///