Mercurial > vim
comparison src/terminal.c @ 13680:c32e9628dc30 v8.0.1712
patch 8.0.1712: terminal scrollback is not limited
commit https://github.com/vim/vim/commit/8c041b6b95f49f7383cf00e2036cf009b326fa8d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 14 18:14:06 2018 +0200
patch 8.0.1712: terminal scrollback is not limited
Problem: Terminal scrollback is not limited.
Solution: Add the 'terminalscroll' option.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 14 Apr 2018 18:15:06 +0200 |
parents | 39fcaaa973db |
children | 1651a4c5c27a |
comparison
equal
deleted
inserted
replaced
13679:7989c11f96d2 | 13680:c32e9628dc30 |
---|---|
38 * in tl_scrollback are no longer used. | 38 * in tl_scrollback are no longer used. |
39 * | 39 * |
40 * TODO: | 40 * TODO: |
41 * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for | 41 * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for |
42 * redirection. Probably in call to channel_set_pipes(). | 42 * redirection. Probably in call to channel_set_pipes(). |
43 * - add an optional limit for the scrollback size. When reaching it remove | |
44 * 10% at the start. | |
45 * - Copy text in the vterm to the Vim buffer once in a while, so that | 43 * - Copy text in the vterm to the Vim buffer once in a while, so that |
46 * completion works. | 44 * completion works. |
47 * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito | 45 * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito |
48 * Higashi, 2017 Sep 19) | 46 * Higashi, 2017 Sep 19) |
49 * - after resizing windows overlap. (Boris Staletic, #2164) | 47 * - after resizing windows overlap. (Boris Staletic, #2164) |
2516 static int | 2514 static int |
2517 handle_pushline(int cols, const VTermScreenCell *cells, void *user) | 2515 handle_pushline(int cols, const VTermScreenCell *cells, void *user) |
2518 { | 2516 { |
2519 term_T *term = (term_T *)user; | 2517 term_T *term = (term_T *)user; |
2520 | 2518 |
2521 /* TODO: Limit the number of lines that are stored. */ | 2519 /* If the number of lines that are stored goes over 'termscrollback' then |
2520 * delete the first 10%. */ | |
2521 if (term->tl_scrollback.ga_len > p_tlsl) | |
2522 { | |
2523 int todo = p_tlsl / 10; | |
2524 int i; | |
2525 | |
2526 curbuf = term->tl_buffer; | |
2527 for (i = 0; i < todo; ++i) | |
2528 { | |
2529 vim_free(((sb_line_T *)term->tl_scrollback.ga_data + i)->sb_cells); | |
2530 ml_delete(1, FALSE); | |
2531 } | |
2532 curbuf = curwin->w_buffer; | |
2533 | |
2534 term->tl_scrollback.ga_len -= todo; | |
2535 mch_memmove(term->tl_scrollback.ga_data, | |
2536 (sb_line_T *)term->tl_scrollback.ga_data + todo, | |
2537 sizeof(sb_line_T) * term->tl_scrollback.ga_len); | |
2538 } | |
2539 | |
2522 if (ga_grow(&term->tl_scrollback, 1) == OK) | 2540 if (ga_grow(&term->tl_scrollback, 1) == OK) |
2523 { | 2541 { |
2524 cellattr_T *p = NULL; | 2542 cellattr_T *p = NULL; |
2525 int len = 0; | 2543 int len = 0; |
2526 int i; | 2544 int i; |