To: vim_dev@googlegroups.com Subject: Patch 8.2.4953 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4953 Problem: With 'smartindent' inserting '}' after completion goes wrong. Solution: Check the cursor is in indent. (closes #10420) Files: src/indent.c, src/testdir/test_smartindent.vim *** ../vim-8.2.4952/src/indent.c 2022-05-14 11:52:19.201341191 +0100 --- src/indent.c 2022-05-14 12:53:08.947681335 +0100 *************** *** 1197,1203 **** int temp; // do some very smart indenting when entering '{' or '}' ! if (((did_si || can_si_back) && c == '{') || (can_si && c == '}')) { // for '}' set indent equal to indent of line containing matching '{' if (c == '}' && (pos = findmatch(NULL, '{')) != NULL) --- 1197,1204 ---- int temp; // do some very smart indenting when entering '{' or '}' ! if (((did_si || can_si_back) && c == '{') ! || (can_si && c == '}' && inindent(0))) { // for '}' set indent equal to indent of line containing matching '{' if (c == '}' && (pos = findmatch(NULL, '{')) != NULL) *** ../vim-8.2.4952/src/testdir/test_smartindent.vim 2022-05-14 11:52:19.205341190 +0100 --- src/testdir/test_smartindent.vim 2022-05-14 12:52:15.679712522 +0100 *************** *** 140,145 **** --- 140,150 ---- call setline(1, 'foo foot') call feedkeys("o f\\#", 'tx') call assert_equal(' foo#', getline(2)) + + call setline(2, '') + call feedkeys("1Go f\\}", 'tx') + call assert_equal(' foo}', getline(2)) + bwipe! endfunc *** ../vim-8.2.4952/src/version.c 2022-05-14 12:34:39.868325473 +0100 --- src/version.c 2022-05-14 12:50:35.343771291 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4953, /**/ -- hundred-and-one symptoms of being an internet addict: 194. Your business cards contain your e-mail and home page address. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///