fix(terminal): deleting from wrong buffer (#36289)

Follow-up to #33721.
This doesn't seem to affect actual behavior for now, as these two lines
seem only reachable when the 'scrollback' option is changed, and options
can currently only be changed in the current buffer.
This commit is contained in:
zeertzjq
2025-10-23 17:40:45 +08:00
committed by GitHub
parent af0f7b59b1
commit 459cffc55f
2 changed files with 3 additions and 3 deletions

View File

@@ -2581,7 +2581,7 @@ int ml_delete_buf(buf_T *buf, linenr_T lnum, bool message)
FUNC_ATTR_NONNULL_ALL
{
ml_flush_line(buf, false);
return ml_delete_int(buf, lnum, message);
return ml_delete_int(buf, lnum, message ? ML_DEL_MESSAGE : 0);
}
/// Delete line `lnum` in the current buffer.

View File

@@ -2211,11 +2211,11 @@ 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);
ml_delete_buf(buf, 1, false);
term->sb_current--;
xfree(term->sb_buffer[term->sb_current]);
}
deleted_lines(1, (linenr_T)diff);
deleted_lines_buf(buf, 1, (linenr_T)diff);
}
// Resize the scrollback storage.