To: vim_dev@googlegroups.com Subject: Patch 8.1.2052 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2052 Problem: Using "x" before a closed fold may delete that fold. Solution: Do not translate 'x' do "dl". (Christian Brabandt, closes #4927) Files: src/normal.c, src/testdir/test_fold.vim *** ../vim-8.1.2051/src/normal.c 2019-09-09 20:04:04.738340561 +0200 --- src/normal.c 2019-09-17 22:38:03.254221383 +0200 *************** *** 7381,7388 **** if (!checkclearopq(cap->oap)) { ! /* In Vi "2D" doesn't delete the next line. Can't translate it ! * either, because "2." should also not use the count. */ if (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL) { cap->oap->start = curwin->w_cursor; --- 7381,7388 ---- if (!checkclearopq(cap->oap)) { ! // In Vi "2D" doesn't delete the next line. Can't translate it ! // either, because "2." should also not use the count. if (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL) { cap->oap->start = curwin->w_cursor; *************** *** 7400,7406 **** { if (cap->count0) stuffnumReadbuff(cap->count0); ! stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]); } } cap->opcount = 0; --- 7400,7412 ---- { if (cap->count0) stuffnumReadbuff(cap->count0); ! // If on an empty line and using 'x' and "l" is included in the ! // whichwrap option, do not delete the next line. ! if (cap->cmdchar == 'x' && vim_strchr(p_ww, 'l') != NULL ! && gchar_cursor() == NUL) ! stuffReadbuff((char_u *)"dd"); ! else ! stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]); } } cap->opcount = 0; *** ../vim-8.1.2051/src/testdir/test_fold.vim 2019-08-24 20:49:58.825320302 +0200 --- src/testdir/test_fold.vim 2019-09-17 22:36:13.970638225 +0200 *************** *** 757,759 **** --- 757,771 ---- bwipe! bwipe! endfunc + + func Test_fold_delete_with_marker_and_whichwrap() + new + let content1 = [''] + let content2 = ['folded line 1 "{{{1', ' test', ' test2', ' test3', '', 'folded line 2 "{{{1', ' test', ' test2', ' test3'] + call setline(1, content1 + content2) + set fdm=marker ww+=l + normal! x + call assert_equal(content2, getline(1, '$')) + set fdm& ww& + bwipe! + endfunc *** ../vim-8.1.2051/src/version.c 2019-09-17 21:27:46.453881351 +0200 --- src/version.c 2019-09-17 22:39:12.113961089 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 2052, /**/ -- Facepalm statement #2: "If there is a country without immigrants I'm going to move there" /// 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 ///