Mercurial > vim
changeset 12176:782a06ba2187 v8.0.0968
patch 8.0.0968: crash when switching terminal modes
commit https://github.com/vim/vim/commit/77ac9b5c62b35e90df35fc0bfdee57636cedb144
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 19 21:23:05 2017 +0200
patch 8.0.0968: crash when switching terminal modes
Problem: Crash when switching terminal modes. (Nikolai Pavlov)
Solution: Check that there are scrollback lines.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 19 Aug 2017 21:30:03 +0200 |
parents | b3ef304e33e0 |
children | a740357289a5 |
files | src/terminal.c src/version.c |
diffstat | 2 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/terminal.c +++ b/src/terminal.c @@ -1037,14 +1037,13 @@ term_enter_job_mode() /* Remove the terminal contents from the scrollback and the buffer. */ gap = &term->tl_scrollback; - while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled) + while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled + && gap->ga_len > 0) { ml_delete(curbuf->b_ml.ml_line_count, FALSE); line = (sb_line_T *)gap->ga_data + gap->ga_len - 1; vim_free(line->sb_cells); --gap->ga_len; - if (gap->ga_len == 0) - break; } check_cursor();