forked from aniani/vim
patch 8.0.1794: duplicate term options after renaming
Problem: Duplicate term options after renaming. Solution: Remove the old names 'termkey', 'termsize' and 'terminalscroll'.
This commit is contained in:
58
src/option.c
58
src/option.c
@@ -375,7 +375,7 @@ static long p_wm;
|
|||||||
static char_u *p_keymap;
|
static char_u *p_keymap;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_TERMINAL
|
#ifdef FEAT_TERMINAL
|
||||||
static long p_twsl;
|
static long p_twsl; /* 'termwinscroll' */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Saved values for when 'bin' is set. */
|
/* Saved values for when 'bin' is set. */
|
||||||
@@ -2752,36 +2752,6 @@ 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},
|
|
||||||
/* TODO: remove this deprecated entry */
|
|
||||||
{"terminalscroll", "tlsl", 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},
|
|
||||||
/* TODO: remove this deprecated entry */
|
|
||||||
{"termkey", "tk", 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},
|
|
||||||
/* TODO: remove this deprecated entry */
|
|
||||||
{"termsize", "tms", 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,
|
|
||||||
{(char_u *)NULL, (char_u *)0L}
|
|
||||||
#endif
|
#endif
|
||||||
SCRIPTID_INIT},
|
SCRIPTID_INIT},
|
||||||
{"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
|
{"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
|
||||||
@@ -3805,23 +3775,17 @@ set_option_default(
|
|||||||
dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
|
dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT;
|
||||||
if (flags & P_STRING)
|
if (flags & P_STRING)
|
||||||
{
|
{
|
||||||
/* skip 'termkey' and 'termsize, they are duplicates of
|
/* Use set_string_option_direct() for local options to handle
|
||||||
* 'termwinkey' and 'termwinsize' */
|
* freeing and allocating the value. */
|
||||||
if (STRCMP(options[opt_idx].fullname, "termkey") != 0
|
if (options[opt_idx].indir != PV_NONE)
|
||||||
&& STRCMP(options[opt_idx].fullname, "termsize") != 0)
|
set_string_option_direct(NULL, opt_idx,
|
||||||
|
options[opt_idx].def_val[dvi], opt_flags, 0);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* Use set_string_option_direct() for local options to handle
|
if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED))
|
||||||
* freeing and allocating the value. */
|
free_string_option(*(char_u **)(varp));
|
||||||
if (options[opt_idx].indir != PV_NONE)
|
*(char_u **)varp = options[opt_idx].def_val[dvi];
|
||||||
set_string_option_direct(NULL, opt_idx,
|
options[opt_idx].flags &= ~P_ALLOCED;
|
||||||
options[opt_idx].def_val[dvi], opt_flags, 0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED))
|
|
||||||
free_string_option(*(char_u **)(varp));
|
|
||||||
*(char_u **)varp = options[opt_idx].def_val[dvi];
|
|
||||||
options[opt_idx].flags &= ~P_ALLOCED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (flags & P_NUM)
|
else if (flags & P_NUM)
|
||||||
|
@@ -849,9 +849,6 @@ 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
|
||||||
|
@@ -51,6 +51,9 @@
|
|||||||
* a redraw is faster.
|
* a redraw is faster.
|
||||||
* - 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.
|
||||||
|
* - When the job only outputs lines, we could handle resizing the terminal
|
||||||
|
* better: store lines separated by line breaks, instead of screen lines,
|
||||||
|
* then when the window is resized redraw those lines.
|
||||||
* - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed)
|
* - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed)
|
||||||
* - For the GUI fill termios with default values, perhaps like pangoterm:
|
* - For the GUI fill termios with default values, perhaps like pangoterm:
|
||||||
* http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134
|
* http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134
|
||||||
@@ -202,13 +205,13 @@ static int desired_cursor_blink = -1;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse 'termsize' and set "rows" and "cols" for the terminal size in the
|
* Parse 'termwinsize' and set "rows" and "cols" for the terminal size in the
|
||||||
* current window.
|
* current window.
|
||||||
* Sets "rows" and/or "cols" to zero when it should follow the window size.
|
* Sets "rows" and/or "cols" to zero when it should follow the window size.
|
||||||
* Return TRUE if the size is the minimum size: "24*80".
|
* Return TRUE if the size is the minimum size: "24*80".
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
parse_termsize(win_T *wp, int *rows, int *cols)
|
parse_termwinsize(win_T *wp, int *rows, int *cols)
|
||||||
{
|
{
|
||||||
int minsize = FALSE;
|
int minsize = FALSE;
|
||||||
|
|
||||||
@@ -232,7 +235,7 @@ parse_termsize(win_T *wp, int *rows, int *cols)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine the terminal size from 'termsize' and the current window.
|
* Determine the terminal size from 'termwinsize' and the current window.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
set_term_and_win_size(term_T *term)
|
set_term_and_win_size(term_T *term)
|
||||||
@@ -247,7 +250,7 @@ set_term_and_win_size(term_T *term)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (parse_termsize(curwin, &term->tl_rows, &term->tl_cols))
|
if (parse_termwinsize(curwin, &term->tl_rows, &term->tl_cols))
|
||||||
{
|
{
|
||||||
if (term->tl_rows != 0)
|
if (term->tl_rows != 0)
|
||||||
term->tl_rows = MAX(term->tl_rows, curwin->w_height);
|
term->tl_rows = MAX(term->tl_rows, curwin->w_height);
|
||||||
@@ -1982,7 +1985,7 @@ term_win_entered()
|
|||||||
terminal_loop(int blocking)
|
terminal_loop(int blocking)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int termkey = 0;
|
int termwinkey = 0;
|
||||||
int ret;
|
int ret;
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
int tty_fd = curbuf->b_term->tl_job->jv_channel
|
int tty_fd = curbuf->b_term->tl_job->jv_channel
|
||||||
@@ -1997,7 +2000,7 @@ terminal_loop(int blocking)
|
|||||||
in_terminal_loop = curbuf->b_term;
|
in_terminal_loop = curbuf->b_term;
|
||||||
|
|
||||||
if (*curwin->w_p_twk != NUL)
|
if (*curwin->w_p_twk != NUL)
|
||||||
termkey = string_to_key(curwin->w_p_twk, TRUE);
|
termwinkey = 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);
|
||||||
|
|
||||||
@@ -2049,9 +2052,9 @@ terminal_loop(int blocking)
|
|||||||
if (ctrl_break_was_pressed)
|
if (ctrl_break_was_pressed)
|
||||||
mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill");
|
mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill");
|
||||||
#endif
|
#endif
|
||||||
/* Was either CTRL-W (termkey) or CTRL-\ pressed?
|
/* Was either CTRL-W (termwinkey) or CTRL-\ pressed?
|
||||||
* Not in a system terminal. */
|
* Not in a system terminal. */
|
||||||
if ((c == (termkey == 0 ? Ctrl_W : termkey) || c == Ctrl_BSL)
|
if ((c == (termwinkey == 0 ? Ctrl_W : termwinkey) || c == Ctrl_BSL)
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
&& !curbuf->b_term->tl_system
|
&& !curbuf->b_term->tl_system
|
||||||
#endif
|
#endif
|
||||||
@@ -2085,15 +2088,15 @@ terminal_loop(int blocking)
|
|||||||
}
|
}
|
||||||
else if (c == Ctrl_C)
|
else if (c == Ctrl_C)
|
||||||
{
|
{
|
||||||
/* "CTRL-W CTRL-C" or 'termkey' CTRL-C: end the job */
|
/* "CTRL-W CTRL-C" or 'termwinkey' CTRL-C: end the job */
|
||||||
mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill");
|
mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill");
|
||||||
}
|
}
|
||||||
else if (termkey == 0 && c == '.')
|
else if (termwinkey == 0 && c == '.')
|
||||||
{
|
{
|
||||||
/* "CTRL-W .": send CTRL-W to the job */
|
/* "CTRL-W .": send CTRL-W to the job */
|
||||||
c = Ctrl_W;
|
c = Ctrl_W;
|
||||||
}
|
}
|
||||||
else if (termkey == 0 && c == Ctrl_BSL)
|
else if (termwinkey == 0 && c == Ctrl_BSL)
|
||||||
{
|
{
|
||||||
/* "CTRL-W CTRL-\": send CTRL-\ to the job */
|
/* "CTRL-W CTRL-\": send CTRL-\ to the job */
|
||||||
c = Ctrl_BSL;
|
c = Ctrl_BSL;
|
||||||
@@ -2110,7 +2113,7 @@ terminal_loop(int blocking)
|
|||||||
term_paste_register(prev_c);
|
term_paste_register(prev_c);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (termkey == 0 || c != termkey)
|
else if (termwinkey == 0 || c != termwinkey)
|
||||||
{
|
{
|
||||||
stuffcharReadbuff(Ctrl_W);
|
stuffcharReadbuff(Ctrl_W);
|
||||||
stuffcharReadbuff(c);
|
stuffcharReadbuff(c);
|
||||||
@@ -2886,9 +2889,9 @@ term_update_window(win_T *wp)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If the window was resized a redraw will be triggered and we get here.
|
* If the window was resized a redraw will be triggered and we get here.
|
||||||
* Adjust the size of the vterm unless 'termsize' specifies a fixed size.
|
* Adjust the size of the vterm unless 'termwinsize' specifies a fixed size.
|
||||||
*/
|
*/
|
||||||
minsize = parse_termsize(wp, &rows, &cols);
|
minsize = parse_termwinsize(wp, &rows, &cols);
|
||||||
|
|
||||||
newrows = 99999;
|
newrows = 99999;
|
||||||
newcols = 99999;
|
newcols = 99999;
|
||||||
|
@@ -131,7 +131,6 @@ let test_values = {
|
|||||||
\ 'term': [[], []],
|
\ 'term': [[], []],
|
||||||
\ 'termguicolors': [[], []],
|
\ 'termguicolors': [[], []],
|
||||||
\ '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']],
|
\ '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']],
|
||||||
|
@@ -57,7 +57,7 @@ func RunVimInTerminal(arguments, options)
|
|||||||
" Add -v to have gvim run in the terminal (if possible)
|
" Add -v to have gvim run in the terminal (if possible)
|
||||||
let cmd .= ' -v ' . a:arguments
|
let cmd .= ' -v ' . a:arguments
|
||||||
let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols})
|
let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols})
|
||||||
if &termsize == ''
|
if &termwinsize == ''
|
||||||
call assert_equal([rows, cols], term_getsize(buf))
|
call assert_equal([rows, cols], term_getsize(buf))
|
||||||
else
|
else
|
||||||
let rows = term_getsize(buf)[0]
|
let rows = term_getsize(buf)[0]
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
1794,
|
||||||
/**/
|
/**/
|
||||||
1793,
|
1793,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user