To: vim_dev@googlegroups.com Subject: Patch 8.1.0535 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0535 Problem: Increment/decrement might get interrupted by updating folds. Solution: Disable fold updating for a moment. (Christian Brabandt, closes #3599) Files: src/ops.c *** ../vim-8.1.0534/src/ops.c 2018-09-30 21:43:17.199693265 +0200 --- src/ops.c 2018-11-16 20:30:45.414309325 +0100 *************** *** 5549,5560 **** --- 5549,5575 ---- int change_cnt = 0; linenr_T amount = Prenum1; + // do_addsub() might trigger re-evaluation of 'foldexpr' halfway, when the + // buffer is not completly updated yet. Postpone updating folds until before + // the call to changed_lines(). + #ifdef FEAT_FOLDING + disable_fold_update++; + #endif + if (!VIsual_active) { pos = curwin->w_cursor; if (u_save_cursor() == FAIL) + { + #ifdef FEAT_FOLDING + disable_fold_update--; + #endif return; + } change_cnt = do_addsub(oap->op_type, &pos, 0, amount); + #ifdef FEAT_FOLDING + disable_fold_update--; + #endif if (change_cnt) changed_lines(pos.lnum, 0, pos.lnum + 1, 0L); } *************** *** 5566,5572 **** --- 5581,5592 ---- if (u_save((linenr_T)(oap->start.lnum - 1), (linenr_T)(oap->end.lnum + 1)) == FAIL) + { + #ifdef FEAT_FOLDING + disable_fold_update--; + #endif return; + } pos = oap->start; for (; pos.lnum <= oap->end.lnum; ++pos.lnum) *************** *** 5624,5629 **** --- 5644,5653 ---- if (g_cmd && one_change) amount += Prenum1; } + + #ifdef FEAT_FOLDING + disable_fold_update--; + #endif if (change_cnt) changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); *** ../vim-8.1.0534/src/version.c 2018-11-16 19:39:47.350937378 +0100 --- src/version.c 2018-11-16 20:54:05.109734642 +0100 *************** *** 794,795 **** --- 794,797 ---- { /* Add new patch number below this line */ + /**/ + 535, /**/ -- ARTHUR: Ni! BEDEVERE: Nu! ARTHUR: No. Ni! More like this. "Ni"! BEDEVERE: Ni, ni, ni! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///