forked from aniani/vim
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:
parent
e1fc51558d
commit
6d150f783d
@ -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
|
||||
@ -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})
|
||||
Empty if the argument file count is zero or one.
|
||||
{ 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
|
||||
alignment of a section. Must be followed by %) somewhere.
|
||||
) - End of item group. No width fields allowed.
|
||||
|
@ -506,12 +506,15 @@ if has("cursorbind")
|
||||
call <SID>BinOptionL("crb")
|
||||
endif
|
||||
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 <SID>OptionL("tms")
|
||||
call append("$", "termkey\tkey that precedes Vim commands in a terminal window")
|
||||
call <SID>OptionL("tws")
|
||||
call append("$", "termwinkey\tkey that precedes Vim commands in a terminal 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")
|
||||
call append("$", "winptydll\tname of the winpty dynamic library")
|
||||
call <SID>OptionG("winptydll", &winptydll)
|
||||
|
83
src/option.c
83
src/option.c
@ -250,8 +250,9 @@
|
||||
# define PV_COLE OPT_WIN(WV_COLE)
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
# define PV_TK OPT_WIN(WV_TK)
|
||||
# define PV_TMS OPT_WIN(WV_TMS)
|
||||
# define PV_TWK OPT_WIN(WV_TWK)
|
||||
# define PV_TWS OPT_WIN(WV_TWS)
|
||||
# define PV_TWSL OPT_BUF(BV_TWSL)
|
||||
#endif
|
||||
#ifdef FEAT_SIGNS
|
||||
# define PV_SCL OPT_WIN(WV_SCL)
|
||||
@ -373,6 +374,9 @@ static long p_wm;
|
||||
#ifdef FEAT_KEYMAP
|
||||
static char_u *p_keymap;
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
static long p_twsl;
|
||||
#endif
|
||||
|
||||
/* Saved values for when 'bin' is set. */
|
||||
static int p_et_nobin;
|
||||
@ -2750,27 +2754,57 @@ static struct vimoption options[] =
|
||||
{(char_u *)FALSE, (char_u *)FALSE}
|
||||
#endif
|
||||
SCRIPTID_INIT},
|
||||
/* TODO: remove this deprecated entry */
|
||||
{"terminalscroll", "tlsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
|
||||
#ifdef FEAT_TERMINAL
|
||||
(char_u *)&p_tlsl, PV_NONE,
|
||||
(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},
|
||||
{"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
|
||||
(char_u *)VAR_WIN, PV_TK,
|
||||
(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},
|
||||
/* TODO: remove this deprecated entry */
|
||||
{"termsize", "tms", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
|
||||
#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}
|
||||
#else
|
||||
(char_u *)NULL, PV_NONE,
|
||||
@ -7452,19 +7486,20 @@ did_set_string_option(
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_TERMINAL
|
||||
/* 'termkey' */
|
||||
else if (varp == &curwin->w_p_tk)
|
||||
/* 'termwinkey' */
|
||||
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;
|
||||
}
|
||||
/* 'termsize' */
|
||||
else if (varp == &curwin->w_p_tms)
|
||||
/* 'termwinsize' */
|
||||
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);
|
||||
if (p == curwin->w_p_tms
|
||||
p = skipdigits(curwin->w_p_tws);
|
||||
if (p == curwin->w_p_tws
|
||||
|| (*p != 'x' && *p != '*')
|
||||
|| *skipdigits(p + 1) != NUL)
|
||||
errmsg = e_invarg;
|
||||
@ -10687,8 +10722,9 @@ get_varp(struct vimoption *p)
|
||||
case PV_COLE: return (char_u *)&(curwin->w_p_cole);
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
case PV_TK: return (char_u *)&(curwin->w_p_tk);
|
||||
case PV_TMS: return (char_u *)&(curwin->w_p_tms);
|
||||
case PV_TWK: return (char_u *)&(curwin->w_p_twk);
|
||||
case PV_TWS: return (char_u *)&(curwin->w_p_tws);
|
||||
case PV_TWSL: return (char_u *)&(curbuf->b_p_twsl);
|
||||
#endif
|
||||
|
||||
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;
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
to->wo_tk = vim_strsave(from->wo_tk);
|
||||
to->wo_tms = vim_strsave(from->wo_tms);
|
||||
to->wo_twk = vim_strsave(from->wo_twk);
|
||||
to->wo_tws = vim_strsave(from->wo_tws);
|
||||
#endif
|
||||
#ifdef FEAT_FOLDING
|
||||
to->wo_fdc = from->wo_fdc;
|
||||
@ -10957,8 +10993,8 @@ check_winopt(winopt_T *wop UNUSED)
|
||||
check_string_option(&wop->wo_cocu);
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
check_string_option(&wop->wo_tk);
|
||||
check_string_option(&wop->wo_tms);
|
||||
check_string_option(&wop->wo_twk);
|
||||
check_string_option(&wop->wo_tws);
|
||||
#endif
|
||||
#ifdef FEAT_LINEBREAK
|
||||
check_string_option(&wop->wo_briopt);
|
||||
@ -11000,8 +11036,8 @@ clear_winopt(winopt_T *wop UNUSED)
|
||||
clear_string_option(&wop->wo_cocu);
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
clear_string_option(&wop->wo_tk);
|
||||
clear_string_option(&wop->wo_tms);
|
||||
clear_string_option(&wop->wo_twk);
|
||||
clear_string_option(&wop->wo_tws);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -11177,6 +11213,9 @@ buf_copy_options(buf_T *buf, int flags)
|
||||
#ifdef FEAT_KEYMAP
|
||||
buf->b_p_keymap = vim_strsave(p_keymap);
|
||||
buf->b_kmap_state |= KEYMAP_INIT;
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
buf->b_p_twsl = p_twsl;
|
||||
#endif
|
||||
/* This isn't really an option, but copying the langmap and IME
|
||||
* state from the current buffer is better than resetting it. */
|
||||
|
@ -1114,6 +1114,9 @@ enum
|
||||
, BV_UDF
|
||||
, BV_UL
|
||||
, BV_WM
|
||||
#ifdef FEAT_TERMINAL
|
||||
, BV_TWSL
|
||||
#endif
|
||||
, BV_COUNT /* must be the last one */
|
||||
};
|
||||
|
||||
@ -1133,8 +1136,8 @@ enum
|
||||
, WV_COLE
|
||||
#endif
|
||||
#ifdef FEAT_TERMINAL
|
||||
, WV_TK
|
||||
, WV_TMS
|
||||
, WV_TWK
|
||||
, WV_TWS
|
||||
#endif
|
||||
, WV_CRBIND
|
||||
#ifdef FEAT_LINEBREAK
|
||||
|
@ -42,6 +42,8 @@
|
||||
* redirection. Probably in call to channel_set_pipes().
|
||||
* - Win32: Redirecting output does not work, Test_terminal_redir_file()
|
||||
* 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
|
||||
* switch to GUI, shell stops working. Scrollback seems wrong, command
|
||||
* running in shell is still running.
|
||||
@ -215,17 +217,17 @@ parse_termsize(win_T *wp, int *rows, int *cols)
|
||||
*rows = 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. */
|
||||
if (p == NULL)
|
||||
{
|
||||
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);
|
||||
}
|
||||
return minsize;
|
||||
@ -2000,8 +2002,8 @@ terminal_loop(int blocking)
|
||||
* stored reference. */
|
||||
in_terminal_loop = curbuf->b_term;
|
||||
|
||||
if (*curwin->w_p_tk != NUL)
|
||||
termkey = string_to_key(curwin->w_p_tk, TRUE);
|
||||
if (*curwin->w_p_twk != NUL)
|
||||
termkey = string_to_key(curwin->w_p_twk, TRUE);
|
||||
position_cursor(curwin, &curbuf->b_term->tl_cursor_pos);
|
||||
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
|
||||
* 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;
|
||||
|
||||
curbuf = term->tl_buffer;
|
||||
|
@ -130,8 +130,9 @@ let test_values = {
|
||||
\ 'tagcase': [['smart', 'match'], ['', 'xxx', 'smart,match']],
|
||||
\ 'term': [[], []],
|
||||
\ 'termguicolors': [[], []],
|
||||
\ 'termsize': [['', '24x80', '0x80', '32x0', '0x0'], ['xxx', '80', '8ax9', '24x80b']],
|
||||
\ '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']],
|
||||
\ 'toolbariconsize': [['', 'tiny', 'huge'], ['xxx']],
|
||||
\ 'ttymouse': [['', 'xterm'], ['xxx']],
|
||||
|
@ -273,7 +273,7 @@ endfunc
|
||||
|
||||
func Test_terminal_scrollback()
|
||||
let buf = Run_shell_in_terminal({})
|
||||
set terminalscroll=100
|
||||
set termwinscroll=100
|
||||
call writefile(range(150), 'Xtext')
|
||||
if has('win32')
|
||||
call term_sendkeys(buf, "type Xtext\<CR>")
|
||||
@ -289,7 +289,7 @@ func Test_terminal_scrollback()
|
||||
call Stop_shell_in_terminal(buf)
|
||||
call term_wait(buf)
|
||||
exe buf . 'bwipe'
|
||||
set terminalscroll&
|
||||
set termwinscroll&
|
||||
endfunc
|
||||
|
||||
func Test_terminal_size()
|
||||
@ -1381,11 +1381,11 @@ func Test_terminal_ansicolors_func()
|
||||
exe buf . 'bwipe'
|
||||
endfunc
|
||||
|
||||
func Test_terminal_termsize_option_fixed()
|
||||
func Test_terminal_termwinsize_option_fixed()
|
||||
if !CanRunVimInTerminal()
|
||||
return
|
||||
endif
|
||||
set termsize=6x40
|
||||
set termwinsize=6x40
|
||||
let text = []
|
||||
for n in range(10)
|
||||
call add(text, repeat(n, 50))
|
||||
@ -1407,15 +1407,15 @@ func Test_terminal_termsize_option_fixed()
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xwinsize')
|
||||
|
||||
call assert_fails('set termsize=40', 'E474')
|
||||
call assert_fails('set termsize=10+40', 'E474')
|
||||
call assert_fails('set termsize=abc', 'E474')
|
||||
call assert_fails('set termwinsize=40', 'E474')
|
||||
call assert_fails('set termwinsize=10+40', 'E474')
|
||||
call assert_fails('set termwinsize=abc', 'E474')
|
||||
|
||||
set termsize=
|
||||
set termwinsize=
|
||||
endfunc
|
||||
|
||||
func Test_terminal_termsize_option_zero()
|
||||
set termsize=0x0
|
||||
func Test_terminal_termwinsize_option_zero()
|
||||
set termwinsize=0x0
|
||||
let buf = Run_shell_in_terminal({})
|
||||
let win = bufwinid(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)
|
||||
exe buf . 'bwipe'
|
||||
|
||||
set termsize=7x0
|
||||
set termwinsize=7x0
|
||||
let buf = Run_shell_in_terminal({})
|
||||
let win = bufwinid(buf)
|
||||
call assert_equal([7, winwidth(win)], term_getsize(buf))
|
||||
@ -1431,7 +1431,7 @@ func Test_terminal_termsize_option_zero()
|
||||
call term_wait(buf)
|
||||
exe buf . 'bwipe'
|
||||
|
||||
set termsize=0x33
|
||||
set termwinsize=0x33
|
||||
let buf = Run_shell_in_terminal({})
|
||||
let win = bufwinid(buf)
|
||||
call assert_equal([winheight(win), 33], term_getsize(buf))
|
||||
@ -1439,11 +1439,11 @@ func Test_terminal_termsize_option_zero()
|
||||
call term_wait(buf)
|
||||
exe buf . 'bwipe'
|
||||
|
||||
set termsize=
|
||||
set termwinsize=
|
||||
endfunc
|
||||
|
||||
func Test_terminal_termsize_mininmum()
|
||||
set termsize=10*50
|
||||
func Test_terminal_termwinsize_mininmum()
|
||||
set termwinsize=10*50
|
||||
vsplit
|
||||
let buf = Run_shell_in_terminal({})
|
||||
let win = bufwinid(buf)
|
||||
@ -1469,7 +1469,7 @@ func Test_terminal_termsize_mininmum()
|
||||
call term_wait(buf)
|
||||
exe buf . 'bwipe'
|
||||
|
||||
set termsize=0*0
|
||||
set termwinsize=0*0
|
||||
let buf = Run_shell_in_terminal({})
|
||||
let win = bufwinid(buf)
|
||||
call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
|
||||
@ -1477,5 +1477,5 @@ func Test_terminal_termsize_mininmum()
|
||||
call term_wait(buf)
|
||||
exe buf . 'bwipe'
|
||||
|
||||
set termsize=
|
||||
set termwinsize=
|
||||
endfunc
|
||||
|
@ -761,6 +761,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1743,
|
||||
/**/
|
||||
1742,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user