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

@@ -959,7 +959,7 @@ void ml_recover(bool checkext)
// Now that we are sure that the file is going to be recovered, clear the
// contents of the current buffer.
while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) {
ml_delete(1, false);
ml_delete(1);
}
// Try reading the original file to obtain the values of 'fileformat',
@@ -1183,7 +1183,7 @@ void ml_recover(bool checkext)
// empty buffer. These will now be after the last line in the buffer.
while (curbuf->b_ml.ml_line_count > lnum
&& !(curbuf->b_ml.ml_flags & ML_EMPTY)) {
ml_delete(curbuf->b_ml.ml_line_count, false);
ml_delete(curbuf->b_ml.ml_line_count);
}
curbuf->b_flags |= BF_RECOVERED;
check_cursor(curwin);
@@ -2689,12 +2689,10 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, int flags)
/// @note The caller of this function should probably also call
/// deleted_lines() after this.
///
/// @param message true may give a "No lines in buffer" message.
///
/// @return FAIL for failure, OK otherwise
int ml_delete(linenr_T lnum, bool message)
int ml_delete(linenr_T lnum)
{
return ml_delete_flags(lnum, message ? ML_DEL_MESSAGE : 0);
return ml_delete_flags(lnum, 0);
}
/// Like ml_delete() but using flags (see ml_delete_int()).