diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2026-01-05 08:20:24 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-05 08:20:24 +0800 |
| commit | 033302d97d48645c5083d2900a84099aa2943c20 (patch) | |
| tree | 0d485b979fbbbbb97e562ee92e49eef59a727cf9 /src | |
| parent | b67ac8cc6b5e5c7a40d6a56a3c0db40c9a7b77b8 (diff) | |
| download | rneovim-033302d97d48645c5083d2900a84099aa2943c20.tar.gz rneovim-033302d97d48645c5083d2900a84099aa2943c20.tar.bz2 rneovim-033302d97d48645c5083d2900a84099aa2943c20.zip | |
refactor(terminal): remove unnecessary buf_valid() (#37224)
In close_buffer(), free_buffer() is called to remove the buffer from
buffer_handles immediately after removing it from the buffer list, so as
long as a buffer is in buffer_handles it is always valid.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/terminal.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index ade9b46aaa..f5818f9219 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -2117,12 +2117,8 @@ static void invalidate_terminal(Terminal *term, int start_row, int end_row) static void refresh_terminal(Terminal *term) { buf_T *buf = handle_get_buffer(term->buf_handle); - bool valid = true; - if (!buf || !(valid = buf_valid(buf))) { + if (!buf) { // Destroyed by `close_buffer`. Do not do anything else. - if (!valid) { - term->buf_handle = 0; - } return; } linenr_T ml_before = buf->b_ml.ml_line_count; |