To: vim_dev@googlegroups.com Subject: Patch 8.0.1665 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1665 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) Files: src/os_unix.c, runtime/doc/terminal.txt *** ../vim-8.0.1664/src/os_unix.c 2018-04-05 22:55:02.056056710 +0200 --- src/os_unix.c 2018-04-05 22:11:12.237443265 +0200 *************** *** 5579,5589 **** # ifdef FEAT_TERMINAL if (options->jo_term_rows > 0) set_child_environment( (long)options->jo_term_rows, (long)options->jo_term_cols, ! STRNCMP(T_NAME, "xterm", 5) == 0 ! ? (char *)T_NAME : "xterm"); else # endif set_default_child_environment(); --- 5579,5601 ---- # 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, ! term); ! } else # endif set_default_child_environment(); *** ../vim-8.0.1664/runtime/doc/terminal.txt 2018-04-05 22:53:57.292399060 +0200 --- runtime/doc/terminal.txt 2018-04-05 22:13:07.376935548 +0200 *************** *** 352,358 **** 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 ROWS number of rows in the terminal initially LINES same as ROWS COLUMNS number of columns in the terminal initially --- 352,360 ---- 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 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 *** ../vim-8.0.1664/src/version.c 2018-04-05 22:53:24.808571054 +0200 --- src/version.c 2018-04-05 22:56:16.927661754 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1665, /**/ -- hundred-and-one symptoms of being an internet addict: 109. You actually read -- and enjoy -- lists like this. /// 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 ///