diff options
-rw-r--r-- | runtime/doc/syntax.txt | 5 | ||||
-rw-r--r-- | src/nvim/highlight.c | 12 | ||||
-rw-r--r-- | src/nvim/highlight_defs.h | 1 | ||||
-rw-r--r-- | src/nvim/lua/vim.lua | 2 | ||||
-rw-r--r-- | src/nvim/os/env.c | 3 | ||||
-rw-r--r-- | src/nvim/syntax.c | 4 | ||||
-rw-r--r-- | test/functional/eval/environ_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/preload.lua | 10 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 17 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 48 | ||||
-rw-r--r-- | test/functional/ui/mode_spec.lua | 53 | ||||
-rw-r--r-- | test/functional/ui/screen_basic_spec.lua | 1 | ||||
-rw-r--r-- | third-party/CMakeLists.txt | 9 |
13 files changed, 129 insertions, 37 deletions
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 0a4257e2b2..5424ad00ec 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4720,18 +4720,19 @@ the same syntax file on all UIs. *bold* *underline* *undercurl* *inverse* *italic* *standout* - *strikethrough* + *nocombine* *strikethrough* cterm={attr-list} *attr-list* *highlight-cterm* *E418* attr-list is a comma separated list (without spaces) of the following items (in any order): bold underline undercurl curly underline + strikethrough reverse inverse same as reverse italic standout - strikethrough + nocombine override attributes instead of combining them NONE no attributes used (used to reset it) Note that "bold" can be used here and by using a bold font. They diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index 093cc4923b..83ee89b2a1 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -308,8 +308,16 @@ int hl_combine_attr(int char_attr, int prim_attr) // start with low-priority attribute, and override colors if present below. HlAttrs new_en = char_aep; - new_en.cterm_ae_attr |= spell_aep.cterm_ae_attr; - new_en.rgb_ae_attr |= spell_aep.rgb_ae_attr; + if (spell_aep.cterm_ae_attr & HL_NOCOMBINE) { + new_en.cterm_ae_attr = spell_aep.cterm_ae_attr; + } else { + new_en.cterm_ae_attr |= spell_aep.cterm_ae_attr; + } + if (spell_aep.rgb_ae_attr & HL_NOCOMBINE) { + new_en.rgb_ae_attr = spell_aep.rgb_ae_attr; + } else { + new_en.rgb_ae_attr |= spell_aep.rgb_ae_attr; + } if (spell_aep.cterm_fg_color > 0) { new_en.cterm_fg_color = spell_aep.cterm_fg_color; diff --git a/src/nvim/highlight_defs.h b/src/nvim/highlight_defs.h index f9c2c03fc6..255699c8e0 100644 --- a/src/nvim/highlight_defs.h +++ b/src/nvim/highlight_defs.h @@ -18,6 +18,7 @@ typedef enum { HL_UNDERCURL = 0x10, HL_STANDOUT = 0x20, HL_STRIKETHROUGH = 0x40, + HL_NOCOMBINE = 0x80, } HlAttrFlags; /// Stores a complete highlighting entry, including colors and attributes diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua index a03e97490d..b1a684b977 100644 --- a/src/nvim/lua/vim.lua +++ b/src/nvim/lua/vim.lua @@ -189,7 +189,7 @@ paste = (function() if mode == 'c' and not got_line1 then -- cmdline-mode: paste only 1 line. got_line1 = (#lines > 1) vim.api.nvim_set_option('paste', true) -- For nvim_input(). - local line1, _ = string.gsub(lines[1], '[\r\n\012\027]', ' ') -- Scrub. + local line1 = lines[1]:gsub('<', '<lt>'):gsub('[\r\n\012\027]', ' ') -- Scrub. vim.api.nvim_input(line1) vim.api.nvim_set_option('paste', false) elseif mode ~= 'c' then -- Else: discard remaining cmdline-mode chunks. diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 54fdd7961c..13853016d1 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -102,9 +102,6 @@ bool os_env_exists(const char *name) assert(r != UV_EINVAL); if (r != 0 && r != UV_ENOENT && r != UV_ENOBUFS) { ELOG("uv_os_getenv(%s) failed: %d %s", name, r, uv_err_name(r)); -#ifdef WIN32 - return (r == UV_UNKNOWN); -#endif } return (r == 0 || r == UV_ENOBUFS); } diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 675d484d67..ac8ace9fff 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -116,10 +116,10 @@ static int include_link = 0; /* when 2 include "nvim/link" and "clear" */ /// following names, separated by commas (but no spaces!). static char *(hl_name_table[]) = { "bold", "standout", "underline", "undercurl", - "italic", "reverse", "inverse", "strikethrough", "NONE" }; + "italic", "reverse", "inverse", "strikethrough", "nocombine", "NONE" }; static int hl_attr_table[] = { HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, - HL_INVERSE, HL_STRIKETHROUGH, 0 }; + HL_INVERSE, HL_STRIKETHROUGH, HL_NOCOMBINE, 0 }; // The patterns that are being searched for are stored in a syn_pattern. // A match item consists of one pattern. diff --git a/test/functional/eval/environ_spec.lua b/test/functional/eval/environ_spec.lua index 4c2adcf1bf..54d2dc960b 100644 --- a/test/functional/eval/environ_spec.lua +++ b/test/functional/eval/environ_spec.lua @@ -10,6 +10,7 @@ describe('environment variables', function() eq("", environ()['EMPTY_VAR']) eq(nil, environ()['DOES_NOT_EXIST']) end) + it('exists() handles empty env variable', function() clear({env={EMPTY_VAR=""}}) eq(1, exists('$EMPTY_VAR')) diff --git a/test/functional/preload.lua b/test/functional/preload.lua index 1107b45d54..24a3977e6b 100644 --- a/test/functional/preload.lua +++ b/test/functional/preload.lua @@ -2,3 +2,13 @@ -- Busted started doing this to help provide more isolation. See issue #62 -- for more information about this. local helpers = require('test.functional.helpers')(nil) +local iswin = helpers.iswin + +if iswin() then + local ffi = require('ffi') + ffi.cdef[[ + typedef int errno_t; + errno_t _set_fmode(int mode); + ]] + ffi.C._set_fmode(0x8000) +end diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index f70b630442..89468359ef 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -578,6 +578,23 @@ describe('TUI', function() expect_child_buf_lines({expected}) end) + it('paste: less-than sign in cmdline #11088', function() + local expected = '<' + feed_data(':') + wait_for_mode('c') + -- "bracketed paste" + feed_data('\027[200~'..expected..'\027[201~') + screen:expect{grid=[[ + | + {4:~ }| + {4:~ }| + {4:~ }| + {5:[No Name] }| + :<{1: } | + {3:-- TERMINAL --} | + ]]} + end) + it('paste: big burst of input', function() feed_data(':set ruler\n') local t = {} diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 95a19aec81..1b25570997 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -438,6 +438,54 @@ describe('highlight', function() }) end) + it('nocombine', function() + screen:detach() + screen = Screen.new(25,6) + screen:set_default_attr_ids{ + [1] = {foreground = Screen.colors.SlateBlue, underline = true}, + [2] = {bold = true, foreground = Screen.colors.Blue1}, + [3] = {underline = true, reverse = true, foreground = Screen.colors.SlateBlue}, + [4] = {background = Screen.colors.Yellow, reverse = true, foreground = Screen.colors.SlateBlue}, + [5] = {foreground = Screen.colors.Red}, + } + screen:attach() + feed_command('syntax on') + feed_command('hi! Underlined cterm=underline gui=underline') + feed_command('syn keyword Underlined foobar') + feed_command('hi Search cterm=inverse,nocombine gui=inverse,nocombine') + insert([[ + foobar + foobar + ]]) + screen:expect{grid=[[ + {1:foobar} | + {1:foobar} | + ^ | + {2:~ }| + {2:~ }| + | + ]]} + + feed('/foo') + screen:expect{grid=[[ + {3:foo}{1:bar} | + {4:foo}{1:bar} | + | + {2:~ }| + {2:~ }| + /foo^ | + ]]} + feed('<cr>') + screen:expect{grid=[[ + {4:^foo}{1:bar} | + {4:foo}{1:bar} | + | + {2:~ }| + {2:~ }| + {5:search hit...uing at TOP} | + ]]} + end) + it('guisp (special/undercurl)', function() feed_command('syntax on') feed_command('syn keyword TmpKeyword neovim') diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua index 200f6eecdb..9390f268b3 100644 --- a/test/functional/ui/mode_spec.lua +++ b/test/functional/ui/mode_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local command = helpers.command +local retry = helpers.retry describe('ui mode_change event', function() local screen @@ -61,30 +62,36 @@ describe('ui mode_change event', function() | ]], mode="normal"} + local matchtime = 0 command("set showmatch") - command("set matchtime=2") -- tenths of seconds - feed('a(stuff') - screen:expect{grid=[[ - word(stuff^ | - {0:~ }| - {0:~ }| - {2:-- INSERT --} | - ]], mode="insert"} - - feed(')') - screen:expect{grid=[[ - word^(stuff) | - {0:~ }| - {0:~ }| - {2:-- INSERT --} | - ]], mode="showmatch"} - - screen:expect{grid=[[ - word(stuff)^ | - {0:~ }| - {0:~ }| - {2:-- INSERT --} | - ]], mode="insert"} + retry(nil, nil, function() + matchtime = matchtime + 1 + local screen_timeout = 1000 * matchtime -- fail faster for retry. + + command("set matchtime=" .. matchtime) -- tenths of seconds + feed('a(stuff') + screen:expect{grid=[[ + word(stuff^ | + {0:~ }| + {0:~ }| + {2:-- INSERT --} | + ]], mode="insert", timeout=screen_timeout} + + feed(')') + screen:expect{grid=[[ + word^(stuff) | + {0:~ }| + {0:~ }| + {2:-- INSERT --} | + ]], mode="showmatch", timeout=screen_timeout} + + screen:expect{grid=[[ + word(stuff)^ | + {0:~ }| + {0:~ }| + {2:-- INSERT --} | + ]], mode="insert", timeout=screen_timeout} + end) end) it('works in replace mode', function() diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index 46f0b5060c..150ee2a103 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -915,6 +915,7 @@ local function screen_tests(linegrid) -- Regression test for #8357 it('does not have artifacts after temporary chars in insert mode', function() + command('set timeoutlen=10000') command('inoremap jk <esc>') feed('ifooj') screen:expect([[ diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 43cad34aae..c555151c35 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -134,11 +134,12 @@ include(ExternalProject) if(WIN32) # "nvim" branch of https://github.com/neovim/libuv - set(LIBUV_URL https://github.com/neovim/libuv/archive/eeae18d085de25f138c23966f98a179f0fb609e7.tar.gz) - set(LIBUV_SHA256 c37d0b7cb1defe69ae8dbb4d712c0d7cf838d6539178e8bcf71c72579ab5b666) + set(LIBUV_URL https://github.com/neovim/libuv/archive/d5ff3004d26b9bb863b76247399a9c72a0ff184c.tar.gz) + set(LIBUV_SHA256 0f5dfd92269713ed275273966ed73578fc68db669c509b01210cd58c1cf6361d) else() - set(LIBUV_URL https://github.com/libuv/libuv/archive/v1.30.0.tar.gz) - set(LIBUV_SHA256 44c8fdadf3b3f393006a4ac4ba144020673a3f9cd72bed1fbb2c366ebcf0d199) + # blueyed/nvim-fixes (for *BSD build fixes). + set(LIBUV_URL https://github.com/blueyed/libuv/archive/2af4cf2.tar.gz) + set(LIBUV_SHA256 SKIP) endif() set(MSGPACK_URL https://github.com/msgpack/msgpack-c/releases/download/cpp-3.0.0/msgpack-3.0.0.tar.gz) |