Mercurial > vim
comparison src/terminal.c @ 13845:f22db93bd887 v8.0.1794
patch 8.0.1794: duplicate term options after renaming
commit https://github.com/vim/vim/commit/b833c1ef7be1ed216a967dd7262473ec97084fa2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 5 16:36:06 2018 +0200
patch 8.0.1794: duplicate term options after renaming
Problem: Duplicate term options after renaming.
Solution: Remove the old names 'termkey', 'termsize' and 'terminalscroll'.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 05 May 2018 16:45:05 +0200 |
parents | 8e583c52eb44 |
children | fa0dcdaec6a3 |
comparison
equal
deleted
inserted
replaced
13844:11e433673c49 | 13845:f22db93bd887 |
---|---|
49 * - handle_moverect() scrolls one line at a time. Postpone scrolling, count | 49 * - handle_moverect() scrolls one line at a time. Postpone scrolling, count |
50 * the number of lines, until a redraw happens. Then if scrolling many lines | 50 * the number of lines, until a redraw happens. Then if scrolling many lines |
51 * a redraw is faster. | 51 * a redraw is faster. |
52 * - Copy text in the vterm to the Vim buffer once in a while, so that | 52 * - Copy text in the vterm to the Vim buffer once in a while, so that |
53 * completion works. | 53 * completion works. |
54 * - When the job only outputs lines, we could handle resizing the terminal | |
55 * better: store lines separated by line breaks, instead of screen lines, | |
56 * then when the window is resized redraw those lines. | |
54 * - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed) | 57 * - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed) |
55 * - For the GUI fill termios with default values, perhaps like pangoterm: | 58 * - For the GUI fill termios with default values, perhaps like pangoterm: |
56 * http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134 | 59 * http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134 |
57 * - When 'encoding' is not utf-8, or the job is using another encoding, setup | 60 * - When 'encoding' is not utf-8, or the job is using another encoding, setup |
58 * conversions. | 61 * conversions. |
200 /************************************** | 203 /************************************** |
201 * 1. Generic code for all systems. | 204 * 1. Generic code for all systems. |
202 */ | 205 */ |
203 | 206 |
204 /* | 207 /* |
205 * Parse 'termsize' and set "rows" and "cols" for the terminal size in the | 208 * Parse 'termwinsize' and set "rows" and "cols" for the terminal size in the |
206 * current window. | 209 * current window. |
207 * Sets "rows" and/or "cols" to zero when it should follow the window size. | 210 * Sets "rows" and/or "cols" to zero when it should follow the window size. |
208 * Return TRUE if the size is the minimum size: "24*80". | 211 * Return TRUE if the size is the minimum size: "24*80". |
209 */ | 212 */ |
210 static int | 213 static int |
211 parse_termsize(win_T *wp, int *rows, int *cols) | 214 parse_termwinsize(win_T *wp, int *rows, int *cols) |
212 { | 215 { |
213 int minsize = FALSE; | 216 int minsize = FALSE; |
214 | 217 |
215 *rows = 0; | 218 *rows = 0; |
216 *cols = 0; | 219 *cols = 0; |
230 } | 233 } |
231 return minsize; | 234 return minsize; |
232 } | 235 } |
233 | 236 |
234 /* | 237 /* |
235 * Determine the terminal size from 'termsize' and the current window. | 238 * Determine the terminal size from 'termwinsize' and the current window. |
236 */ | 239 */ |
237 static void | 240 static void |
238 set_term_and_win_size(term_T *term) | 241 set_term_and_win_size(term_T *term) |
239 { | 242 { |
240 #ifdef FEAT_GUI | 243 #ifdef FEAT_GUI |
245 term->tl_rows = Rows; | 248 term->tl_rows = Rows; |
246 term->tl_cols = Columns; | 249 term->tl_cols = Columns; |
247 return; | 250 return; |
248 } | 251 } |
249 #endif | 252 #endif |
250 if (parse_termsize(curwin, &term->tl_rows, &term->tl_cols)) | 253 if (parse_termwinsize(curwin, &term->tl_rows, &term->tl_cols)) |
251 { | 254 { |
252 if (term->tl_rows != 0) | 255 if (term->tl_rows != 0) |
253 term->tl_rows = MAX(term->tl_rows, curwin->w_height); | 256 term->tl_rows = MAX(term->tl_rows, curwin->w_height); |
254 if (term->tl_cols != 0) | 257 if (term->tl_cols != 0) |
255 term->tl_cols = MAX(term->tl_cols, curwin->w_width); | 258 term->tl_cols = MAX(term->tl_cols, curwin->w_width); |
1980 */ | 1983 */ |
1981 int | 1984 int |
1982 terminal_loop(int blocking) | 1985 terminal_loop(int blocking) |
1983 { | 1986 { |
1984 int c; | 1987 int c; |
1985 int termkey = 0; | 1988 int termwinkey = 0; |
1986 int ret; | 1989 int ret; |
1987 #ifdef UNIX | 1990 #ifdef UNIX |
1988 int tty_fd = curbuf->b_term->tl_job->jv_channel | 1991 int tty_fd = curbuf->b_term->tl_job->jv_channel |
1989 ->ch_part[get_tty_part(curbuf->b_term)].ch_fd; | 1992 ->ch_part[get_tty_part(curbuf->b_term)].ch_fd; |
1990 #endif | 1993 #endif |
1995 * shell and ++close was used. Therefore use curbuf->b_term instead of a | 1998 * shell and ++close was used. Therefore use curbuf->b_term instead of a |
1996 * stored reference. */ | 1999 * stored reference. */ |
1997 in_terminal_loop = curbuf->b_term; | 2000 in_terminal_loop = curbuf->b_term; |
1998 | 2001 |
1999 if (*curwin->w_p_twk != NUL) | 2002 if (*curwin->w_p_twk != NUL) |
2000 termkey = string_to_key(curwin->w_p_twk, TRUE); | 2003 termwinkey = string_to_key(curwin->w_p_twk, TRUE); |
2001 position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); | 2004 position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); |
2002 may_set_cursor_props(curbuf->b_term); | 2005 may_set_cursor_props(curbuf->b_term); |
2003 | 2006 |
2004 while (blocking || vpeekc_nomap() != NUL) | 2007 while (blocking || vpeekc_nomap() != NUL) |
2005 { | 2008 { |
2047 /* On Windows winpty handles CTRL-C, don't send a CTRL_C_EVENT. | 2050 /* On Windows winpty handles CTRL-C, don't send a CTRL_C_EVENT. |
2048 * Use CTRL-BREAK to kill the job. */ | 2051 * Use CTRL-BREAK to kill the job. */ |
2049 if (ctrl_break_was_pressed) | 2052 if (ctrl_break_was_pressed) |
2050 mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); | 2053 mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); |
2051 #endif | 2054 #endif |
2052 /* Was either CTRL-W (termkey) or CTRL-\ pressed? | 2055 /* Was either CTRL-W (termwinkey) or CTRL-\ pressed? |
2053 * Not in a system terminal. */ | 2056 * Not in a system terminal. */ |
2054 if ((c == (termkey == 0 ? Ctrl_W : termkey) || c == Ctrl_BSL) | 2057 if ((c == (termwinkey == 0 ? Ctrl_W : termwinkey) || c == Ctrl_BSL) |
2055 #ifdef FEAT_GUI | 2058 #ifdef FEAT_GUI |
2056 && !curbuf->b_term->tl_system | 2059 && !curbuf->b_term->tl_system |
2057 #endif | 2060 #endif |
2058 ) | 2061 ) |
2059 { | 2062 { |
2083 /* Send both keys to the terminal. */ | 2086 /* Send both keys to the terminal. */ |
2084 send_keys_to_term(curbuf->b_term, prev_c, TRUE); | 2087 send_keys_to_term(curbuf->b_term, prev_c, TRUE); |
2085 } | 2088 } |
2086 else if (c == Ctrl_C) | 2089 else if (c == Ctrl_C) |
2087 { | 2090 { |
2088 /* "CTRL-W CTRL-C" or 'termkey' CTRL-C: end the job */ | 2091 /* "CTRL-W CTRL-C" or 'termwinkey' CTRL-C: end the job */ |
2089 mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); | 2092 mch_signal_job(curbuf->b_term->tl_job, (char_u *)"kill"); |
2090 } | 2093 } |
2091 else if (termkey == 0 && c == '.') | 2094 else if (termwinkey == 0 && c == '.') |
2092 { | 2095 { |
2093 /* "CTRL-W .": send CTRL-W to the job */ | 2096 /* "CTRL-W .": send CTRL-W to the job */ |
2094 c = Ctrl_W; | 2097 c = Ctrl_W; |
2095 } | 2098 } |
2096 else if (termkey == 0 && c == Ctrl_BSL) | 2099 else if (termwinkey == 0 && c == Ctrl_BSL) |
2097 { | 2100 { |
2098 /* "CTRL-W CTRL-\": send CTRL-\ to the job */ | 2101 /* "CTRL-W CTRL-\": send CTRL-\ to the job */ |
2099 c = Ctrl_BSL; | 2102 c = Ctrl_BSL; |
2100 } | 2103 } |
2101 else if (c == 'N') | 2104 else if (c == 'N') |
2108 else if (c == '"') | 2111 else if (c == '"') |
2109 { | 2112 { |
2110 term_paste_register(prev_c); | 2113 term_paste_register(prev_c); |
2111 continue; | 2114 continue; |
2112 } | 2115 } |
2113 else if (termkey == 0 || c != termkey) | 2116 else if (termwinkey == 0 || c != termwinkey) |
2114 { | 2117 { |
2115 stuffcharReadbuff(Ctrl_W); | 2118 stuffcharReadbuff(Ctrl_W); |
2116 stuffcharReadbuff(c); | 2119 stuffcharReadbuff(c); |
2117 ret = OK; | 2120 ret = OK; |
2118 goto theend; | 2121 goto theend; |
2884 term->tl_dirty_row_end = MAX_ROW; | 2887 term->tl_dirty_row_end = MAX_ROW; |
2885 } | 2888 } |
2886 | 2889 |
2887 /* | 2890 /* |
2888 * If the window was resized a redraw will be triggered and we get here. | 2891 * If the window was resized a redraw will be triggered and we get here. |
2889 * Adjust the size of the vterm unless 'termsize' specifies a fixed size. | 2892 * Adjust the size of the vterm unless 'termwinsize' specifies a fixed size. |
2890 */ | 2893 */ |
2891 minsize = parse_termsize(wp, &rows, &cols); | 2894 minsize = parse_termwinsize(wp, &rows, &cols); |
2892 | 2895 |
2893 newrows = 99999; | 2896 newrows = 99999; |
2894 newcols = 99999; | 2897 newcols = 99999; |
2895 FOR_ALL_WINDOWS(twp) | 2898 FOR_ALL_WINDOWS(twp) |
2896 { | 2899 { |