vim-patch:8.2.0853: ml_delete() often called with FALSE argument

Problem:    ml_delete() often called with FALSE argument.
Solution:   Use ml_delete_flags(x, ML_DEL_MESSAGE) when argument is TRUE.

ca70c07b72

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
Jan Edmund Lazo
2025-08-18 20:37:33 -04:00
parent e77d15cc5d
commit dc2d4b07a8
13 changed files with 28 additions and 30 deletions

View File

@@ -732,7 +732,7 @@ retry:
}
// Delete the previously read lines.
while (lnum > from) {
ml_delete(lnum--, false);
ml_delete(lnum--);
}
file_rewind = false;
if (set_options) {
@@ -1659,7 +1659,7 @@ failed:
if (!recoverymode) {
// need to delete the last line, which comes from the empty buffer
if (newfile && wasempty && !(curbuf->b_ml.ml_flags & ML_EMPTY)) {
ml_delete(curbuf->b_ml.ml_line_count, false);
ml_delete(curbuf->b_ml.ml_line_count);
linecnt--;
}
curbuf->deleted_bytes = 0;
@@ -2821,7 +2821,7 @@ static int move_lines(buf_T *frombuf, buf_T *tobuf)
if (retval != FAIL) {
curbuf = frombuf;
for (linenr_T lnum = curbuf->b_ml.ml_line_count; lnum > 0; lnum--) {
if (ml_delete(lnum, false) == FAIL) {
if (ml_delete(lnum) == FAIL) {
// Oops! We could try putting back the saved lines, but that
// might fail again...
retval = FAIL;
@@ -3137,7 +3137,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options)
// Put the text back from the save buffer. First
// delete any lines that readfile() added.
while (!buf_is_empty(curbuf)) {
if (ml_delete(buf->b_ml.ml_line_count, false) == FAIL) {
if (ml_delete(buf->b_ml.ml_line_count) == FAIL) {
break;
}
}