To: vim_dev@googlegroups.com Subject: Patch 8.0.1154 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1154 Problem: 'indentkeys' does not work properly. (Gary Johnson) Solution: Get the cursor line again. (Christian Brabandt, closes #2151) Files: src/edit.c, src/testdir/test_edit.vim *** ../vim-8.0.1153/src/edit.c 2017-09-22 15:20:27.724148715 +0200 --- src/edit.c 2017-09-26 20:03:04.255327131 +0200 *************** *** 8202,8208 **** { /* "0=word": Check if there are only blanks before the * word. */ ! if (getwhitecols(line) != (int)(curwin->w_cursor.col - (p - look))) match = FALSE; } --- 8202,8208 ---- { /* "0=word": Check if there are only blanks before the * word. */ ! if (getwhitecols_curline() != (int)(curwin->w_cursor.col - (p - look))) match = FALSE; } *** ../vim-8.0.1153/src/testdir/test_edit.vim 2017-04-07 14:10:44.856821123 +0200 --- src/testdir/test_edit.vim 2017-09-26 20:02:36.363500783 +0200 *************** *** 314,319 **** --- 314,346 ---- bw! endfunc + func! Test_edit_11_indentexpr() + " Test that indenting kicks in + new + " Use indentexpr instead of cindenting + func! Do_Indent() + let pline=prevnonblank(v:lnum) + if empty(getline(v:lnum)) + if getline(pline) =~ 'if\|then' + return shiftwidth() + else + return 0 + endif + else + return 0 + endif + endfunc + setl indentexpr=Do_Indent() indentkeys+=0=then,0=fi + call setline(1, ['if [ $this ]']) + call cursor(1, 1) + call feedkeys("othen\that\fi", 'tnix') + call assert_equal(['if [ $this ]', "then", "\that", "fi"], getline(1, '$')) + set cinkeys&vim indentkeys&vim + set nocindent indentexpr= + delfu Do_Indent + bw! + endfunc + func! Test_edit_12() " Test changing indent in replace mode new *** ../vim-8.0.1153/src/version.c 2017-09-26 19:41:37.659288837 +0200 --- src/version.c 2017-09-26 20:02:21.087595896 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1154, /**/ -- hundred-and-one symptoms of being an internet addict: 204. You're being audited because you mailed your tax return to the IRC. /// 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 ///