diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index a923a4bbe1..59dc162632 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -158,12 +158,12 @@ static int read_buffer(bool read_stdin, exarg_T *eap, int flags) if (retval == OK) { // Delete the binary lines. while (--line_count >= 0) { - ml_delete(1, false); + ml_delete(1); } } else { // Delete the converted lines. while (curbuf->b_ml.ml_line_count > line_count) { - ml_delete(line_count, false); + ml_delete(line_count); } } // Put the cursor on the first line. @@ -759,7 +759,7 @@ void buf_clear(void) linenr_T line_count = curbuf->b_ml.ml_line_count; extmark_free_all(curbuf); // delete any extmarks while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) { - ml_delete(1, false); + ml_delete(1); } deleted_lines_mark(1, line_count); // prepare for display } diff --git a/src/nvim/change.c b/src/nvim/change.c index 544574ffe6..f969bddfd1 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -1981,7 +1981,7 @@ void del_lines(linenr_T nlines, bool undo) break; } - ml_delete(first, true); + ml_delete_flags(first, ML_DEL_MESSAGE); n++; // If we delete the last line in the file, stop diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 6c40527e29..e64737cbb7 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -3075,7 +3075,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr for (int i = 0; i < count; i++) { // remember deleting the last line of the buffer buf_empty = curbuf->b_ml.ml_line_count == 1; - if (ml_delete(lnum, false) == OK) { + if (ml_delete(lnum) == OK) { added--; } } @@ -3096,7 +3096,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr // which results in inaccurate reporting of the byte count of // previous contents in buffer-update events. buf_empty = false; - ml_delete(2, false); + ml_delete(2); } } linenr_T new_count = dp->df_count[idx_to] + added; diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c index 41ed17598b..dccef58d50 100644 --- a/src/nvim/eval/buffer.c +++ b/src/nvim/eval/buffer.c @@ -454,7 +454,7 @@ void f_deletebufline(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } for (linenr_T lnum = first; lnum <= last; lnum++) { - ml_delete(first, true); + ml_delete_flags(first, ML_DEL_MESSAGE); } FOR_ALL_TAB_WINDOWS(tp, wp) { diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index aa07d30a4f..dd6cba8dc6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -659,7 +659,7 @@ void ex_sort(exarg_T *eap) // delete the original lines if appending worked if (i == count) { for (i = 0; i < count; i++) { - ml_delete(eap->line1, false); + ml_delete(eap->line1); } } else { count = 0; @@ -806,7 +806,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest) } for (l = line1; l <= line2; l++) { - ml_delete(line1 + extra, true); + ml_delete_flags(line1 + extra, ML_DEL_MESSAGE); } if (!global_busy && num_lines > p_report) { smsg(0, NGETTEXT("%" PRId64 " line moved", @@ -2867,7 +2867,7 @@ void ex_append(exarg_T *eap) lnum++; if (empty) { - ml_delete(2, false); + ml_delete(2); empty = false; } } @@ -2917,7 +2917,7 @@ void ex_change(exarg_T *eap) if (curbuf->b_ml.ml_flags & ML_EMPTY) { // nothing to delete break; } - ml_delete(eap->line1, false); + ml_delete(eap->line1); } // make sure the cursor is not beyond the end of the file now @@ -4107,7 +4107,7 @@ skip: break; } for (i = 0; i < nmatch_tl; i++) { - ml_delete(lnum, false); + ml_delete(lnum); } mark_adjust(lnum, lnum + nmatch_tl - 1, MAXLNUM, -nmatch_tl, kExtmarkNOOP); if (subflags.do_ask) { diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 3b01cb484e..0a52b7e909 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5934,7 +5934,7 @@ static void ex_read(exarg_T *eap) lnum = 1; } if (*ml_get(lnum) == NUL && u_savedel(lnum, 1) == OK) { - ml_delete(lnum, false); + ml_delete(lnum); if (curwin->w_cursor.lnum > 1 && curwin->w_cursor.lnum >= lnum) { curwin->w_cursor.lnum--; diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index b79ecf22d7..24dd0e8b82 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -733,7 +733,7 @@ retry: } // Delete the previously read lines. while (lnum > from) { - ml_delete(lnum--, false); + ml_delete(lnum--); } file_rewind = false; if (set_options) { @@ -1660,7 +1660,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; @@ -2836,7 +2836,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; @@ -3152,7 +3152,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; } } diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 2582213db0..fcaf6ac7fd 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -3809,7 +3809,7 @@ void ins_compl_delete(bool new_leader) } while (curwin->w_cursor.lnum > compl_lnum) { - if (ml_delete(curwin->w_cursor.lnum, false) == FAIL) { + if (ml_delete(curwin->w_cursor.lnum) == FAIL) { if (remaining.data) { xfree(remaining.data); } diff --git a/src/nvim/memline.c b/src/nvim/memline.c index ac07bf5965..b8bee5a735 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -961,7 +961,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', @@ -1185,7 +1185,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); @@ -2690,12 +2690,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()). diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 346f4e857f..7159575620 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -6598,7 +6598,7 @@ static void nv_put_opt(cmdarg_T *cap, bool fix_indent) // When all lines were selected and deleted do_put() leaves an empty // line that needs to be deleted now. if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL) { - ml_delete(curbuf->b_ml.ml_line_count, true); + ml_delete_flags(curbuf->b_ml.ml_line_count, ML_DEL_MESSAGE); deleted_lines(curbuf->b_ml.ml_line_count + 1, 1); // If the cursor was in that line, move it to the end of the last diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 39c1e43162..1a08f1d6b8 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -4180,7 +4180,7 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int q while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) { // If deletion fails, this loop may run forever, so // signal error and return. - if (ml_delete(1, false) == FAIL) { + if (ml_delete(1) == FAIL) { internal_error("qf_fill_buffer()"); return; } @@ -4250,7 +4250,7 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int q } if (old_last == NULL) { // Delete the empty line which is now at the end - ml_delete(lnum + 1, false); + ml_delete(lnum + 1); } qfga_clear(); diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 7437a7a32f..d352029a80 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -3234,7 +3234,7 @@ void ex_spelldump(exarg_T *eap) // Delete the empty line that we started with. if (curbuf->b_ml.ml_line_count > 1) { - ml_delete(curbuf->b_ml.ml_line_count, false); + ml_delete(curbuf->b_ml.ml_line_count); } redraw_later(curwin, UPD_NOT_VALID); } diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 38b21f2b9a..622e63a9db 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -2132,7 +2132,7 @@ static void adjust_scrollback(Terminal *term, buf_T *buf) if (scbk < term->sb_current) { size_t diff = term->sb_current - scbk; for (size_t i = 0; i < diff; i++) { - ml_delete(1, false); + ml_delete(1); term->sb_current--; xfree(term->sb_buffer[term->sb_current]); }