# HG changeset patch # User Christian Brabandt # Date 1522960207 -7200 # Node ID 03224283bafc1fc60943c4f734b1203b4b561b82 # Parent 250bb3baaf19233f788f76431c64af2c9ed351e2 patch 8.0.1665: when running a terminal from the GUI 'term' is not useful commit https://github.com/vim/vim/commit/9a993e3c09371bb80d71be62fca53cf954a98f72 Author: Bram Moolenaar Date: Thu Apr 5 22:15:22 2018 +0200 patch 8.0.1665: when running a terminal from the GUI 'term' is not useful Problem: When running a terminal from the GUI 'term' is not useful. Solution: Use $TERM in the GUI if it starts with "xterm". (closes https://github.com/vim/vim/issues/2776) diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -352,7 +352,9 @@ On Unix a pty is used to make it possibl can even run Vim in the terminal! That's used for debugging, see below. Environment variables are used to pass information to the running job: - TERM name of the terminal, from the 'term' option + TERM the name of the terminal, from the 'term' option or + $TERM in the GUI; falls back to "xterm" if it does not + start with "xterm" ROWS number of rows in the terminal initially LINES same as ROWS COLUMNS number of columns in the terminal initially diff --git a/src/os_unix.c b/src/os_unix.c --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5579,11 +5579,23 @@ mch_job_start(char **argv, job_T *job, j # ifdef FEAT_TERMINAL if (options->jo_term_rows > 0) + { + char *term = (char *)T_NAME; + +#ifdef FEAT_GUI + if (term_is_gui(T_NAME)) + /* In the GUI 'term' is not what we want, use $TERM. */ + term = getenv("TERM"); +#endif + /* Use 'term' or $TERM if it starts with "xterm", otherwise fall + * back to "xterm". */ + if (term == NULL || *term == NUL || STRNCMP(term, "xterm", 5) != 0) + term = "xterm"; set_child_environment( (long)options->jo_term_rows, (long)options->jo_term_cols, - STRNCMP(T_NAME, "xterm", 5) == 0 - ? (char *)T_NAME : "xterm"); + term); + } else # endif set_default_child_environment(); diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1665, +/**/ 1664, /**/ 1663,