aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt33
-rw-r--r--cmake/LuaHelpers.cmake4
-rw-r--r--runtime/autoload/remote/host.vim1
-rw-r--r--runtime/optwin.vim4
-rw-r--r--src/nvim/CMakeLists.txt1
-rw-r--r--src/nvim/option.c19
-rw-r--r--src/nvim/quickfix.c3
-rw-r--r--src/nvim/screen.c54
-rw-r--r--src/nvim/syntax.c3
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test_breakindent.in123
-rw-r--r--src/nvim/testdir/test_breakindent.ok74
-rw-r--r--src/nvim/version.c10
-rw-r--r--test/functional/legacy/breakindent_spec.lua211
-rw-r--r--test/functional/legacy/set_spec.lua15
-rw-r--r--test/functional/ui/highlight_spec.lua291
-rw-r--r--test/functional/ui/mouse_spec.lua17
17 files changed, 592 insertions, 272 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1abc05f0da..317d2a1a5b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -300,9 +300,6 @@ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
find_package(Msgpack 1.0.0 REQUIRED)
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
-find_package(LuaJit REQUIRED)
-include_directories(SYSTEM ${LUAJIT_INCLUDE_DIRS})
-
find_package(Unibilium REQUIRED)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
@@ -477,18 +474,24 @@ if(BUSTED_PRG)
add_custom_target(benchmark-prereqs
DEPENDS ${BENCHMARK_PREREQS})
- add_custom_target(unittest
- COMMAND ${CMAKE_COMMAND}
- -DBUSTED_PRG=${BUSTED_PRG}
- -DLUA_PRG=${LUA_PRG}
- -DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
- -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
- -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
- -DBUILD_DIR=${CMAKE_BINARY_DIR}
- -DTEST_TYPE=unit
- -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
- DEPENDS ${UNITTEST_PREREQS}
- ${TEST_TARGET_ARGS})
+ check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
+ if(LUA_HAS_FFI)
+ add_custom_target(unittest
+ COMMAND ${CMAKE_COMMAND}
+ -DBUSTED_PRG=${BUSTED_PRG}
+ -DLUA_PRG=${LUA_PRG}
+ -DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
+ -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
+ -DBUILD_DIR=${CMAKE_BINARY_DIR}
+ -DTEST_TYPE=unit
+ -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
+ DEPENDS ${UNITTEST_PREREQS}
+ ${TEST_TARGET_ARGS})
+ else()
+ message(WARNING "The Luajit ffi is not available in ${LUA_PRG}"
+ ", disabling unit tests")
+ endif()
add_custom_target(functionaltest
COMMAND ${CMAKE_COMMAND}
diff --git a/cmake/LuaHelpers.cmake b/cmake/LuaHelpers.cmake
index b1e67e0ca7..32f7e46a57 100644
--- a/cmake/LuaHelpers.cmake
+++ b/cmake/LuaHelpers.cmake
@@ -8,8 +8,6 @@ function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR)
RESULT_VARIABLE module_missing
ERROR_QUIET)
if(module_missing)
- message(STATUS
- "[${LUA_PRG_PATH}] The '${MODULE}' lua package is required for building Neovim")
set(${RESULT_VAR} False PARENT_SCOPE)
else()
set(${RESULT_VAR} True PARENT_SCOPE)
@@ -29,6 +27,8 @@ function(check_lua_deps LUA_PRG_PATH MODULES RESULT_VAR)
foreach(module ${MODULES})
check_lua_module(${LUA_PRG_PATH} ${module} has_module)
if(NOT has_module)
+ message(STATUS
+ "[${LUA_PRG_PATH}] The '${module}' lua package is required for building Neovim")
set(${RESULT_VAR} False PARENT_SCOPE)
return()
endif()
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim
index 8faeaed2ea..a63c6a923b 100644
--- a/runtime/autoload/remote/host.vim
+++ b/runtime/autoload/remote/host.vim
@@ -140,6 +140,7 @@ function! s:RegistrationCommands(host) abort
call remote#host#RegisterClone(host_id, a:host)
let pattern = s:plugin_patterns[a:host]
let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 0, 1)
+ let paths = map(paths, 'tr(v:val,"\\","/")') " Normalize slashes #4795
if empty(paths)
return []
endif
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 07dcd31b1b..68444dde01 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -766,7 +766,7 @@ call append("$", "infercase\tadjust case of a keyword completion match")
call append("$", "\t(local to buffer)")
call <SID>BinOptionL("inf")
if has("digraphs")
- call append("$", "digraph\tenable entering digraps with c1 <BS> c2")
+ call append("$", "digraph\tenable entering digraphs with c1 <BS> c2")
call <SID>BinOptionG("dg", &dg)
endif
call append("$", "tildeop\tthe \"~\" command behaves like an operator")
@@ -1142,7 +1142,7 @@ if has("arabic")
call <SID>BinOptionG("tbidi", &tbidi)
endif
if has("keymap")
- call append("$", "keymap\tname of a keyboard mappping")
+ call append("$", "keymap\tname of a keyboard mapping")
call <SID>OptionL("kmp")
endif
if has("langmap")
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 6b2ce08d36..172643091a 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -231,7 +231,6 @@ endif()
list(APPEND NVIM_LINK_LIBRARIES
${LIBUV_LIBRARIES}
${MSGPACK_LIBRARIES}
- ${LUAJIT_LIBRARIES}
${LIBVTERM_LIBRARIES}
${LIBTERMKEY_LIBRARIES}
${UNIBILIUM_LIBRARIES}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 2f22c245dd..45ebb4fa4c 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1639,18 +1639,21 @@ do_set (
&& STRNCMP(s, newval, i) == 0
&& (!(flags & P_COMMA)
|| s[i] == ','
- || s[i] == NUL))
+ || s[i] == NUL)) {
break;
- /* Count backslashes. Only a comma with an
- * even number of backslashes before it is
- * recognized as a separator */
- if (s > origval && s[-1] == '\\')
- ++bs;
- else
+ }
+ // Count backslashes. Only a comma with an even number of
+ // backslashes or a single backslash preceded by a comma
+ // before it is recognized as a separator
+ if ((s > origval + 1 && s[-1] == '\\' && s[-2] != ',')
+ || (s == origval + 1 && s[-1] == '\\')) {
+ bs++;
+ } else {
bs = 0;
+ }
}
- /* do not add if already there */
+ // do not add if already there
if ((adding || prepending) && *s) {
prepending = FALSE;
adding = FALSE;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 17cb8a86aa..151b9d3790 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -160,9 +160,6 @@ qf_init (
{
qf_info_T *qi = &ql_info;
- if (efile == NULL)
- return FAIL;
-
if (wp != NULL) {
qi = ll_get_or_alloc_list(wp);
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 10b5b6bba4..34eef83164 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3385,11 +3385,9 @@ win_line (
&& lcs_nbsp)
|| (c == ' ' && lcs_space && ptr - line <= trailcol))) {
c = (c == ' ') ? lcs_space : lcs_nbsp;
- if (area_attr == 0 && search_attr == 0) {
- n_attr = 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; // save current attr
- }
+ n_attr = 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; // save current attr
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
mb_utf8 = true;
@@ -3402,11 +3400,9 @@ win_line (
if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') {
c = lcs_trail;
- if (!attr_pri) {
- n_attr = 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
+ n_attr = 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; // save current attr
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
mb_utf8 = TRUE;
@@ -3554,11 +3550,9 @@ win_line (
c = ' ';
}
lcs_eol_one = -1;
- --ptr; /* put it back at the NUL */
- if (!attr_pri) {
- extra_attr = hl_attr(HLF_AT);
- n_attr = 1;
- }
+ ptr--; // put it back at the NUL
+ extra_attr = hl_attr(HLF_AT);
+ n_attr = 1;
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
mb_utf8 = TRUE;
@@ -3587,12 +3581,10 @@ win_line (
n_extra = byte2cells(c) - 1;
c = *p_extra++;
}
- if (!attr_pri) {
- n_attr = n_extra + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
- }
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
+ n_attr = n_extra + 1;
+ extra_attr = hl_attr(HLF_8);
+ saved_attr2 = char_attr; // save current attr
+ mb_utf8 = false; // don't draw as UTF-8
} else if (VIsual_active
&& (VIsual_mode == Ctrl_V
|| VIsual_mode == 'v')
@@ -3702,11 +3694,10 @@ win_line (
did_wcol = true;
}
- /* Don't override visual selection highlighting. */
- if (n_attr > 0
- && draw_state == WL_LINE
- && !attr_pri)
- char_attr = extra_attr;
+ // Don't override visual selection highlighting.
+ if (n_attr > 0 && draw_state == WL_LINE) {
+ char_attr = hl_combine_attr(char_attr, extra_attr);
+ }
/*
* Handle the case where we are in column 0 but not on the first
@@ -3734,13 +3725,12 @@ win_line (
mb_utf8 = TRUE;
u8cc[0] = 0;
c = 0xc0;
- } else
- mb_utf8 = FALSE; /* don't draw as UTF-8 */
- if (!attr_pri) {
- saved_attr3 = char_attr; /* save current attr */
- char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
- n_attr3 = 1;
+ } else {
+ mb_utf8 = false; // don't draw as UTF-8
}
+ saved_attr3 = char_attr; // save current attr
+ char_attr = hl_attr(HLF_AT); // later copied to char_attr
+ n_attr3 = 1;
}
/*
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 9a5484704e..1f9dbd8228 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6972,6 +6972,9 @@ set_hl_attr (
|| at_en.rgb_sp_color != -1 || at_en.cterm_ae_attr != 0
|| at_en.rgb_ae_attr != 0) {
sgp->sg_attr = get_attr_entry(&at_en);
+ } else {
+ // If all the fields are cleared, clear the attr field back to default value
+ sgp->sg_attr = 0;
}
}
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 0e3149b912..90542a6a6c 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -32,7 +32,6 @@ SCRIPTS := \
test73.out \
test79.out \
test_listlbr.out \
- test_breakindent.out \
test_close_count.out \
test_marks.out \
diff --git a/src/nvim/testdir/test_breakindent.in b/src/nvim/testdir/test_breakindent.in
deleted file mode 100644
index 5a8e580c4a..0000000000
--- a/src/nvim/testdir/test_breakindent.in
+++ /dev/null
@@ -1,123 +0,0 @@
-Test for breakindent
-
-STARTTEST
-:so small.vim
-:if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif
-:set wildchar=^E
-:10new|:vsp|:vert resize 20
-:put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"
-:set ts=4 sw=4 sts=4 breakindent
-:fu! ScreenChar(line, width)
-: let c=''
-: for i in range(1,a:width)
-: let c.=nr2char(screenchar(a:line, i))
-: endfor
-: let c.="\n"
-: for i in range(1,a:width)
-: let c.=nr2char(screenchar(a:line+1, i))
-: endfor
-: let c.="\n"
-: for i in range(1,a:width)
-: let c.=nr2char(screenchar(a:line+2, i))
-: endfor
-: return c
-:endfu
-:fu DoRecordScreen()
-: wincmd l
-: $put =printf(\"\n%s\", g:test)
-: $put =g:line1
-: wincmd p
-:endfu
-:set briopt=min:0
-:let g:test="Test 1: Simple breakindent"
-:let line1=ScreenChar(line('.'),8)
-:call DoRecordScreen()
-:let g:test="Test 2: Simple breakindent + sbr=>>"
-:set sbr=>>
-:let line1=ScreenChar(line('.'),8)
-:call DoRecordScreen()
-:let g:test ="Test 3: Simple breakindent + briopt:sbr"
-:set briopt=sbr,min:0 sbr=++
-:let line1=ScreenChar(line('.'),8)
-:call DoRecordScreen()
-:let g:test ="Test 4: Simple breakindent + min width: 18"
-:set sbr= briopt=min:18
-:let line1=ScreenChar(line('.'),8)
-:call DoRecordScreen()
-:let g:test =" Test 5: Simple breakindent + shift by 2"
-:set briopt=shift:2,min:0
-:let line1=ScreenChar(line('.'),8)
-:call DoRecordScreen()
-:let g:test=" Test 6: Simple breakindent + shift by -1"
-:set briopt=shift:-1,min:0
-:let line1=ScreenChar(line('.'),8)
-:call DoRecordScreen()
-:let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"
-:set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4
-:let line1=ScreenChar(line('.'),10)
-:call DoRecordScreen()
-:let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"
-:set briopt=shift:1,sbr,min:0 nu sbr=# list lcs&vi
-:let line1=ScreenChar(line('.'),10)
-:call DoRecordScreen()
-:let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"
-:set briopt-=sbr
-:let line1=ScreenChar(line('.'),10)
-:call DoRecordScreen()
-:let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"
-:set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0
-:let line1=ScreenChar(line('.'),10)
-:call DoRecordScreen()
-:wincmd p
-:let g:test="\n Test 11: strdisplaywidth when breakindent is on"
-:set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4
-:let text=getline(2) "skip leading tab when calculating text width
-:let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
-:$put =g:test
-:$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
-:let g:str="\t\t\t\t\t{"
-:let g:test=" Test 12: breakindent + long indent"
-:wincmd p
-:set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4
-:$put =g:str
-zt:let line1=ScreenChar(1,10)
-:wincmd p
-:call DoRecordScreen()
-:"
-:" Test, that the string " a\tb\tc\td\te" is correctly
-:" displayed in a 20 column wide window (see bug report
-:" https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ
-:only
-:vert 20new
-:set all& breakindent briopt=min:10
-:call setline(1, [" a\tb\tc\td\te", " z y x w v"])
-:/^\s*a
-fbgjyl:let line1 = @0
-:?^\s*z
-fygjyl:let line2 = @0
-:quit!
-:$put ='Test 13: breakindent with wrapping Tab'
-:$put =line1
-:$put =line2
-:"
-:let g:test="Test 14: breakindent + visual blockwise delete #1"
-:set all& breakindent shada+=nX-test-breakindent.shada
-:30vnew
-:normal! 3a1234567890
-:normal! a abcde
-:exec "normal! 0\<C-V>tex"
-:let line1=ScreenChar(line('.'),8)
-:call DoRecordScreen()
-:"
-:let g:test="Test 15: breakindent + visual blockwise delete #2"
-:%d
-:normal! 4a1234567890
-:exec "normal! >>\<C-V>3f0x"
-:let line1=ScreenChar(line('.'),20)
-:call DoRecordScreen()
-:quit!
-:"
-:%w! test.out
-:qa!
-ENDTEST
-dummy text
diff --git a/src/nvim/testdir/test_breakindent.ok b/src/nvim/testdir/test_breakindent.ok
deleted file mode 100644
index 995bd5f29c..0000000000
--- a/src/nvim/testdir/test_breakindent.ok
+++ /dev/null
@@ -1,74 +0,0 @@
-
- abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
-
-Test 1: Simple breakindent
- abcd
- qrst
- GHIJ
-
-Test 2: Simple breakindent + sbr=>>
- abcd
- >>qr
- >>EF
-
-Test 3: Simple breakindent + briopt:sbr
- abcd
-++ qrst
-++ GHIJ
-
-Test 4: Simple breakindent + min width: 18
- abcd
- qrstuv
- IJKLMN
-
- Test 5: Simple breakindent + shift by 2
- abcd
- qr
- EF
-
- Test 6: Simple breakindent + shift by -1
- abcd
- qrstu
- HIJKL
-
- Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr
- 2 ab
- ? m
- ? x
-
- Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr
- 2 ^Iabcd
- # opq
- # BCD
-
- Test 9: breakindent + shift by +1 + 'nu' + sbr=# list
- 2 ^Iabcd
- #op
- #AB
-
- Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n
- 2 ab
-~ mn
-~ yz
-
- Test 11: strdisplaywidth when breakindent is on
-strdisplaywidth: 46 == calculated: 64
- {
-
- Test 12: breakindent + long indent
-56
-
-~
-Test 13: breakindent with wrapping Tab
-d
-w
-
-Test 14: breakindent + visual blockwise delete #1
-e
-~
-~
-
-Test 15: breakindent + visual blockwise delete #2
- 1234567890
-~
-~
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 654faf7d39..b713285c61 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -625,9 +625,9 @@ static int included_patches[] = {
// 1062 NA
1061,
// 1060 NA
- // 1059,
+ 1059,
// 1058,
- // 1057,
+ 1057,
// 1056,
1055,
1054,
@@ -650,7 +650,7 @@ static int included_patches[] = {
1037,
1036,
1035,
- // 1034,
+ 1034,
// 1033 NA
1032,
// 1031 NA,
@@ -666,8 +666,8 @@ static int included_patches[] = {
// 1021 NA
// 1020 NA
// 1019 NA
- // 1018,
- // 1017,
+ 1018,
+ 1017,
// 1016 NA
1015,
// 1014 NA
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
new file mode 100644
index 0000000000..a12d4add10
--- /dev/null
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -0,0 +1,211 @@
+-- Test for breakindent
+
+local helpers = require('test.functional.helpers')
+local feed, insert = helpers.feed, helpers.insert
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+
+describe('breakindent', function()
+ setup(clear)
+
+ it('is working', function()
+ insert('dummy text')
+
+ execute('set wildchar=^E')
+ execute('10new')
+ execute('vsp')
+ execute('vert resize 20')
+ execute([[put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"]])
+ execute('set ts=4 sw=4 sts=4 breakindent')
+ execute('fu! ScreenChar(line, width)')
+ execute(' let c=""')
+ execute(' for i in range(1,a:width)')
+ execute(' let c.=nr2char(screenchar(a:line, i))')
+ execute(' endfor')
+ execute([[ let c.="\n"]])
+ execute(' for i in range(1,a:width)')
+ execute(' let c.=nr2char(screenchar(a:line+1, i))')
+ execute(' endfor')
+ execute([[ let c.="\n"]])
+ execute(' for i in range(1,a:width)')
+ execute(' let c.=nr2char(screenchar(a:line+2, i))')
+ execute(' endfor')
+ execute(' return c')
+ execute('endfu')
+ execute('fu DoRecordScreen()')
+ execute(' wincmd l')
+ execute([[ $put =printf(\"\n%s\", g:test)]])
+ execute(' $put =g:line1')
+ execute(' wincmd p')
+ execute('endfu')
+ execute('set briopt=min:0')
+ execute('let g:test="Test 1: Simple breakindent"')
+ execute('let line1=ScreenChar(line("."),8)')
+ execute('call DoRecordScreen()')
+ execute('let g:test="Test 2: Simple breakindent + sbr=>>"')
+ execute('set sbr=>>')
+ execute('let line1=ScreenChar(line("."),8)')
+ execute('call DoRecordScreen()')
+ execute('let g:test ="Test 3: Simple breakindent + briopt:sbr"')
+ execute('set briopt=sbr,min:0 sbr=++')
+ execute('let line1=ScreenChar(line("."),8)')
+ execute('call DoRecordScreen()')
+ execute('let g:test ="Test 4: Simple breakindent + min width: 18"')
+ execute('set sbr= briopt=min:18')
+ execute('let line1=ScreenChar(line("."),8)')
+ execute('call DoRecordScreen()')
+ execute('let g:test =" Test 5: Simple breakindent + shift by 2"')
+ execute('set briopt=shift:2,min:0')
+ execute('let line1=ScreenChar(line("."),8)')
+ execute('call DoRecordScreen()')
+ execute('let g:test=" Test 6: Simple breakindent + shift by -1"')
+ execute('set briopt=shift:-1,min:0')
+ execute('let line1=ScreenChar(line("."),8)')
+ execute('call DoRecordScreen()')
+ execute('let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"')
+ execute('set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4')
+ execute('let line1=ScreenChar(line("."),10)')
+ execute('call DoRecordScreen()')
+ execute('let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"')
+ execute('set briopt=shift:1,sbr,min:0 nu sbr=# list lcs&vi')
+ execute('let line1=ScreenChar(line("."),10)')
+ execute('call DoRecordScreen()')
+ execute([[let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"]])
+ execute('set briopt-=sbr')
+ execute('let line1=ScreenChar(line("."),10)')
+ execute('call DoRecordScreen()')
+ execute([[let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"]])
+ execute('set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0')
+ execute('let line1=ScreenChar(line("."),10)')
+ execute('call DoRecordScreen()')
+ execute('wincmd p')
+ execute([[let g:test="\n Test 11: strdisplaywidth when breakindent is on"]])
+ execute('set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4')
+ -- Skip leading tab when calculating text width.
+ execute('let text=getline(2)')
+ -- Text wraps 3 times.
+ execute('let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3')
+ execute('$put =g:test')
+ execute([[$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)]])
+ execute([[let g:str="\t\t\t\t\t{"]])
+ execute('let g:test=" Test 12: breakindent + long indent"')
+ execute('wincmd p')
+ execute('set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4')
+ execute('$put =g:str')
+ feed('zt')
+ execute('let line1=ScreenChar(1,10)')
+ execute('wincmd p')
+ execute('call DoRecordScreen()')
+
+ -- Test, that the string " a\tb\tc\td\te" is correctly displayed in a
+ -- 20 column wide window (see bug report
+ -- https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ ).
+ execute('only')
+ execute('vert 20new')
+ execute('set all& breakindent briopt=min:10')
+ execute([[call setline(1, [" a\tb\tc\td\te", " z y x w v"])]])
+ execute([[/^\s*a]])
+ feed('fbgjyl')
+ execute('let line1 = @0')
+ execute([[?^\s*z]])
+ feed('fygjyl')
+ execute('let line2 = @0')
+ execute('quit!')
+ execute([[$put ='Test 13: breakindent with wrapping Tab']])
+ execute('$put =line1')
+ execute('$put =line2')
+
+ execute('let g:test="Test 14: breakindent + visual blockwise delete #1"')
+ execute('set all& breakindent shada+=nX-test-breakindent.shada')
+ execute('30vnew')
+ execute('normal! 3a1234567890')
+ execute('normal! a abcde')
+ execute([[exec "normal! 0\<C-V>tex"]])
+ execute('let line1=ScreenChar(line("."),8)')
+ execute('call DoRecordScreen()')
+
+ execute('let g:test="Test 15: breakindent + visual blockwise delete #2"')
+ execute('%d')
+ execute('normal! 4a1234567890')
+ execute([[exec "normal! >>\<C-V>3f0x"]])
+ execute('let line1=ScreenChar(line("."),20)')
+ execute('call DoRecordScreen()')
+ execute('quit!')
+
+ -- Assert buffer contents.
+ expect([[
+
+ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
+
+ Test 1: Simple breakindent
+ abcd
+ qrst
+ GHIJ
+
+ Test 2: Simple breakindent + sbr=>>
+ abcd
+ >>qr
+ >>EF
+
+ Test 3: Simple breakindent + briopt:sbr
+ abcd
+ ++ qrst
+ ++ GHIJ
+
+ Test 4: Simple breakindent + min width: 18
+ abcd
+ qrstuv
+ IJKLMN
+
+ Test 5: Simple breakindent + shift by 2
+ abcd
+ qr
+ EF
+
+ Test 6: Simple breakindent + shift by -1
+ abcd
+ qrstu
+ HIJKL
+
+ Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr
+ 2 ab
+ ? m
+ ? x
+
+ Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr
+ 2 ^Iabcd
+ # opq
+ # BCD
+
+ Test 9: breakindent + shift by +1 + 'nu' + sbr=# list
+ 2 ^Iabcd
+ #op
+ #AB
+
+ Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n
+ 2 ab
+ ~ mn
+ ~ yz
+
+ Test 11: strdisplaywidth when breakindent is on
+ strdisplaywidth: 46 == calculated: 64
+ {
+
+ Test 12: breakindent + long indent
+ 56
+
+ ~
+ Test 13: breakindent with wrapping Tab
+ d
+ w
+
+ Test 14: breakindent + visual blockwise delete #1
+ e
+ ~
+ ~
+
+ Test 15: breakindent + visual blockwise delete #2
+ 1234567890
+ ~
+ ~ ]])
+ end)
+end)
diff --git a/test/functional/legacy/set_spec.lua b/test/functional/legacy/set_spec.lua
index f81fcd3700..f2c907084e 100644
--- a/test/functional/legacy/set_spec.lua
+++ b/test/functional/legacy/set_spec.lua
@@ -7,6 +7,21 @@ local clear, execute, eval, eq =
describe(':set', function()
before_each(clear)
+ it('handles backslash properly', function()
+ execute('set iskeyword=a,b,c')
+ execute('set iskeyword+=d')
+ eq('a,b,c,d', eval('&iskeyword'))
+
+ execute([[set iskeyword+=\\,e]])
+ eq([[a,b,c,d,\,e]], eval('&iskeyword'))
+
+ execute('set iskeyword-=e')
+ eq([[a,b,c,d,\]], eval('&iskeyword'))
+
+ execute([[set iskeyword-=\]])
+ eq('a,b,c,d', eval('&iskeyword'))
+ end)
+
it('recognizes a trailing comma with +=', function()
execute('set wildignore=*.png,')
execute('set wildignore+=*.jpg')
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index d0df99677a..85fca4d7ca 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -302,6 +302,47 @@ describe('Default highlight groups', function()
{1:-- INSERT --} |
]], {[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
end)
+ it('can be cleared by assigning NONE', function()
+ execute('syn keyword TmpKeyword neovim')
+ execute('hi link TmpKeyword ErrorMsg')
+ insert('neovim')
+ screen:expect([[
+ {1:neovi^m} |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]], {
+ [1] = {foreground = Screen.colors.White, background = Screen.colors.Red}
+ })
+ execute("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
+ .. " gui=NONE guifg=NONE guibg=NONE guisp=NONE")
+ screen:expect([[
+ neovi^m |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]], {})
+ end)
end)
describe('guisp (special/undercurl)', function()
@@ -361,3 +402,253 @@ describe('guisp (special/undercurl)', function()
end)
end)
+
+describe("'cursorline' with 'listchars'", function()
+ local screen
+
+ local hlgroup_colors = {
+ NonText = Screen.colors.Blue,
+ Cursorline = Screen.colors.Grey90,
+ SpecialKey = Screen.colors.Red,
+ Visual = Screen.colors.LightGrey,
+ }
+
+ before_each(function()
+ clear()
+ screen = Screen.new(20,5)
+ screen:attach()
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ it("'cursorline' and 'cursorcolumn'", function()
+ screen:set_default_attr_ids({[1] = {background=hlgroup_colors.Cursorline}})
+ screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} )
+ execute('highlight clear ModeMsg')
+ execute('set cursorline')
+ feed('i')
+ screen:expect([[
+ {1:^ }|
+ ~ |
+ ~ |
+ ~ |
+ -- INSERT -- |
+ ]])
+ feed('abcdefg<cr>kkasdf')
+ screen:expect([[
+ abcdefg |
+ {1:kkasdf^ }|
+ ~ |
+ ~ |
+ -- INSERT -- |
+ ]])
+ feed('<esc>')
+ screen:expect([[
+ abcdefg |
+ {1:kkasd^f }|
+ ~ |
+ ~ |
+ |
+ ]])
+ execute('set nocursorline')
+ screen:expect([[
+ abcdefg |
+ kkasd^f |
+ ~ |
+ ~ |
+ :set nocursorline |
+ ]])
+ feed('k')
+ screen:expect([[
+ abcde^fg |
+ kkasdf |
+ ~ |
+ ~ |
+ :set nocursorline |
+ ]])
+ feed('jjji<cr><cr><cr><esc>')
+ screen:expect([[
+ kkasd |
+ |
+ |
+ ^f |
+ |
+ ]])
+ execute('set cursorline')
+ execute('set cursorcolumn')
+ feed('kkiabcdefghijk<esc>hh')
+ screen:expect([[
+ kkasd {1: } |
+ {1:abcdefgh^ijk }|
+ {1: } |
+ f {1: } |
+ |
+ ]])
+ feed('khh')
+ screen:expect([[
+ {1:kk^asd }|
+ ab{1:c}defghijk |
+ {1: } |
+ f {1: } |
+ |
+ ]])
+ end)
+
+ it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function()
+ screen:set_default_attr_ids({
+ [1] = {background=hlgroup_colors.Cursorline},
+ [2] = {
+ foreground=hlgroup_colors.SpecialKey,
+ background=hlgroup_colors.Cursorline,
+ },
+ [3] = {
+ background=hlgroup_colors.Cursorline,
+ foreground=hlgroup_colors.NonText,
+ bold=true,
+ },
+ [4] = {
+ foreground=hlgroup_colors.NonText,
+ bold=true,
+ },
+ [5] = {
+ foreground=hlgroup_colors.SpecialKey,
+ },
+ })
+ execute('highlight clear ModeMsg')
+ execute('highlight SpecialKey guifg=#FF0000')
+ execute('set cursorline')
+ execute('set tabstop=8')
+ execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
+ feed('i\t abcd <cr>\t abcd <cr><esc>k')
+ screen:expect([[
+ {5:>-------.}abcd{5:*}{4:¬} |
+ {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
+ {4:¬} |
+ {4:~ }|
+ |
+ ]])
+ feed('k')
+ screen:expect([[
+ {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
+ {5:>-------.}abcd{5:*}{4:¬} |
+ {4:¬} |
+ {4:~ }|
+ |
+ ]])
+ execute('set nocursorline')
+ screen:expect([[
+ {5:^>-------.}abcd{5:*}{4:¬} |
+ {5:>-------.}abcd{5:*}{4:¬} |
+ {4:¬} |
+ {4:~ }|
+ :set nocursorline |
+ ]])
+ execute('set nowrap')
+ feed('ALorem ipsum dolor sit amet<ESC>0')
+ screen:expect([[
+ {5:^>-------.}abcd{5:.}Lorem{4:>}|
+ {5:>-------.}abcd{5:*}{4:¬} |
+ {4:¬} |
+ {4:~ }|
+ |
+ ]])
+ execute('set cursorline')
+ screen:expect([[
+ {2:^>-------.}{1:abcd}{2:.}{1:Lorem}{4:>}|
+ {5:>-------.}abcd{5:*}{4:¬} |
+ {4:¬} |
+ {4:~ }|
+ :set cursorline |
+ ]])
+ feed('$')
+ screen:expect([[
+ {4:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }|
+ {4:<} |
+ {4:<} |
+ {4:~ }|
+ :set cursorline |
+ ]])
+ feed('G')
+ screen:expect([[
+ {5:>-------.}abcd{5:.}Lorem{4:>}|
+ {5:>-------.}abcd{5:*}{4:¬} |
+ {3:^¬}{1: }|
+ {4:~ }|
+ :set cursorline |
+ ]])
+ end)
+
+ it("'listchar' in visual mode", function()
+ screen:set_default_attr_ids({
+ [1] = {background=hlgroup_colors.Cursorline},
+ [2] = {
+ foreground=hlgroup_colors.SpecialKey,
+ background=hlgroup_colors.Cursorline,
+ },
+ [3] = {
+ background=hlgroup_colors.Cursorline,
+ foreground=hlgroup_colors.NonText,
+ bold=true,
+ },
+ [4] = {
+ foreground=hlgroup_colors.NonText,
+ bold=true,
+ },
+ [5] = {
+ foreground=hlgroup_colors.SpecialKey,
+ },
+ [6] = {
+ background=hlgroup_colors.Visual,
+ },
+ [7] = {
+ background=hlgroup_colors.Visual,
+ foreground=hlgroup_colors.SpecialKey,
+ },
+ [8] = {
+ background=hlgroup_colors.Visual,
+ foreground=hlgroup_colors.NonText,
+ bold=true,
+ },
+ })
+ execute('highlight clear ModeMsg')
+ execute('highlight SpecialKey guifg=#FF0000')
+ execute('set cursorline')
+ execute('set tabstop=8')
+ execute('set nowrap')
+ execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
+ feed('i\t abcd <cr>\t abcd Lorem ipsum dolor sit amet<cr><esc>kkk0')
+ screen:expect([[
+ {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
+ {5:>-------.}abcd{5:.}Lorem{4:>}|
+ {4:¬} |
+ {4:~ }|
+ |
+ ]])
+ feed('lllvj')
+ screen:expect([[
+ {5:>-------.}a{6:bcd}{7:*}{8:¬} |
+ {7:>-------.}{6:a}^bcd{5:.}Lorem{4:>}|
+ {4:¬} |
+ {4:~ }|
+ -- VISUAL -- |
+ ]])
+ feed('<esc>V')
+ screen:expect([[
+ {5:>-------.}abcd{5:*}{4:¬} |
+ {7:>-------.}{6:a}^b{6:cd}{7:.}{6:Lorem}{4:>}|
+ {4:¬} |
+ {4:~ }|
+ -- VISUAL LINE -- |
+ ]])
+ feed('<esc>$')
+ screen:expect([[
+ {4:<} |
+ {4:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }|
+ {4:<} |
+ {4:~ }|
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index d0d791308b..993bbd5b0e 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -23,7 +23,12 @@ describe('Mouse input', function()
screen:attach()
screen:set_default_attr_ids({
[1] = {background = hlgroup_colors.Visual},
- [2] = {bold = true}
+ [2] = {bold = true},
+ [3] = {
+ foreground = hlgroup_colors.NonText,
+ background = hlgroup_colors.Visual,
+ bold = true,
+ },
})
screen:set_default_attr_ignore( {{bold=true, foreground=hlgroup_colors.NonText}} )
feed('itesting<cr>mouse<cr>support and selection<esc>')
@@ -225,14 +230,14 @@ describe('Mouse input', function()
feed('<LeftDrag><2,2>')
screen:expect([[
testing |
- mo{1:use } |
+ mo{1:use}{3: } |
{1:su}^pport and selection |
~ |
{2:-- VISUAL --} |
]])
feed('<LeftDrag><0,0>')
screen:expect([[
- ^t{1:esting } |
+ ^t{1:esting}{3: } |
{1:mou}se |
support and selection |
~ |
@@ -293,7 +298,7 @@ describe('Mouse input', function()
screen:expect([[
testing |
mouse |
- {1:su}^p{1:port and selection } |
+ {1:su}^p{1:port and selection}{3: } |
~ |
{2:-- VISUAL LINE --} |
]])
@@ -321,8 +326,8 @@ describe('Mouse input', function()
]])
feed('<RightMouse><2,2>')
screen:expect([[
- {1:testing } |
- {1:mouse } |
+ {1:testing}{3: } |
+ {1:mouse}{3: } |
{1:su}^pport and selection |
~ |
{2:-- VISUAL --} |