summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-21 20:03:20 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-21 20:03:20 +0200
commit6d150f783d5d3820fe69734dda1e79b8276a84d2 (patch)
tree125a3491b68b80a72f67f07194d33cdbabc68d70 /src
parente1fc51558dc14906a8d9f6a6e7bb1ac2a6ba8f3d (diff)
downloadvim-6d150f783d5d3820fe69734dda1e79b8276a84d2.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/option.c83
-rw-r--r--src/option.h7
-rw-r--r--src/terminal.c18
-rw-r--r--src/testdir/gen_opt_test.vim3
-rw-r--r--src/testdir/test_terminal.vim34
-rw-r--r--src/version.c2
6 files changed, 97 insertions, 50 deletions
diff --git a/src/option.c b/src/option.c
index ea8c6af9b..aea506647 100644
--- a/src/option.c
+++ b/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
}
@@ -11178,6 +11214,9 @@ buf_copy_options(buf_T *buf, int flags)
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. */
buf->b_p_iminsert = p_iminsert;
diff --git a/src/option.h b/src/option.h
index 45f1a36bc..8f492c361 100644
--- a/src/option.h
+++ b/src/option.h
@@ -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
diff --git a/src/terminal.c b/src/terminal.c
index 7f6e48db6..432aa353a 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -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;
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim
index e781a0d2a..58db1f90a 100644
--- a/src/testdir/gen_opt_test.vim
+++ b/src/testdir/gen_opt_test.vim
@@ -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']],
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 513765973..158bb980c 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 53aba0d2b..52486ac6d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1743,
+/**/
1742,
/**/
1741,