0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.0.1743: terminal window options are named inconsistently

Problem:    Terminal window options are named inconsistently.
Solution:   prefix terminal window options with "termwin".  Keep the old names
            for now as an alias.
This commit is contained in:
Bram Moolenaar 2018-04-21 20:03:20 +02:00
parent e1fc51558d
commit 6d150f783d
8 changed files with 108 additions and 56 deletions

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 8.0. Last change: 2018 Apr 18 *options.txt* For Vim version 8.0. Last change: 2018 Apr 21
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -7444,7 +7444,9 @@ A jump table for the options with a short description can be found at |Q_op|.
a S Argument list status as in default title. ({current} of {max}) a S Argument list status as in default title. ({current} of {max})
Empty if the argument file count is zero or one. Empty if the argument file count is zero or one.
{ NF Evaluate expression between '%{' and '}' and substitute result. { NF Evaluate expression between '%{' and '}' and substitute result.
Note that there is no '%' before the closing '}'. Note that there is no '%' before the closing '}'. The
expression cannot contain a '}' character, call a function to
work around that.
( - Start of item group. Can be used for setting the width and ( - Start of item group. Can be used for setting the width and
alignment of a section. Must be followed by %) somewhere. alignment of a section. Must be followed by %) somewhere.
) - End of item group. No width fields allowed. ) - End of item group. No width fields allowed.

View File

@ -506,12 +506,15 @@ if has("cursorbind")
call <SID>BinOptionL("crb") call <SID>BinOptionL("crb")
endif endif
if has("terminal") if has("terminal")
call append("$", "termsize\tsize of a terminal window") call append("$", "termwinsize\tsize of a terminal window")
call append("$", "\t(local to window)") call append("$", "\t(local to window)")
call <SID>OptionL("tms") call <SID>OptionL("tws")
call append("$", "termkey\tkey that precedes Vim commands in a terminal window") call append("$", "termwinkey\tkey that precedes Vim commands in a terminal window")
call append("$", "\t(local to window)") call append("$", "\t(local to window)")
call <SID>OptionL("tk") call <SID>OptionL("twk")
call append("$", "termwinscroll\tmax number of lines to keep for scrollback in a terminal window")
call append("$", "\t(local to window)")
call <SID>OptionL("twsl")
if exists("&winptydll") if exists("&winptydll")
call append("$", "winptydll\tname of the winpty dynamic library") call append("$", "winptydll\tname of the winpty dynamic library")
call <SID>OptionG("winptydll", &winptydll) call <SID>OptionG("winptydll", &winptydll)

View File

@ -250,8 +250,9 @@
# define PV_COLE OPT_WIN(WV_COLE) # define PV_COLE OPT_WIN(WV_COLE)
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
# define PV_TK OPT_WIN(WV_TK) # define PV_TWK OPT_WIN(WV_TWK)
# define PV_TMS OPT_WIN(WV_TMS) # define PV_TWS OPT_WIN(WV_TWS)
# define PV_TWSL OPT_BUF(BV_TWSL)
#endif #endif
#ifdef FEAT_SIGNS #ifdef FEAT_SIGNS
# define PV_SCL OPT_WIN(WV_SCL) # define PV_SCL OPT_WIN(WV_SCL)
@ -373,6 +374,9 @@ static long p_wm;
#ifdef FEAT_KEYMAP #ifdef FEAT_KEYMAP
static char_u *p_keymap; static char_u *p_keymap;
#endif #endif
#ifdef FEAT_TERMINAL
static long p_twsl;
#endif
/* Saved values for when 'bin' is set. */ /* Saved values for when 'bin' is set. */
static int p_et_nobin; static int p_et_nobin;
@ -2750,27 +2754,57 @@ static struct vimoption options[] =
{(char_u *)FALSE, (char_u *)FALSE} {(char_u *)FALSE, (char_u *)FALSE}
#endif #endif
SCRIPTID_INIT}, SCRIPTID_INIT},
/* TODO: remove this deprecated entry */
{"terminalscroll", "tlsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF, {"terminalscroll", "tlsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
(char_u *)&p_tlsl, PV_NONE, (char_u *)&p_twsl, PV_TWSL,
{(char_u *)10000L, (char_u *)10000L} {(char_u *)10000L, (char_u *)10000L}
#else #else
(char_u *)NULL, PV_NONE, (char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L} {(char_u *)NULL, (char_u *)0L}
#endif #endif
SCRIPTID_INIT}, SCRIPTID_INIT},
{"termkey", "tk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, /* TODO: remove this deprecated entry */
{"termkey", "tk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
(char_u *)VAR_WIN, PV_TK, (char_u *)VAR_WIN, PV_TWK,
{(char_u *)"", (char_u *)NULL} {(char_u *)"", (char_u *)NULL}
#else #else
(char_u *)NULL, PV_NONE, (char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L} {(char_u *)NULL, (char_u *)0L}
#endif #endif
SCRIPTID_INIT}, SCRIPTID_INIT},
/* TODO: remove this deprecated entry */
{"termsize", "tms", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, {"termsize", "tms", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
(char_u *)VAR_WIN, PV_TMS, (char_u *)VAR_WIN, PV_TWS,
{(char_u *)"", (char_u *)NULL}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
#ifdef FEAT_TERMINAL
(char_u *)VAR_WIN, PV_TWK,
{(char_u *)"", (char_u *)NULL}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"termwinscroll", "twsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
#ifdef FEAT_TERMINAL
(char_u *)&p_twsl, PV_TWSL,
{(char_u *)10000L, (char_u *)10000L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCRIPTID_INIT},
{"termwinsize", "tws", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
#ifdef FEAT_TERMINAL
(char_u *)VAR_WIN, PV_TWS,
{(char_u *)"", (char_u *)NULL} {(char_u *)"", (char_u *)NULL}
#else #else
(char_u *)NULL, PV_NONE, (char_u *)NULL, PV_NONE,
@ -7452,19 +7486,20 @@ did_set_string_option(
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
/* 'termkey' */ /* 'termwinkey' */
else if (varp == &curwin->w_p_tk) else if (varp == &curwin->w_p_twk)
{ {
if (*curwin->w_p_tk != NUL && string_to_key(curwin->w_p_tk, TRUE) == 0) if (*curwin->w_p_twk != NUL
&& string_to_key(curwin->w_p_twk, TRUE) == 0)
errmsg = e_invarg; errmsg = e_invarg;
} }
/* 'termsize' */ /* 'termwinsize' */
else if (varp == &curwin->w_p_tms) else if (varp == &curwin->w_p_tws)
{ {
if (*curwin->w_p_tms != NUL) if (*curwin->w_p_tws != NUL)
{ {
p = skipdigits(curwin->w_p_tms); p = skipdigits(curwin->w_p_tws);
if (p == curwin->w_p_tms if (p == curwin->w_p_tws
|| (*p != 'x' && *p != '*') || (*p != 'x' && *p != '*')
|| *skipdigits(p + 1) != NUL) || *skipdigits(p + 1) != NUL)
errmsg = e_invarg; errmsg = e_invarg;
@ -10687,8 +10722,9 @@ get_varp(struct vimoption *p)
case PV_COLE: return (char_u *)&(curwin->w_p_cole); case PV_COLE: return (char_u *)&(curwin->w_p_cole);
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
case PV_TK: return (char_u *)&(curwin->w_p_tk); case PV_TWK: return (char_u *)&(curwin->w_p_twk);
case PV_TMS: return (char_u *)&(curwin->w_p_tms); case PV_TWS: return (char_u *)&(curwin->w_p_tws);
case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl);
#endif #endif
case PV_AI: return (char_u *)&(curbuf->b_p_ai); case PV_AI: return (char_u *)&(curbuf->b_p_ai);
@ -10887,8 +10923,8 @@ copy_winopt(winopt_T *from, winopt_T *to)
to->wo_cole = from->wo_cole; to->wo_cole = from->wo_cole;
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
to->wo_tk = vim_strsave(from->wo_tk); to->wo_twk = vim_strsave(from->wo_twk);
to->wo_tms = vim_strsave(from->wo_tms); to->wo_tws = vim_strsave(from->wo_tws);
#endif #endif
#ifdef FEAT_FOLDING #ifdef FEAT_FOLDING
to->wo_fdc = from->wo_fdc; to->wo_fdc = from->wo_fdc;
@ -10957,8 +10993,8 @@ check_winopt(winopt_T *wop UNUSED)
check_string_option(&wop->wo_cocu); check_string_option(&wop->wo_cocu);
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
check_string_option(&wop->wo_tk); check_string_option(&wop->wo_twk);
check_string_option(&wop->wo_tms); check_string_option(&wop->wo_tws);
#endif #endif
#ifdef FEAT_LINEBREAK #ifdef FEAT_LINEBREAK
check_string_option(&wop->wo_briopt); check_string_option(&wop->wo_briopt);
@ -11000,8 +11036,8 @@ clear_winopt(winopt_T *wop UNUSED)
clear_string_option(&wop->wo_cocu); clear_string_option(&wop->wo_cocu);
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
clear_string_option(&wop->wo_tk); clear_string_option(&wop->wo_twk);
clear_string_option(&wop->wo_tms); clear_string_option(&wop->wo_tws);
#endif #endif
} }
@ -11177,6 +11213,9 @@ buf_copy_options(buf_T *buf, int flags)
#ifdef FEAT_KEYMAP #ifdef FEAT_KEYMAP
buf->b_p_keymap = vim_strsave(p_keymap); buf->b_p_keymap = vim_strsave(p_keymap);
buf->b_kmap_state |= KEYMAP_INIT; buf->b_kmap_state |= KEYMAP_INIT;
#endif
#ifdef FEAT_TERMINAL
buf->b_p_twsl = p_twsl;
#endif #endif
/* This isn't really an option, but copying the langmap and IME /* This isn't really an option, but copying the langmap and IME
* state from the current buffer is better than resetting it. */ * state from the current buffer is better than resetting it. */

View File

@ -1114,6 +1114,9 @@ enum
, BV_UDF , BV_UDF
, BV_UL , BV_UL
, BV_WM , BV_WM
#ifdef FEAT_TERMINAL
, BV_TWSL
#endif
, BV_COUNT /* must be the last one */ , BV_COUNT /* must be the last one */
}; };
@ -1133,8 +1136,8 @@ enum
, WV_COLE , WV_COLE
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
, WV_TK , WV_TWK
, WV_TMS , WV_TWS
#endif #endif
, WV_CRBIND , WV_CRBIND
#ifdef FEAT_LINEBREAK #ifdef FEAT_LINEBREAK

View File

@ -42,6 +42,8 @@
* redirection. Probably in call to channel_set_pipes(). * redirection. Probably in call to channel_set_pipes().
* - Win32: Redirecting output does not work, Test_terminal_redir_file() * - Win32: Redirecting output does not work, Test_terminal_redir_file()
* is disabled. * is disabled.
* - Add test for 'termwinkey'.
* - libvterm: bringg back using // comments and trailing comma in enum
* - When starting terminal window with shell in terminal, then using :gui to * - When starting terminal window with shell in terminal, then using :gui to
* switch to GUI, shell stops working. Scrollback seems wrong, command * switch to GUI, shell stops working. Scrollback seems wrong, command
* running in shell is still running. * running in shell is still running.
@ -215,17 +217,17 @@ parse_termsize(win_T *wp, int *rows, int *cols)
*rows = 0; *rows = 0;
*cols = 0; *cols = 0;
if (*wp->w_p_tms != NUL) if (*wp->w_p_tws != NUL)
{ {
char_u *p = vim_strchr(wp->w_p_tms, 'x'); char_u *p = vim_strchr(wp->w_p_tws, 'x');
/* Syntax of value was already checked when it's set. */ /* Syntax of value was already checked when it's set. */
if (p == NULL) if (p == NULL)
{ {
minsize = TRUE; minsize = TRUE;
p = vim_strchr(wp->w_p_tms, '*'); p = vim_strchr(wp->w_p_tws, '*');
} }
*rows = atoi((char *)wp->w_p_tms); *rows = atoi((char *)wp->w_p_tws);
*cols = atoi((char *)p + 1); *cols = atoi((char *)p + 1);
} }
return minsize; return minsize;
@ -2000,8 +2002,8 @@ terminal_loop(int blocking)
* stored reference. */ * stored reference. */
in_terminal_loop = curbuf->b_term; in_terminal_loop = curbuf->b_term;
if (*curwin->w_p_tk != NUL) if (*curwin->w_p_twk != NUL)
termkey = string_to_key(curwin->w_p_tk, TRUE); termkey = string_to_key(curwin->w_p_twk, TRUE);
position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); position_cursor(curwin, &curbuf->b_term->tl_cursor_pos);
may_set_cursor_props(curbuf->b_term); may_set_cursor_props(curbuf->b_term);
@ -2562,9 +2564,9 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
/* If the number of lines that are stored goes over 'termscrollback' then /* If the number of lines that are stored goes over 'termscrollback' then
* delete the first 10%. */ * delete the first 10%. */
if (term->tl_scrollback.ga_len >= p_tlsl) if (term->tl_scrollback.ga_len >= term->tl_buffer->b_p_twsl)
{ {
int todo = p_tlsl / 10; int todo = term->tl_buffer->b_p_twsl / 10;
int i; int i;
curbuf = term->tl_buffer; curbuf = term->tl_buffer;

View File

@ -130,8 +130,9 @@ let test_values = {
\ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']], \ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']],
\ 'term': [[], []], \ 'term': [[], []],
\ 'termguicolors': [[], []], \ 'termguicolors': [[], []],
\ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']],
\ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']], \ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']],
\ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']],
\ 'termwinsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']],
\ 'toolbar': [['', 'icons', 'text'], ['xxx']], \ 'toolbar': [['', 'icons', 'text'], ['xxx']],
\ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']], \ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']],
\ 'ttymouse': [['', 'xterm'], ['xxx']], \ 'ttymouse': [['', 'xterm'], ['xxx']],

View File

@ -273,7 +273,7 @@ endfunc
func Test_terminal_scrollback() func Test_terminal_scrollback()
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
set terminalscroll=100 set termwinscroll=100
call writefile(range(150), 'Xtext') call writefile(range(150), 'Xtext')
if has('win32') if has('win32')
call term_sendkeys(buf, "type Xtext\<CR>") call term_sendkeys(buf, "type Xtext\<CR>")
@ -289,7 +289,7 @@ func Test_terminal_scrollback()
call Stop_shell_in_terminal(buf) call Stop_shell_in_terminal(buf)
call term_wait(buf) call term_wait(buf)
exe buf . 'bwipe' exe buf . 'bwipe'
set terminalscroll& set termwinscroll&
endfunc endfunc
func Test_terminal_size() func Test_terminal_size()
@ -1381,11 +1381,11 @@ func Test_terminal_ansicolors_func()
exe buf . 'bwipe' exe buf . 'bwipe'
endfunc endfunc
func Test_terminal_termsize_option_fixed() func Test_terminal_termwinsize_option_fixed()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return return
endif endif
set termsize=6x40 set termwinsize=6x40
let text = [] let text = []
for n in range(10) for n in range(10)
call add(text, repeat(n, 50)) call add(text, repeat(n, 50))
@ -1407,15 +1407,15 @@ func Test_terminal_termsize_option_fixed()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xwinsize') call delete('Xwinsize')
call assert_fails('set termsize=40', 'E474') call assert_fails('set termwinsize=40', 'E474')
call assert_fails('set termsize=10+40', 'E474') call assert_fails('set termwinsize=10+40', 'E474')
call assert_fails('set termsize=abc', 'E474') call assert_fails('set termwinsize=abc', 'E474')
set termsize= set termwinsize=
endfunc endfunc
func Test_terminal_termsize_option_zero() func Test_terminal_termwinsize_option_zero()
set termsize=0x0 set termwinsize=0x0
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
let win = bufwinid(buf) let win = bufwinid(buf)
call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
@ -1423,7 +1423,7 @@ func Test_terminal_termsize_option_zero()
call term_wait(buf) call term_wait(buf)
exe buf . 'bwipe' exe buf . 'bwipe'
set termsize=7x0 set termwinsize=7x0
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
let win = bufwinid(buf) let win = bufwinid(buf)
call assert_equal([7, winwidth(win)], term_getsize(buf)) call assert_equal([7, winwidth(win)], term_getsize(buf))
@ -1431,7 +1431,7 @@ func Test_terminal_termsize_option_zero()
call term_wait(buf) call term_wait(buf)
exe buf . 'bwipe' exe buf . 'bwipe'
set termsize=0x33 set termwinsize=0x33
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
let win = bufwinid(buf) let win = bufwinid(buf)
call assert_equal([winheight(win), 33], term_getsize(buf)) call assert_equal([winheight(win), 33], term_getsize(buf))
@ -1439,11 +1439,11 @@ func Test_terminal_termsize_option_zero()
call term_wait(buf) call term_wait(buf)
exe buf . 'bwipe' exe buf . 'bwipe'
set termsize= set termwinsize=
endfunc endfunc
func Test_terminal_termsize_mininmum() func Test_terminal_termwinsize_mininmum()
set termsize=10*50 set termwinsize=10*50
vsplit vsplit
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
let win = bufwinid(buf) let win = bufwinid(buf)
@ -1469,7 +1469,7 @@ func Test_terminal_termsize_mininmum()
call term_wait(buf) call term_wait(buf)
exe buf . 'bwipe' exe buf . 'bwipe'
set termsize=0*0 set termwinsize=0*0
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
let win = bufwinid(buf) let win = bufwinid(buf)
call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
@ -1477,5 +1477,5 @@ func Test_terminal_termsize_mininmum()
call term_wait(buf) call term_wait(buf)
exe buf . 'bwipe' exe buf . 'bwipe'
set termsize= set termwinsize=
endfunc endfunc

View File

@ -761,6 +761,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 */
/**/
1743,
/**/ /**/
1742, 1742,
/**/ /**/