comparison src/normal.c @ 17787:92e0996e1cb8 v8.1.1890

patch 8.1.1890: ml_get error when deleting fold marker commit https://github.com/vim/vim/commit/9a4a8c4d5993c6371486c895a515c2ad351e9aaa Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 19 22:48:30 2019 +0200 patch 8.1.1890: ml_get error when deleting fold marker Problem: Ml_get error when deleting fold marker. Solution: Check that the line number is not below the last line. Adjust the fold when deleting the empty line. (Christian Brabandt, closes #4834)
author Bram Moolenaar <Bram@vim.org>
date Mon, 19 Aug 2019 23:00:05 +0200
parents 2fe133c7e972
children 2ea47dee7ddd
comparison
equal deleted inserted replaced
17786:ebc8c095bbf7 17787:92e0996e1cb8
9344 /* The delete is going to overwrite the register we want to 9344 /* The delete is going to overwrite the register we want to
9345 * put, save it first. */ 9345 * put, save it first. */
9346 reg1 = get_register(regname, TRUE); 9346 reg1 = get_register(regname, TRUE);
9347 } 9347 }
9348 9348
9349 /* Now delete the selected text. */ 9349 // Now delete the selected text. Avoid messages here.
9350 cap->cmdchar = 'd'; 9350 cap->cmdchar = 'd';
9351 cap->nchar = NUL; 9351 cap->nchar = NUL;
9352 cap->oap->regname = NUL; 9352 cap->oap->regname = NUL;
9353 ++msg_silent;
9353 nv_operator(cap); 9354 nv_operator(cap);
9354 do_pending_operator(cap, 0, FALSE); 9355 do_pending_operator(cap, 0, FALSE);
9355 empty = (curbuf->b_ml.ml_flags & ML_EMPTY); 9356 empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
9357 --msg_silent;
9356 9358
9357 /* delete PUT_LINE_BACKWARD; */ 9359 /* delete PUT_LINE_BACKWARD; */
9358 cap->oap->regname = regname; 9360 cap->oap->regname = regname;
9359 9361
9360 if (reg1 != NULL) 9362 if (reg1 != NULL)
9405 /* When all lines were selected and deleted do_put() leaves an empty 9407 /* When all lines were selected and deleted do_put() leaves an empty
9406 * line that needs to be deleted now. */ 9408 * line that needs to be deleted now. */
9407 if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL) 9409 if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL)
9408 { 9410 {
9409 ml_delete(curbuf->b_ml.ml_line_count, TRUE); 9411 ml_delete(curbuf->b_ml.ml_line_count, TRUE);
9412 deleted_lines(curbuf->b_ml.ml_line_count + 1, 1);
9410 9413
9411 /* If the cursor was in that line, move it to the end of the last 9414 /* If the cursor was in that line, move it to the end of the last
9412 * line. */ 9415 * line. */
9413 if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) 9416 if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
9414 { 9417 {