forked from aniani/vim
patch 8.0.1712: terminal scrollback is not limited
Problem: Terminal scrollback is not limited. Solution: Add the 'terminalscroll' option.
This commit is contained in:
parent
a42d363bac
commit
8c041b6b95
@ -1,4 +1,4 @@
|
|||||||
*options.txt* For Vim version 8.0. Last change: 2018 Mar 13
|
*options.txt* For Vim version 8.0. Last change: 2018 Apr 14
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -7933,6 +7933,16 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
Note that the "cterm" attributes are still used, not the "gui" ones.
|
Note that the "cterm" attributes are still used, not the "gui" ones.
|
||||||
NOTE: This option is reset when 'compatible' is set.
|
NOTE: This option is reset when 'compatible' is set.
|
||||||
|
|
||||||
|
*'terminalscroll'* *'tlsl'*
|
||||||
|
'terminalscroll' 'tlsl' number (default 10000)
|
||||||
|
global
|
||||||
|
{not in Vi}
|
||||||
|
{not available when compiled without the
|
||||||
|
|+terminal| feature}
|
||||||
|
Number of scrollback lines to keep. When going over this limit the
|
||||||
|
first 10% of the scrollback lines are deleted. This is just to reduce
|
||||||
|
the memory usage. See |Terminal-Normal|.
|
||||||
|
|
||||||
*'termkey'* *'tk'*
|
*'termkey'* *'tk'*
|
||||||
'termkey' 'tk' string (default "")
|
'termkey' 'tk' string (default "")
|
||||||
local to window
|
local to window
|
||||||
|
@ -288,7 +288,7 @@ not when 'termsize' is "rowsXcols".
|
|||||||
|
|
||||||
|
|
||||||
Terminal-Job and Terminal-Normal mode ~
|
Terminal-Job and Terminal-Normal mode ~
|
||||||
*Terminal-mode*
|
*Terminal-mode* *Terminal-Job*
|
||||||
When the job is running the contents of the terminal is under control of the
|
When the job is running the contents of the terminal is under control of the
|
||||||
job. That includes the cursor position. Typed keys are sent to the job.
|
job. That includes the cursor position. Typed keys are sent to the job.
|
||||||
The terminal contents can change at any time. This is called Terminal-Job
|
The terminal contents can change at any time. This is called Terminal-Job
|
||||||
@ -301,7 +301,9 @@ suspended. CTRL-\ CTRL-N does the same.
|
|||||||
Terminal-Job mode is where |:tmap| mappings are applied. Keys sent by
|
Terminal-Job mode is where |:tmap| mappings are applied. Keys sent by
|
||||||
|term_sendkeys()| are not subject to tmap, but keys from |feedkeys()| are.
|
|term_sendkeys()| are not subject to tmap, but keys from |feedkeys()| are.
|
||||||
|
|
||||||
*E946*
|
It is not possible to enter Insert mode from Terminal-Job mode.
|
||||||
|
|
||||||
|
*Terminal-Normal* *E946*
|
||||||
In Terminal-Normal mode you can move the cursor around with the usual Vim
|
In Terminal-Normal mode you can move the cursor around with the usual Vim
|
||||||
commands, Visually mark text, yank text, etc. But you cannot change the
|
commands, Visually mark text, yank text, etc. But you cannot change the
|
||||||
contents of the buffer. The commands that would start insert mode, such as
|
contents of the buffer. The commands that would start insert mode, such as
|
||||||
@ -312,7 +314,10 @@ In Terminal-Normal mode the statusline and window title show "(Terminal)". If
|
|||||||
the job ends while in Terminal-Normal mode this changes to
|
the job ends while in Terminal-Normal mode this changes to
|
||||||
"(Terminal-finished)".
|
"(Terminal-finished)".
|
||||||
|
|
||||||
It is not possible to enter Insert mode from Terminal-Job mode.
|
When the job outputs lines in the terminal, such that the contents scrolls off
|
||||||
|
the top, those lines are remembered and can be seen in Terminal-Normal mode.
|
||||||
|
The number of lines is limited by the 'terminalscroll' option. When going over
|
||||||
|
this limit, the first 10% of the scrolled lins are deleted and are lost.
|
||||||
|
|
||||||
|
|
||||||
Cursor style ~
|
Cursor style ~
|
||||||
|
@ -2748,6 +2748,15 @@ static struct vimoption options[] =
|
|||||||
#else
|
#else
|
||||||
(char_u*)NULL, PV_NONE,
|
(char_u*)NULL, PV_NONE,
|
||||||
{(char_u *)FALSE, (char_u *)FALSE}
|
{(char_u *)FALSE, (char_u *)FALSE}
|
||||||
|
#endif
|
||||||
|
SCRIPTID_INIT},
|
||||||
|
{"terminalscroll", "tlsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
||||||
|
#ifdef FEAT_TERMINAL
|
||||||
|
(char_u *)&p_tlsl, PV_NONE,
|
||||||
|
{(char_u *)10000L, (char_u *)10000L}
|
||||||
|
#else
|
||||||
|
(char_u *)NULL, PV_NONE,
|
||||||
|
{(char_u *)NULL, (char_u *)0L}
|
||||||
#endif
|
#endif
|
||||||
SCRIPTID_INIT},
|
SCRIPTID_INIT},
|
||||||
{"termkey", "tk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
|
{"termkey", "tk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
|
||||||
|
@ -849,6 +849,9 @@ EXTERN char_u *p_tcldll; /* 'tcldll' */
|
|||||||
#ifdef FEAT_ARABIC
|
#ifdef FEAT_ARABIC
|
||||||
EXTERN int p_tbidi; /* 'termbidi' */
|
EXTERN int p_tbidi; /* 'termbidi' */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_TERMINAL
|
||||||
|
EXTERN long p_tlsl; /* 'terminalscroll' */
|
||||||
|
#endif
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
EXTERN char_u *p_tenc; /* 'termencoding' */
|
EXTERN char_u *p_tenc; /* 'termencoding' */
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,8 +40,6 @@
|
|||||||
* TODO:
|
* TODO:
|
||||||
* - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
|
* - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
|
||||||
* redirection. Probably in call to channel_set_pipes().
|
* redirection. Probably in call to channel_set_pipes().
|
||||||
* - add an optional limit for the scrollback size. When reaching it remove
|
|
||||||
* 10% at the start.
|
|
||||||
* - Copy text in the vterm to the Vim buffer once in a while, so that
|
* - Copy text in the vterm to the Vim buffer once in a while, so that
|
||||||
* completion works.
|
* completion works.
|
||||||
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
|
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
|
||||||
@ -2518,7 +2516,27 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
|
|||||||
{
|
{
|
||||||
term_T *term = (term_T *)user;
|
term_T *term = (term_T *)user;
|
||||||
|
|
||||||
/* TODO: Limit the number of lines that are stored. */
|
/* If the number of lines that are stored goes over 'termscrollback' then
|
||||||
|
* delete the first 10%. */
|
||||||
|
if (term->tl_scrollback.ga_len > p_tlsl)
|
||||||
|
{
|
||||||
|
int todo = p_tlsl / 10;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
curbuf = term->tl_buffer;
|
||||||
|
for (i = 0; i < todo; ++i)
|
||||||
|
{
|
||||||
|
vim_free(((sb_line_T *)term->tl_scrollback.ga_data + i)->sb_cells);
|
||||||
|
ml_delete(1, FALSE);
|
||||||
|
}
|
||||||
|
curbuf = curwin->w_buffer;
|
||||||
|
|
||||||
|
term->tl_scrollback.ga_len -= todo;
|
||||||
|
mch_memmove(term->tl_scrollback.ga_data,
|
||||||
|
(sb_line_T *)term->tl_scrollback.ga_data + todo,
|
||||||
|
sizeof(sb_line_T) * term->tl_scrollback.ga_len);
|
||||||
|
}
|
||||||
|
|
||||||
if (ga_grow(&term->tl_scrollback, 1) == OK)
|
if (ga_grow(&term->tl_scrollback, 1) == OK)
|
||||||
{
|
{
|
||||||
cellattr_T *p = NULL;
|
cellattr_T *p = NULL;
|
||||||
|
@ -762,6 +762,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1712,
|
||||||
/**/
|
/**/
|
||||||
1711,
|
1711,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user