From 8c94a549051cc4d4cbb8cabd321724a85fe40c23 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 15 Apr 2018 12:55:13 +0200 Subject: [PATCH 1/6] patch 8.0.1715: terminal buffer can be 1 more than 'terminalscroll' lines Problem: Terminal buffer can be 1 more than 'terminalscroll' lines. Solution: Change > to >=. --- src/terminal.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/terminal.c b/src/terminal.c index be594c405b..93b6f9286c 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -2518,7 +2518,7 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user) /* If the number of lines that are stored goes over 'termscrollback' then * delete the first 10%. */ - if (term->tl_scrollback.ga_len > p_tlsl) + if (term->tl_scrollback.ga_len >= p_tlsl) { int todo = p_tlsl / 10; int i; diff --git a/src/version.c b/src/version.c index 76596f2bf8..6ac76faeb8 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1715, /**/ 1714, /**/ From ac3e830065f1e54c422cdd2f3157fb35fac27e04 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 15 Apr 2018 13:10:44 +0200 Subject: [PATCH 2/6] patch 8.0.1716: test for term_setsize() does not give a good error message Problem: Test for term_setsize() does not give a good error message. Solution: use assert_inrange(). --- src/testdir/test_terminal.vim | 3 +-- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 95a131be74..6e101cfc9b 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -283,8 +283,7 @@ func Test_terminal_scrollback() let rows = term_getsize(buf)[0] call WaitFor({-> term_getline(buf, rows - 1) =~ '149'}) let lines = line('$') - call assert_true(lines <= 100) - call assert_true(lines > 90) + call assert_inrange(91, 100, lines) call Stop_shell_in_terminal(buf) call term_wait(buf) diff --git a/src/version.c b/src/version.c index 6ac76faeb8..1c6c15d227 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1716, /**/ 1715, /**/ From 3cba73423e5304ef7ccdb2280d65562d2f06f483 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 15 Apr 2018 13:12:46 +0200 Subject: [PATCH 3/6] patch 8.0.1717: C89 check causes too much trouble Problem: C89 check causes too much trouble. Solution: Remove enforcing C89 for now. --- src/auto/configure | 6 ------ src/configure.ac | 10 ---------- src/version.c | 2 ++ 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index 29dadf2747..fc7bb5a256 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -4206,8 +4206,6 @@ if test "$GCC" = yes; then CFLAGS="$CFLAGS -fno-strength-reduce" fi fi - - CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang version" >&5 @@ -14434,10 +14432,6 @@ if test "$zOSUnix" = "yes"; then CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" fi -if test "$GCC" = yes -a "$GUITYPE" != "GTK" -a "X$RUBY_CFLAGS" = "X"; then - CFLAGS="$CFLAGS -ansi" -fi - ac_config_files="$ac_config_files auto/config.mk:config.mk.in" cat >confcache <<\_ACEOF diff --git a/src/configure.ac b/src/configure.ac index eef443b741..ff0c726fc6 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -61,9 +61,6 @@ if test "$GCC" = yes; then CFLAGS="$CFLAGS -fno-strength-reduce" fi fi - - dnl Declare what standards the code should comply with - CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700" fi dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a @@ -4403,13 +4400,6 @@ if test "$zOSUnix" = "yes"; then CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" fi -dnl Declare what standards the code should comply with. -dnl But not when using GTK, the header files cause all kinds of warnings. -dnl But not when using Ruby, it needs "inline". -if test "$GCC" = yes -a "$GUITYPE" != "GTK" -a "X$RUBY_CFLAGS" = "X"; then - CFLAGS="$CFLAGS -ansi" -fi - dnl write output files AC_OUTPUT(auto/config.mk:config.mk.in) diff --git a/src/version.c b/src/version.c index 1c6c15d227..207048f129 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1717, /**/ 1716, /**/ From 6c672194cd06fb1ab1289475aad31a9769bdb2ad Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 15 Apr 2018 13:28:42 +0200 Subject: [PATCH 4/6] patch 8.0.1718: terminal scrollback test fails on MS-Windows Problem: Terminal scrollback test fails on MS-Windows. Solution: Check for the last line of output anticipating there might be an empty line below it. --- src/testdir/test_terminal.vim | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 6e101cfc9b..5f330f7b19 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -281,7 +281,8 @@ func Test_terminal_scrollback() call term_sendkeys(buf, "cat Xtext\") endif let rows = term_getsize(buf)[0] - call WaitFor({-> term_getline(buf, rows - 1) =~ '149'}) + " On MS-Windows there is an empty line, check both last line and above it. + call WaitFor({-> term_getline(buf, rows - 1) . term_getline(buf, rows - 2) =~ '149'}) let lines = line('$') call assert_inrange(91, 100, lines) diff --git a/src/version.c b/src/version.c index 207048f129..be4e4ed81b 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1718, /**/ 1717, /**/ From e1a32310d5e9684608b893ab8295191d63178b4e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 15 Apr 2018 16:03:25 +0200 Subject: [PATCH 5/6] patch 8.0.1719: cannot specify which Python executable configure should use Problem: Cannot specify which Python executable configure should use. Solution: Add --with-python-command and --with-python3-command. --- src/auto/configure | 40 ++++++++++++++++++++++++++++++++++++++-- src/configure.ac | 24 ++++++++++++++++++++---- src/version.c | 2 ++ 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index fc7bb5a256..8ecff53a7d 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -802,8 +802,10 @@ enable_mzschemeinterp with_plthome enable_perlinterp enable_pythoninterp +with_python_command with_python_config_dir enable_python3interp +with_python3_command with_python3_config_dir enable_tclinterp with_tclsh @@ -1532,8 +1534,10 @@ Optional Packages: --with-lua-prefix=PFX Prefix where Lua is installed. --with-luajit Link with LuaJIT instead of Lua. --with-plthome=PLTHOME Use PLTHOME. - --with-python-config-dir=PATH Python's config directory - --with-python3-config-dir=PATH Python's config directory + --with-python-command=NAME name of the Python 2 command (default: python2 or python) + --with-python-config-dir=PATH Python's config directory (deprecated) + --with-python3-command=NAME name of the Python 3 command (default: python3 or python) + --with-python3-config-dir=PATH Python's config directory (deprecated) --with-tclsh=PATH which tclsh to use (default: tclsh8.0) --with-ruby-command=RUBY name of the Ruby command (default: ruby) --with-x use the X Window System @@ -5937,6 +5941,21 @@ if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; th as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-python-command argument" >&5 +$as_echo_n "checking --with-python-command argument... " >&6; } + + +# Check whether --with-python-command was given. +if test "${with_python_command+set}" = set; then : + withval=$with_python_command; vi_cv_path_python="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_python" >&5 +$as_echo "$vi_cv_path_python" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "X$vi_cv_path_python" = "X"; then for ac_prog in python2 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -5982,6 +6001,7 @@ fi test -n "$vi_cv_path_python" && break done + fi if test "X$vi_cv_path_python" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python version" >&5 @@ -6271,6 +6291,21 @@ if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-python3-command argument" >&5 +$as_echo_n "checking --with-python3-command argument... " >&6; } + + +# Check whether --with-python3-command was given. +if test "${with_python3_command+set}" = set; then : + withval=$with_python3_command; vi_cv_path_python3="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vi_cv_path_python3" >&5 +$as_echo "$vi_cv_path_python3" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "X$vi_cv_path_python3" = "X"; then for ac_prog in python3 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -6316,6 +6351,7 @@ fi test -n "$vi_cv_path_python3" && break done + fi if test "X$vi_cv_path_python3" != "X"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python version" >&5 diff --git a/src/configure.ac b/src/configure.ac index ff0c726fc6..e37a26790f 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -1117,7 +1117,15 @@ if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; th fi dnl -- find the python executable - AC_PATH_PROGS(vi_cv_path_python, python2 python) + AC_MSG_CHECKING(--with-python-command argument) + AC_SUBST(vi_cv_path_python) + AC_ARG_WITH(python-command, [ --with-python-command=NAME name of the Python 2 command (default: python2 or python)], + vi_cv_path_python="$withval"; AC_MSG_RESULT($vi_cv_path_python), + AC_MSG_RESULT(no)) + + if test "X$vi_cv_path_python" = "X"; then + AC_PATH_PROGS(vi_cv_path_python, python2 python) + fi if test "X$vi_cv_path_python" != "X"; then dnl -- get its version number @@ -1156,7 +1164,7 @@ if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; th dnl -- where the Python implementation library archives are AC_ARG_WITH(python-config-dir, - [ --with-python-config-dir=PATH Python's config directory], + [ --with-python-config-dir=PATH Python's config directory (deprecated)], [ vi_cv_path_python_conf="${withval}"; have_python_config_dir=1 ] ) AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf, @@ -1343,7 +1351,15 @@ if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; fi dnl -- find the python3 executable - AC_PATH_PROGS(vi_cv_path_python3, python3 python) + AC_MSG_CHECKING(--with-python3-command argument) + AC_SUBST(vi_cv_path_python3) + AC_ARG_WITH(python3-command, [ --with-python3-command=NAME name of the Python 3 command (default: python3 or python)], + vi_cv_path_python3="$withval"; AC_MSG_RESULT($vi_cv_path_python3), + AC_MSG_RESULT(no)) + + if test "X$vi_cv_path_python3" = "X"; then + AC_PATH_PROGS(vi_cv_path_python3, python3 python) + fi if test "X$vi_cv_path_python3" != "X"; then dnl -- get its version number @@ -1393,7 +1409,7 @@ if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; dnl -- where the Python implementation library archives are AC_ARG_WITH(python3-config-dir, - [ --with-python3-config-dir=PATH Python's config directory], + [ --with-python3-config-dir=PATH Python's config directory (deprecated)], [ vi_cv_path_python3_conf="${withval}"; have_python3_config_dir=1 ] ) AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf, diff --git a/src/version.c b/src/version.c index be4e4ed81b..7ce1c9c103 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1719, /**/ 1718, /**/ From 802bfb14636b24d86d0ca8e0947d808b9b7c941e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 15 Apr 2018 17:28:13 +0200 Subject: [PATCH 6/6] patch 8.0.1720: when a timer is running a terminal window may not close Problem: When a timer is running a terminal window may not close after a shell has exited. Solution: Call job_status() more often. --- src/terminal.c | 87 +++++++++++++++++++++++++++++++++----------------- src/version.c | 2 ++ 2 files changed, 59 insertions(+), 30 deletions(-) diff --git a/src/terminal.c b/src/terminal.c index 93b6f9286c..0d2dab8ab7 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -40,17 +40,18 @@ * TODO: * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for * redirection. Probably in call to channel_set_pipes(). + * - Win32: Redirecting output does not work, Test_terminal_redir_file() + * is disabled. * - Copy text in the vterm to the Vim buffer once in a while, so that * completion works. + * - When starting terminal window with shell in terminal, then using :gui to + * switch to GUI, shell stops working. Scrollback seems wrong, command + * running in shell is still running. * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito * Higashi, 2017 Sep 19) * - after resizing windows overlap. (Boris Staletic, #2164) - * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file() - * is disabled. * - cursor blinks in terminal on widows with a timer. (xtal8, #2142) * - Termdebug does not work when Vim build with mzscheme. gdb hangs. - * - MS-Windows GUI: WinBar has tearoff item - * - MS-Windows GUI: still need to type a key after shell exits? #1924 * - After executing a shell command the status line isn't redraw. * - add test for giving error for invalid 'termsize' value. * - support minimal size when 'termsize' is "rows*cols". @@ -59,7 +60,7 @@ * - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed) * - For the GUI fill termios with default values, perhaps like pangoterm: * http://bazaar.launchpad.net/~leonerd/pangoterm/trunk/view/head:/main.c#L134 - * - when 'encoding' is not utf-8, or the job is using another encoding, setup + * - When 'encoding' is not utf-8, or the job is using another encoding, setup * conversions. */ @@ -1221,19 +1222,34 @@ term_convert_key(term_T *term, int c, char *buf) return (int)vterm_output_read(vterm, buf, KEY_BUF_LEN); } +/* + * Return TRUE if the job for "term" is still running. + * If "check_job_status" is TRUE update the job status. + */ + static int +term_job_running_check(term_T *term, int check_job_status) +{ + /* Also consider the job finished when the channel is closed, to avoid a + * race condition when updating the title. */ + if (term != NULL + && term->tl_job != NULL + && channel_is_open(term->tl_job->jv_channel)) + { + if (check_job_status) + job_status(term->tl_job); + return (term->tl_job->jv_status == JOB_STARTED + || term->tl_job->jv_channel->ch_keep_open); + } + return FALSE; +} + /* * Return TRUE if the job for "term" is still running. */ int term_job_running(term_T *term) { - /* Also consider the job finished when the channel is closed, to avoid a - * race condition when updating the title. */ - return term != NULL - && term->tl_job != NULL - && channel_is_open(term->tl_job->jv_channel) - && (term->tl_job->jv_status == JOB_STARTED - || term->tl_job->jv_channel->ch_keep_open); + return term_job_running_check(term, FALSE); } /* @@ -1891,6 +1907,32 @@ prepare_restore_cursor_props(void) may_output_cursor_props(); } +/* + * Returns TRUE if the current window contains a terminal and we are sending + * keys to the job. + * If "check_job_status" is TRUE update the job status. + */ + static int +term_use_loop_check(int check_job_status) +{ + term_T *term = curbuf->b_term; + + return term != NULL + && !term->tl_normal_mode + && term->tl_vterm != NULL + && term_job_running_check(term, check_job_status); +} + +/* + * Returns TRUE if the current window contains a terminal and we are sending + * keys to the job. + */ + int +term_use_loop(void) +{ + return term_use_loop_check(FALSE); +} + /* * Called when entering a window with the mouse. If this is a terminal window * we may want to change state. @@ -1902,7 +1944,7 @@ term_win_entered() if (term != NULL) { - if (term_use_loop()) + if (term_use_loop_check(TRUE)) { reset_VIsual_and_resel(); if (State & INSERT) @@ -1914,21 +1956,6 @@ term_win_entered() } } -/* - * Returns TRUE if the current window contains a terminal and we are sending - * keys to the job. - */ - int -term_use_loop(void) -{ - term_T *term = curbuf->b_term; - - return term != NULL - && !term->tl_normal_mode - && term->tl_vterm != NULL - && term_job_running(term); -} - /* * Wait for input and send it to the job. * When "blocking" is TRUE wait for a character to be typed. Otherwise return @@ -1976,7 +2003,7 @@ terminal_loop(int blocking) restore_cursor = TRUE; c = term_vgetc(); - if (!term_use_loop()) + if (!term_use_loop_check(TRUE)) { /* Job finished while waiting for a character. Push back the * received character. */ @@ -2027,7 +2054,7 @@ terminal_loop(int blocking) #ifdef FEAT_CMDL_INFO clear_showcmd(); #endif - if (!term_use_loop()) + if (!term_use_loop_check(TRUE)) /* job finished while waiting for a character */ break; diff --git a/src/version.c b/src/version.c index 7ce1c9c103..2d28206981 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1720, /**/ 1719, /**/