diff options
author | ckelsel <ckelsel@hotmail.com> | 2017-08-02 09:24:24 +0800 |
---|---|---|
committer | ckelsel <ckelsel@hotmail.com> | 2017-08-02 09:24:24 +0800 |
commit | b16a4ad49a010a8a2f1019394396fee5facbbd16 (patch) | |
tree | 8ac26ac0549434c20acb12ca6e939c555b710069 | |
parent | 7c7039767aa4d715aea997721b0d759b308a43d4 (diff) | |
parent | 27356de2697ca542ded05ea6c2017a3ca738084f (diff) | |
download | rneovim-b16a4ad49a010a8a2f1019394396fee5facbbd16.tar.gz rneovim-b16a4ad49a010a8a2f1019394396fee5facbbd16.tar.bz2 rneovim-b16a4ad49a010a8a2f1019394396fee5facbbd16.zip |
Merge remote-tracking branch 'upstream/master'
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | config/config.h.in | 2 | ||||
-rw-r--r-- | runtime/bugreport.vim | 1 | ||||
-rw-r--r-- | runtime/doc/options.txt | 6 | ||||
-rw-r--r-- | runtime/doc/quickref.txt | 1 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 5 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 2 | ||||
-rw-r--r-- | runtime/doc/term.txt | 158 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 7 | ||||
-rw-r--r-- | src/nvim/eval.c | 18 | ||||
-rw-r--r-- | src/nvim/eval.lua | 2 | ||||
-rw-r--r-- | src/nvim/log.c | 7 | ||||
-rw-r--r-- | src/nvim/log.h | 2 | ||||
-rw-r--r-- | src/nvim/option.c | 8 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_autocmd.vim | 58 | ||||
-rw-r--r-- | src/nvim/tui/tui.c | 15 | ||||
-rw-r--r-- | src/nvim/version.c | 10 | ||||
-rw-r--r-- | test/functional/legacy/assert_spec.lua | 5 |
20 files changed, 154 insertions, 170 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 099f6e3787..594f631ba0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,6 +192,16 @@ if(CMAKE_EXE_LINKER_FLAGS MATCHES "--sort-common" OR string(REGEX REPLACE "-Wl($| )" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") endif() +check_c_source_compiles(" +#include <execinfo.h> +int main(void) +{ + void *trace[1]; + int trace_size = backtrace(trace, 1); + return 0; +} +" HAVE_EXECINFO_BACKTRACE) + if(MSVC) # XXX: /W4 gives too many warnings. #3241 add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) @@ -324,7 +334,6 @@ main(void) return MSGPACK_OBJECT_FLOAT32; } " MSGPACK_HAS_FLOAT32) - if(MSGPACK_HAS_FLOAT32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_MSGPACK_HAS_FLOAT32") endif() diff --git a/config/config.h.in b/config/config.h.in index f26b5a50a8..962eefd7a7 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -68,4 +68,6 @@ #cmakedefine ORDER_BIG_ENDIAN #define ENDIAN_INCLUDE_FILE <@ENDIAN_INCLUDE_FILE@> +#cmakedefine HAVE_EXECINFO_BACKTRACE + #endif // AUTO_CONFIG_H diff --git a/runtime/bugreport.vim b/runtime/bugreport.vim index f0c045e6c3..650e37940d 100644 --- a/runtime/bugreport.vim +++ b/runtime/bugreport.vim @@ -53,7 +53,6 @@ : scriptnames :endif :set all -:set termcap :if has("autocmd") : au :endif diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index dc968cd666..6406bfe03b 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -22,9 +22,7 @@ achieve special effects. These options come in three forms: *:se* *:set* :se[t] Show all options that differ from their default value. -:se[t] all Show all but terminal options. - -:se[t] termcap Do nothing. Nvim uses |terminfo|. +:se[t] all Show all options. *E518* *E519* :se[t] {option}? Show value of {option}. @@ -2736,7 +2734,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'guicursor' 'gcr' string (default "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20") global Configures the cursor style for each mode. Works in the GUI and many - terminals. See |cursor-shape| for details. + terminals. See |tui-cursor-shape|. To disable cursor-styling, reset the option: > :set guicursor= diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index bcbf8c365d..c4c3dcad88 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -572,7 +572,6 @@ In Insert or Command-line mode: |:set| :se[t] show all modified options |:set| :se[t] all show all options -|:set| :se[t] termcap Do nothing. (|terminfo|) |:set| :se[t] {option} set boolean option (switch it on), show string or number option |:set| :se[t] no{option} reset boolean option (switch it off) diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index d869516bff..91915406cb 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -214,7 +214,7 @@ argument. :set to display option values. When 'verbose' is non-zero messages are printed (for debugging, to stderr). - $TERM (see |TERM|) is not used. + |$TERM| is not used. If Vim appears to be stuck try typing "qa!<Enter>". You don't get a prompt thus you can't see Vim is waiting for you to type something. @@ -349,6 +349,9 @@ argument. *--api-info* --api-info Print msgpack-encoded |api-metadata| and exit. + *--headless* +--headless Do not start the built-in UI. + ============================================================================== 2. Initialization *initialization* *startup* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index a66f547675..fd17e3b381 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4696,7 +4696,7 @@ cterm={attr-list} *highlight-cterm* ctermfg={color-nr} *highlight-ctermfg* *E421* ctermbg={color-nr} *highlight-ctermbg* The {color-nr} argument is a color number. Its range is zero to - (not including) the number of |terminfo-colors| available. + (not including) the number of |tui-colors| available. The actual color with this number depends on the type of terminal and its settings. Sometimes the color also depends on the settings of "cterm". For example, on some systems "cterm=bold ctermfg=3" gives diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index bce944eab5..38900dd826 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,81 +1,67 @@ *term.txt* Nvim - VIM REFERENCE MANUAL by Bram Moolenaar + NVIM REFERENCE MANUAL Terminal information -Vim uses information about the terminal you are using to fill the screen and -recognize what keys you hit. If this information is not correct, the screen -may be messed up or keys may not be recognized. The actions which have to be -performed on the screen are accomplished by outputting a string of -characters. +Nvim (except in |--headless| mode) uses information about the terminal you are +using to present a built-in UI. If that information is not correct, the +screen may be messed up or keys may not be recognized. Type <M-]> to see the table of contents. ============================================================================== Startup *startup-terminal* -When Vim is started a default terminal type is assumed. for MS-DOS this is -the pc terminal, for Unix an ansi terminal. +Nvim (except in |--headless| mode) guesses a terminal type when it starts. +|$TERM| is the primary hint that determines the terminal type. *terminfo* *E557* *E558* *E559* -On Unix the terminfo database is used. There is no access to the terminfo -settings with |:set|. +The terminfo database is used if available. The Unibilium library (used by Nvim to read terminfo) allows you to override -an out-of-date system terminfo database with one in your $HOME/.terminfo/ -directory, in part or in whole. +the system terminfo with one in $HOME/.terminfo/ directory, in part or in +whole. -Building your own up-to-date terminfo database is usually as simple as running -this as a non-superuser: +Building your own terminfo is usually as simple as running this as +a non-superuser: > - wget http://invisible-island.net/datafiles/current/terminfo.src.gz + curl -LO http://invisible-island.net/datafiles/current/terminfo.src.gz gunzip terminfo.src.gz tic terminfo.src < - *TERM* -If you experience terminal difficulties, first ensure that you have set the -correct terminal type in your $TERM environment variable so that Nvim is -pulling the correct entry from the terminfo database in the first place. + *$TERM* +The $TERM environment variable must match the terminal you are using! +Otherwise Nvim cannot know what sequences your terminal expects, and weird +or sub-optimal behavior will result (scrolling quirks, wrong colors, etc.). -Per the terminfo source file from ncurses: +$TERM is also important because it is mirrored by SSH to the remote session, +unlike other common client-end environment variables ($COLORTERM, +$XTERM_VERSION, $VTE_VERSION, $KONSOLE_PROFILE_NAME, $TERM_PROGRAM, ...). - For these terminals Set $TERM to |builtin-terms|? + For this terminal Set $TERM to |builtin-terms|? iTerm.app "iterm" or "iTerm.app" Y anything libvte based "vte" or "vte-256color" Y - (e.g. GNOME Terminal) ("gnome" and "gnome-256color" are - available as aliases for these) + (e.g. GNOME Terminal) (aliases: "gnome", "gnome-256color") tmux "tmux" or "tmux-256color" Y screen "screen" or "screen-256color" Y PuTTY "putty" or "putty-256color" Y Terminal.app "nsterm" N Linux virtual terminal "linux" or "linux-256color" Y -Describing any of these as "xterm" or "xterm-256colour" will not describe the -terminal correctly to Nvim, and will cause various kinds of problematic -behaviours. - -Setting your $TERM environment variable to the correct value also avoids the -problem that SSH does not mirror arbitrary client-end environment variables -such as $COLORTERM, $XTERM_VERSION, $VTE_VERSION, $KONSOLE_PROFILE_NAME, and -$TERM_PROGRAM to the server end, whereas it does send the $TERM environment -variable. - -See |terminfo| for dealing with out of date terminfo databases. - *builtin-terms* *builtin_terms* If a |terminfo| database is not available, or no entry for the terminal type is -found in that database, Nvim will look up the terminal type in a compiled-in -mini-database of terminfo entries for "xterm", "putty", "screen", "tmux", -"rxvt", "iterm", "interix", "linux", "st", "vte", "gnome", and "ansi". +found in that database, Nvim will use a compiled-in mini-database of terminfo +entries for "xterm", "putty", "screen", "tmux", "rxvt", "iterm", "interix", +"linux", "st", "vte", "gnome", and "ansi". The lookup matches the initial portion of the terminal type, so (for example) "putty-256color" and "putty" will both be mapped to the built-in "putty" entry. The built-in terminfo entries describe the terminal as 256-colour -capable if possible. See |termcap-colors|. +capable if possible. See |tui-colors|. If no built-in terminfo record matches the terminal type, the built-in "ansi" terminfo record is used as a final fallback. @@ -87,8 +73,8 @@ supplying an external one with entries for the terminal type. Settings depending on terminal *term-dependent-settings* -If you want to set options or mappings, depending on the terminal name, you -can do this best in your init.vim. Example: > +If you want to set terminal-dependent options or mappings, you can do this in +your init.vim. Example: > if $TERM =~ '^\(rxvt\|screen\|interix\|putty\)\(-.*\)\?$' set notermguicolors @@ -126,63 +112,50 @@ genuine Xterm will not work over an SSH connection, because the environment variable, set by genuine Xterm, that it looks for is not automatically replicated over an SSH login session. - *256-color* *terminfo-colors* *termcap-colors* -Nvim can make use of 256-colour terminals and tries to do so whereever it can. + *tui-colors* +Nvim uses 256 colours by default, ignoring |terminfo| for most terminal types, +including "linux" (whose virtual terminals have had 256-colour support since +4.8) and anything claiming to be "xterm". Also when $COLORTERM or $TERM +contain the string "256". -If the |terminfo| description of the terminal says that it supports fewer -colours, Nvim will override this for many terminal types, including "linux" -(whose virtual terminals have had 256-colour support since version 4.8) and -anything (even if falsely) claiming to be "xterm". It will also set 256 -colours when the COLORTERM or TERM environment variables contain the string -"256" somewhere. - -Nvim similarly assumes that any terminal emulator that sets the COLORTERM -environment variable at all, to anything, is capable of at least 16-colour -operation; and it will override |terminfo| saying that it has fewer colours -available. +Nvim similarly assumes that any terminal emulator that sets $COLORTERM to any +value, is capable of at least 16-colour operation. *true-color* *xterm-true-color* -Nvim supports using true (24-bit) colours in the terminal, on terminals that -support it. It uses the same |terminfo| extensions that were proposed by -RĂ¼diger Sonderfeld in 2013 for this: "setrgbf" and "setrgbb". If your -terminfo definition specifies these, then nothing more is required. - -If your terminfo definition is missing them, then Nvim will decide whether to -add them to your terminfo definition, using the ISO 8613-6:1994/ITU T.416:1993 -control sequences for setting RGB colours, but modified to use semicolons -instead of colons unless the terminal is known to follow the standard. -(Semicolons cause ambiguities that the standard avoided by specifying colons -as a sub-parameter delimiter. A historical misunderstanding meant that many -terminal emulators ended up using semicolons for many years, though.) - -A new convention, pioneered in 2016 by tmux, is the "Tc" terminfo extension. -If your terminal's terminfo definition has this flag, Nvim will add -constructed "setrgbf" and "setrgbb" capabilities as if they had been in the -terminfo definition. - -If your terminal's terminfo definition does not (yet) have this flag, Nvim -will fall back to looking at the TERM and other environment variables. It -will add constructed "setrgbf" and "setrgbb" capabilities in the case of the -the "rxvt", "linux", "st", "tmux", and "iterm" terminal types, or when -Konsole, genuine Xterm, a libvte terminal emulator version 0.36 or later, or a -terminal emulator that sets the COLORTERM environment variable to "truecolor" -is detected. +Nvim emits true (24-bit) colours in the terminal, if 'termguicolors' is set. + +It uses the "setrgbf" and "setrgbb" |terminfo| extensions (proposed by RĂ¼diger +Sonderfeld in 2013). If your terminfo definition is missing them, then Nvim +will decide whether to add them to your terminfo definition, using the ISO +8613-6:1994/ITU T.416:1993 control sequences for setting RGB colours (but +modified to use semicolons instead of colons unless the terminal is known to +follow the standard). + +Another convention, pioneered in 2016 by tmux, is the "Tc" terminfo extension. +If terminfo has this flag, Nvim will add constructed "setrgbf" and "setrgbb" +capabilities as if they had been in the terminfo definition. + +If terminfo does not (yet) have this flag, Nvim will fall back to $TERM and +other environment variables. It will add constructed "setrgbf" and "setrgbb" +capabilities in the case of the the "rxvt", "linux", "st", "tmux", and "iterm" +terminal types, or when Konsole, genuine Xterm, a libvte terminal emulator +version 0.36 or later, or a terminal emulator that sets the COLORTERM +environment variable to "truecolor" is detected. *xterm-resize* Nvim can resize the terminal display on some terminals that implement an -extension pioneered by the dtterm program. |terminfo| does not have a flag -for this extension. So Nvim simply assumes that (all) "dtterm", "xterm", -"teraterm", "rxvt" terminal types, and Konsole, are capable of this. +extension pioneered by dtterm. |terminfo| does not have a flag for this +extension. So Nvim simply assumes that (all) "dtterm", "xterm", "teraterm", +"rxvt" terminal types, and Konsole, are capable of this. - *cursor-shape* *terminfo-cursor-shape* *termcap-cursor-shape* + *tui-cursor-shape* Nvim will adjust the shape of the cursor from a block to a line when in insert mode (or as specified by the 'guicursor' option), on terminals that support it. It uses the same |terminfo| extensions that were pioneered by tmux for -this: "Ss" and "Se". If your terminfo definition specifies these, as some -(such as those based upon "xterm+tmux") do, then nothing more is required. +this: "Ss" and "Se". If your terminfo definition is missing them, then Nvim will decide whether to -add them to your terminfo definition, by looking at the TERM and other +add them to your terminfo definition, by looking at $TERM and other environment variables. For the "rxvt", "putty", "linux", "screen", "teraterm", and "iterm" terminal types, or when Konsole, a libvte-based terminal emulator, or genuine Xterm are detected, it will add constructed @@ -195,19 +168,14 @@ receives from Nvim into whatever control sequence is appropriate for the terminal that it is outputting to. It shares a common mechanism with Nvim, of using the "Ss" and "Se" capabilities from terminfo (for the output terminal) if they are present. Unlike Nvim, if they are not present in terminfo you -will have to add them by setting the tmux "terminal-overrides" setting in -$HOME/.tmux.conf . +must add them by setting "terminal-overrides" in ~/.tmux.conf . See the tmux(1) manual page for the details of how and what to do in the tmux configuration file. It will look something like: > - - set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' + set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' <or (alas!) for Konsole specifically, something more complex like: > - set -ga terminal-overrides \ - 'xterm*:\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%{1}%;%d\007' -<but these are only rough examples that do not include all of the other stuff -that occurs in that setting. - + set -ga terminal-overrides 'xterm*:\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%{1}%;%d\007' +< *cs7-problem* Note: If the terminal settings are changed after running Vim, you might have an illegal combination of settings. This has been reported on Solaris 2.5 diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 23d597e333..1f94a45c74 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -299,13 +299,10 @@ example, 'guicursor' sets the terminal cursor style if possible. *'term'* *E529* *E530* *E531* The 'term' option has a fixed value, present only for script compatibility and intentionally not the same as any known terminal type name. It should be a -rare case in Nvim where one needs |term-dependent-settings|, for which use the -|TERM| environment variable. +rare case in Nvim where one needs |term-dependent-settings|. *termcap* -Nvim never uses the termcap database and only uses |terminfo|. See -|builtin-terms| for what happens on operating systems without a terminfo -database. +Nvim never uses the termcap database, only |terminfo| and |builtin-terms|. *xterm-8bit* *xterm-8-bit* Xterm can be run in a mode where it uses true 8-bit CSI. Supporting this diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 2988225110..78c8dd02db 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19546,18 +19546,22 @@ static const char *find_option_end(const char **const arg, int *const opt_flags) } else if (*p == 'l' && p[1] == ':') { *opt_flags = OPT_LOCAL; p += 2; - } else + } else { *opt_flags = 0; + } - if (!ASCII_ISALPHA(*p)) + if (!ASCII_ISALPHA(*p)) { return NULL; + } *arg = p; - if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL) - p += 4; /* termcap option */ - else - while (ASCII_ISALPHA(*p)) - ++p; + if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL) { + p += 4; // t_xx/termcap option + } else { + while (ASCII_ISALPHA(*p)) { + p++; + } + } return p; } diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 08baae4086..0e359fb61c 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -29,7 +29,7 @@ return { assert_exception={args={1, 2}}, assert_fails={args={1, 2}}, assert_false={args={1, 2}}, - assert_inrange={args={2, 3}}, + assert_inrange={args={3, 4}}, assert_match={args={2, 3}}, assert_notequal={args={2, 3}}, assert_notmatch={args={2, 3}}, diff --git a/src/nvim/log.c b/src/nvim/log.c index 252fe5438d..b64aef3cac 100644 --- a/src/nvim/log.c +++ b/src/nvim/log.c @@ -25,6 +25,10 @@ static uv_mutex_t mutex; # include "log.c.generated.h" #endif +#ifdef HAVE_EXECINFO_BACKTRACE +# include <execinfo.h> +#endif + static bool log_try_create(char *fname) { if (fname == NULL || fname[0] == '\0') { @@ -173,8 +177,7 @@ FILE *open_log_file(void) return stderr; } -#if defined(__linux__) -# include <execinfo.h> +#ifdef HAVE_EXECINFO_BACKTRACE void log_callstack(const char *const func_name, const int line_num) { void *trace[100]; diff --git a/src/nvim/log.h b/src/nvim/log.h index 2bd18f5776..743a8d17aa 100644 --- a/src/nvim/log.h +++ b/src/nvim/log.h @@ -61,7 +61,7 @@ __VA_ARGS__) #endif -#if defined(__linux__) +#ifdef HAVE_EXECINFO_BACKTRACE # define LOG_CALLSTACK() log_callstack(__func__, __LINE__) #endif diff --git a/src/nvim/option.c b/src/nvim/option.c index 98ca72b2bb..8ba10fd38a 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1185,10 +1185,6 @@ do_set ( showoptions(1, opt_flags); did_show = TRUE; } - } else if (STRNCMP(arg, "termcap", - 7) == 0 && !(opt_flags & OPT_MODELINE)) { - did_show = TRUE; - arg += 7; } else { prefix = 1; if (STRNCMP(arg, "no", 2) == 0) { @@ -6070,8 +6066,8 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u *** int count = 0; char_u *str; int loop; - static char *(names[]) = {"all", "termcap"}; - int ic = regmatch->rm_ic; /* remember the ignore-case flag */ + static char *(names[]) = { "all" }; + int ic = regmatch->rm_ic; // remember the ignore-case flag /* do this loop twice: * loop == 0: count the number of matching options diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 4997209556..e6b1e7b95a 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3127,7 +3127,7 @@ static char_u *get_mef_name(void) STRCPY(name, p_mef); sprintf((char *)name + (p - p_mef), "%d%d", start, off); STRCAT(name, p + 2); - // Don't accept a symbolic link, its a security risk. + // Don't accept a symbolic link, it's a security risk. FileInfo file_info; bool file_or_link_found = os_fileinfo_link((char *)name, &file_info); if (!file_or_link_found) { diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 510e8820f4..b45bd6ee14 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -132,7 +132,7 @@ $(SCRIPTS) $(SCRIPTS_GUI): $(NVIM_PRG) test1.out RM_ON_RUN := test.out X* viminfo RM_ON_START := test.ok -RUN_VIM := VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --noplugin -s dotest.in +RUN_VIM := VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin -s dotest.in clean: -rm -rf *.out \ @@ -201,7 +201,7 @@ nolog: # New style of tests uses Vim script with assert calls. These are easier # to write and a lot easier to read and debug. # Limitation: Only works with the +eval feature. -RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(NVIM_PRG) -u unix.vim -U NONE --noplugin +RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(NVIM_PRG) -u unix.vim -U NONE --headless --noplugin newtests: newtestssilent @/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \ diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index c4110eba94..835df42a10 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -342,7 +342,10 @@ func Test_BufEnter() call mkdir('Xdir') split Xdir call assert_equal('+++', g:val) - bwipe! + + " On MS-Windows we can't edit the directory, make sure we wipe the right + " buffer. + bwipe! Xdir call delete('Xdir', 'd') au! BufEnter @@ -351,40 +354,37 @@ endfunc " Closing a window might cause an endless loop " E814 for older Vims function Test_autocmd_bufwipe_in_SessLoadPost() - if has('win32') - throw 'Skipped: test hangs on MS-Windows' - endif tabnew set noswapfile - let g:bufnr=bufnr('%') mksession! - let content=['set nocp noswapfile', + let content = ['set nocp noswapfile', \ 'let v:swapchoice="e"', \ 'augroup test_autocmd_sessionload', \ 'autocmd!', - \ 'autocmd SessionLoadPost * 4bw!|qall!', + \ 'autocmd SessionLoadPost * 4bw!', \ 'augroup END', + \ '', + \ 'func WriteErrors()', + \ ' call writefile([execute("messages")], "Xerrors")', + \ 'endfunc', + \ 'au VimLeave * call WriteErrors()', \ ] call writefile(content, 'Xvimrc') - let a=system(v:progpath. ' --headless -i NONE -u Xvimrc --noplugins -S Session.vim') - call assert_match('E814', a) + call system(v:progpath. ' --headless -i NONE -u Xvimrc --noplugins -S Session.vim -c cq') + let errors = join(readfile('Xerrors')) + call assert_match('E814', errors) - unlet! g:bufnr set swapfile - for file in ['Session.vim', 'Xvimrc'] + for file in ['Session.vim', 'Xvimrc', 'Xerrors'] call delete(file) endfor endfunc " SEGV occurs in older versions. function Test_autocmd_bufwipe_in_SessLoadPost2() - if has('win32') - throw 'Skipped: test hangs on MS-Windows' - endif tabnew set noswapfile - let g:bufnr=bufnr('%') mksession! let content = ['set nocp noswapfile', @@ -399,22 +399,24 @@ function Test_autocmd_bufwipe_in_SessLoadPost2() \ ' exec ''bwipeout '' . b', \ ' endif', \ ' endfor', - \ 'redraw!', - \ 'echon "SessionLoadPost DONE"', - \ 'qall!', + \ ' echomsg "SessionLoadPost DONE"', \ 'endfunction', - \ 'au SessionLoadPost * call DeleteInactiveBufs()'] + \ 'au SessionLoadPost * call DeleteInactiveBufs()', + \ '', + \ 'func WriteErrors()', + \ ' call writefile([execute("messages")], "Xerrors")', + \ 'endfunc', + \ 'au VimLeave * call WriteErrors()', + \ ] call writefile(content, 'Xvimrc') - let a=system(v:progpath. ' --headless -i NONE -u Xvimrc --noplugins -S Session.vim') - " this probably only matches on unix - if has("unix") - call assert_notmatch('Caught deadly signal SEGV', a) - endif - call assert_match('SessionLoadPost DONE', a) - - unlet! g:bufnr + call system(v:progpath. ' --headless -i NONE -u Xvimrc --noplugins -S Session.vim -c cq') + let errors = join(readfile('Xerrors')) + " This probably only ever matches on unix. + call assert_notmatch('Caught deadly signal SEGV', errors) + call assert_match('SessionLoadPost DONE', errors) + set swapfile - for file in ['Session.vim', 'Xvimrc'] + for file in ['Session.vim', 'Xvimrc', 'Xerrors'] call delete(file) endfor endfunc diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 0975b87ea3..c29ec09638 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1537,11 +1537,11 @@ static void augment_terminfo(TUIData *data, const char *term, bool teraterm = terminfo_is_term_family(term, "teraterm"); bool putty = terminfo_is_term_family(term, "putty"); bool screen = terminfo_is_term_family(term, "screen"); + bool tmux = terminfo_is_term_family(term, "tmux") || !!os_getenv("TMUX"); bool iterm = terminfo_is_term_family(term, "iterm") || terminfo_is_term_family(term, "iTerm.app"); // None of the following work over SSH; see :help TERM . bool iterm_pretending_xterm = xterm && iterm_env; - bool tmux_wrap = screen && !!os_getenv("TMUX"); const char * xterm_version = os_getenv("XTERM_VERSION"); bool true_xterm = xterm && !!xterm_version; @@ -1573,12 +1573,11 @@ static void augment_terminfo(TUIData *data, const char *term, // specific ones. // can use colons like ISO 8613-6:1994/ITU T.416:1993 says. - bool has_colon_rgb = false - // per GNOME bug #685759 and bug #704449 - || (vte_version >= 3600) - || iterm || iterm_pretending_xterm // per analysis of VT100Terminal.m - // per http://invisible-island.net/xterm/xterm.log.html#xterm_282 - || true_xterm; + bool has_colon_rgb = !tmux && !screen + && ((vte_version >= 3600) // per GNOME bug #685759, #704449 + || iterm || iterm_pretending_xterm // per analysis of VT100Terminal.m + // per http://invisible-island.net/xterm/xterm.log.html#xterm_282 + || true_xterm); data->unibi_ext.set_rgb_foreground = unibi_find_ext_str(ut, "setrgbf"); if (-1 == data->unibi_ext.set_rgb_foreground) { @@ -1606,7 +1605,7 @@ static void augment_terminfo(TUIData *data, const char *term, // all panes, which is not particularly desirable. A better approach // would use a tmux control sequence and an extra if(screen) test. data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str( - ut, NULL, TMUX_WRAP(tmux_wrap, "\033]Pl%p1%06x\033\\")); + ut, NULL, TMUX_WRAP(tmux, "\033]Pl%p1%06x\033\\")); } else if (xterm || (vte_version != 0) || rxvt) { // This seems to be supported for a long time in VTE // urxvt also supports this diff --git a/src/nvim/version.c b/src/nvim/version.c index 4f83b09e1b..1035963136 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -231,7 +231,7 @@ static const int included_patches[] = { // 501, // 500, 499, - // 498, + 498, // 497, // 496, // 495, @@ -605,7 +605,7 @@ static const int included_patches[] = { 127, // 126, // 125, - // 124, + 124, // 123 NA // 122 NA 121, @@ -666,7 +666,7 @@ static const int included_patches[] = { 66, // 65 NA 64, - // 63, + // 63 NA 62, // 61 NA 60, @@ -683,7 +683,7 @@ static const int included_patches[] = { 49, // 48 NA 47, - // 46, + 46, // 45 NA // 44, 43, @@ -717,7 +717,7 @@ static const int included_patches[] = { // 15 NA // 14 NA // 13 NA - // 12, + 12, // 11 NA // 10 NA // 9 NA diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua index 2f342ec9a3..d646e8dbf4 100644 --- a/test/functional/legacy/assert_spec.lua +++ b/test/functional/legacy/assert_spec.lua @@ -253,6 +253,11 @@ describe('assert function:', function() "Expected range 5 - 7, but got 8", }) end) + + it('assert_inrange(1, 1) returns E119', function() + eq('Vim(call):E119: Not enough arguments for function: assert_inrange', + exc_exec("call assert_inrange(1, 1)")) + end) end) -- assert_report({msg}) |