1
0
forked from aniani/vim

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 #2776)
This commit is contained in:
Bram Moolenaar
2018-04-05 22:15:22 +02:00
parent 3aa67fb453
commit 9a993e3c09
3 changed files with 19 additions and 3 deletions

View File

@@ -5579,11 +5579,23 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
# 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();