diff --git a/src/auto/configure b/src/auto/configure index 60a933ba37..6a73151d19 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -804,8 +804,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 with_properly_linked_python2_python3 enable_tclinterp @@ -1528,8 +1530,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-properly-linked-python2-python3 Link with properly linked Python 2 and Python 3. --with-tclsh=PATH which tclsh to use (default: tclsh8.0) --with-ruby-command=RUBY name of the Ruby command (default: ruby) @@ -4204,8 +4208,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 @@ -5988,6 +5990,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. @@ -6033,6 +6050,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 @@ -6329,6 +6347,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. @@ -6374,6 +6407,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 @@ -14566,10 +14600,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 53b64e83b3..652369b40e 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 @@ -1150,7 +1147,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 @@ -1189,7 +1194,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, @@ -1386,7 +1391,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 @@ -1436,7 +1449,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, @@ -4503,13 +4516,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/terminal.c b/src/terminal.c index b62d27c192..8faa0cc85e 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. */ @@ -1226,19 +1227,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); } /* @@ -1896,6 +1912,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. @@ -1907,7 +1949,7 @@ term_win_entered() if (term != NULL) { - if (term_use_loop()) + if (term_use_loop_check(TRUE)) { reset_VIsual_and_resel(); if (State & INSERT) @@ -1919,21 +1961,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 @@ -1981,7 +2008,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. */ @@ -2032,7 +2059,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; @@ -2523,7 +2550,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/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 3ae008052b..8fd1b239cf 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -281,10 +281,10 @@ 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_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 8390534382..692098fb45 100644 --- a/src/version.c +++ b/src/version.c @@ -777,6 +777,18 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1720, +/**/ + 1719, +/**/ + 1718, +/**/ + 1717, +/**/ + 1716, +/**/ + 1715, /**/ 1714, /**/