Skip to content


Browse files Browse the repository at this point in the history
patch 8.0.1665: when running a terminal from the GUI 'term' is not us…

Problem:    When running a terminal from the GUI 'term' is not useful.
Solution:   Use $TERM in the GUI if it starts with "xterm". (closes #2776)
  • Loading branch information
brammool committed Apr 5, 2018
1 parent 3aa67fb commit 9a993e3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion runtime/doc/terminal.txt
Expand Up @@ -352,7 +352,9 @@ On Unix a pty is used to make it possible to run all kinds of commands. You
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
Expand Down
16 changes: 14 additions & 2 deletions src/os_unix.c
Expand Up @@ -5579,11 +5579,23 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)

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");
/* 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";
STRNCMP(T_NAME, "xterm", 5) == 0
? (char *)T_NAME : "xterm");
# endif
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -762,6 +762,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
Expand Down

0 comments on commit 9a993e3

Please sign in to comment.