To: vim_dev@googlegroups.com Subject: Patch 8.0.1794 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1794 Problem: Duplicate term options after renaming. Solution: Remove the old names 'termkey', 'termsize' and 'terminalscroll'. Files: src/option.c, src/terminal.c, src/option.h, src/testdir/gen_opt_test.vim, src/testdir/screendump.vim *** ../vim-8.0.1793/src/option.c 2018-05-01 15:47:30.296975434 +0200 --- src/option.c 2018-05-05 16:27:58.521985340 +0200 *************** *** 375,381 **** static char_u *p_keymap; #endif #ifdef FEAT_TERMINAL ! static long p_twsl; #endif /* Saved values for when 'bin' is set. */ --- 375,381 ---- static char_u *p_keymap; #endif #ifdef FEAT_TERMINAL ! static long p_twsl; /* 'termwinscroll' */ #endif /* Saved values for when 'bin' is set. */ *************** *** 2754,2789 **** {(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 - SCRIPTID_INIT}, {"termwinkey", "twk", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, #ifdef FEAT_TERMINAL (char_u *)VAR_WIN, PV_TWK, --- 2754,2759 ---- *************** *** 3805,3827 **** dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; if (flags & P_STRING) { ! /* skip 'termkey' and 'termsize, they are duplicates of ! * 'termwinkey' and 'termwinsize' */ ! if (STRCMP(options[opt_idx].fullname, "termkey") != 0 ! && STRCMP(options[opt_idx].fullname, "termsize") != 0) { ! /* Use set_string_option_direct() for local options to handle ! * freeing and allocating the value. */ ! if (options[opt_idx].indir != PV_NONE) ! set_string_option_direct(NULL, opt_idx, ! 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) --- 3775,3791 ---- dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; if (flags & P_STRING) { ! /* Use set_string_option_direct() for local options to handle ! * freeing and allocating the value. */ ! if (options[opt_idx].indir != PV_NONE) ! set_string_option_direct(NULL, opt_idx, ! 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) *** ../vim-8.0.1793/src/terminal.c 2018-05-03 20:40:15.714154543 +0200 --- src/terminal.c 2018-05-05 16:26:11.146610285 +0200 *************** *** 51,56 **** --- 51,59 ---- * a redraw is faster. * - Copy text in the vterm to the Vim buffer once in a while, so that * 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) * - For the GUI fill termios with default values, perhaps like pangoterm: * http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134 *************** *** 202,214 **** */ /* ! * Parse 'termsize' and set "rows" and "cols" for the terminal size in the * current window. * 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". */ static int ! parse_termsize(win_T *wp, int *rows, int *cols) { int minsize = FALSE; --- 205,217 ---- */ /* ! * Parse 'termwinsize' and set "rows" and "cols" for the terminal size in the * current window. * 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". */ static int ! parse_termwinsize(win_T *wp, int *rows, int *cols) { int minsize = FALSE; *************** *** 232,238 **** } /* ! * Determine the terminal size from 'termsize' and the current window. */ static void set_term_and_win_size(term_T *term) --- 235,241 ---- } /* ! * Determine the terminal size from 'termwinsize' and the current window. */ static void set_term_and_win_size(term_T *term) *************** *** 247,253 **** return; } #endif ! if (parse_termsize(curwin, &term->tl_rows, &term->tl_cols)) { if (term->tl_rows != 0) term->tl_rows = MAX(term->tl_rows, curwin->w_height); --- 250,256 ---- return; } #endif ! if (parse_termwinsize(curwin, &term->tl_rows, &term->tl_cols)) { if (term->tl_rows != 0) term->tl_rows = MAX(term->tl_rows, curwin->w_height); *************** *** 1982,1988 **** terminal_loop(int blocking) { int c; ! int termkey = 0; int ret; #ifdef UNIX int tty_fd = curbuf->b_term->tl_job->jv_channel --- 1985,1991 ---- terminal_loop(int blocking) { int c; ! int termwinkey = 0; int ret; #ifdef UNIX int tty_fd = curbuf->b_term->tl_job->jv_channel *************** *** 1997,2003 **** in_terminal_loop = curbuf->b_term; 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); --- 2000,2006 ---- in_terminal_loop = curbuf->b_term; if (*curwin->w_p_twk != NUL) ! termwinkey = string_to_key(curwin->w_p_twk, TRUE); position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); may_set_cursor_props(curbuf->b_term); *************** *** 2049,2057 **** if (ctrl_break_was_pressed) mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); #endif ! /* Was either CTRL-W (termkey) or CTRL-\ pressed? * Not in a system terminal. */ ! if ((c == (termkey == 0 ? Ctrl_W : termkey) || c == Ctrl_BSL) #ifdef FEAT_GUI && !curbuf->b_term->tl_system #endif --- 2052,2060 ---- if (ctrl_break_was_pressed) mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); #endif ! /* Was either CTRL-W (termwinkey) or CTRL-\ pressed? * Not in a system terminal. */ ! if ((c == (termwinkey == 0 ? Ctrl_W : termwinkey) || c == Ctrl_BSL) #ifdef FEAT_GUI && !curbuf->b_term->tl_system #endif *************** *** 2085,2099 **** } else if (c == Ctrl_C) { ! /* "CTRL-W CTRL-C" or 'termkey' CTRL-C: end the job */ mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); } ! else if (termkey == 0 && c == '.') { /* "CTRL-W .": send CTRL-W to the job */ c = Ctrl_W; } ! else if (termkey == 0 && c == Ctrl_BSL) { /* "CTRL-W CTRL-\": send CTRL-\ to the job */ c = Ctrl_BSL; --- 2088,2102 ---- } else if (c == Ctrl_C) { ! /* "CTRL-W CTRL-C" or 'termwinkey' CTRL-C: end the job */ mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); } ! else if (termwinkey == 0 && c == '.') { /* "CTRL-W .": send CTRL-W to the job */ c = Ctrl_W; } ! else if (termwinkey == 0 && c == Ctrl_BSL) { /* "CTRL-W CTRL-\": send CTRL-\ to the job */ c = Ctrl_BSL; *************** *** 2110,2116 **** term_paste_register(prev_c); continue; } ! else if (termkey == 0 || c != termkey) { stuffcharReadbuff(Ctrl_W); stuffcharReadbuff(c); --- 2113,2119 ---- term_paste_register(prev_c); continue; } ! else if (termwinkey == 0 || c != termwinkey) { stuffcharReadbuff(Ctrl_W); stuffcharReadbuff(c); *************** *** 2886,2894 **** /* * 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. */ ! minsize = parse_termsize(wp, &rows, &cols); newrows = 99999; newcols = 99999; --- 2889,2897 ---- /* * If the window was resized a redraw will be triggered and we get here. ! * Adjust the size of the vterm unless 'termwinsize' specifies a fixed size. */ ! minsize = parse_termwinsize(wp, &rows, &cols); newrows = 99999; newcols = 99999; *** ../vim-8.0.1793/src/option.h 2018-04-21 20:02:32.738539943 +0200 --- src/option.h 2018-05-05 16:28:11.721939980 +0200 *************** *** 849,857 **** #ifdef FEAT_ARABIC EXTERN int p_tbidi; /* 'termbidi' */ #endif - #ifdef FEAT_TERMINAL - EXTERN long p_tlsl; /* 'terminalscroll' */ - #endif #ifdef FEAT_MBYTE EXTERN char_u *p_tenc; /* 'termencoding' */ #endif --- 849,854 ---- *** ../vim-8.0.1793/src/testdir/gen_opt_test.vim 2018-04-21 20:02:32.738539943 +0200 --- src/testdir/gen_opt_test.vim 2018-05-05 16:32:49.044826150 +0200 *************** *** 131,137 **** \ 'term': [[], []], \ 'termguicolors': [[], []], \ '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']], --- 131,136 ---- *** ../vim-8.0.1793/src/testdir/screendump.vim 2018-04-28 21:34:35.866806116 +0200 --- src/testdir/screendump.vim 2018-05-05 16:33:08.564738296 +0200 *************** *** 57,63 **** " Add -v to have gvim run in the terminal (if possible) let cmd .= ' -v ' . a:arguments let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols}) ! if &termsize == '' call assert_equal([rows, cols], term_getsize(buf)) else let rows = term_getsize(buf)[0] --- 57,63 ---- " Add -v to have gvim run in the terminal (if possible) let cmd .= ' -v ' . a:arguments let buf = term_start(cmd, {'curwin': 1, 'term_rows': rows, 'term_cols': cols}) ! if &termwinsize == '' call assert_equal([rows, cols], term_getsize(buf)) else let rows = term_getsize(buf)[0] *** ../vim-8.0.1793/src/version.c 2018-05-05 15:47:14.050089915 +0200 --- src/version.c 2018-05-05 16:35:32.572061506 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1794, /**/ -- There are 2 kinds of people in my world: those who know Unix, Perl, Vim, GNU, Linux, etc, and those who know COBOL. It gets very difficult for me at parties, not knowing which group to socialise with :-) Sitaram Chamarty /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///