aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/normal.c38
-rw-r--r--src/nvim/option.c19
-rw-r--r--src/nvim/syntax.c3
-rw-r--r--src/nvim/version.c6
-rw-r--r--test/functional/terminal/window_spec.lua13
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua328
-rw-r--r--third-party/CMakeLists.txt4
-rw-r--r--third-party/cmake/BuildJeMalloc.cmake5
8 files changed, 387 insertions, 29 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 849bc0ea7d..3cf3636e23 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1089,8 +1089,6 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
int restart_edit_save;
int lbr_saved = curwin->w_p_lbr;
- curwin->w_p_lbr = false; /* avoid a problem with unwanted linebreaks in
- * block mode */
/* The visual area is remembered for redo */
static int redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
@@ -1107,6 +1105,8 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if ((finish_op
|| VIsual_active
) && oap->op_type != OP_NOP) {
+ // Avoid a problem with unwanted linebreaks in block mode
+ curwin->w_p_lbr = false;
oap->is_VIsual = VIsual_active;
if (oap->motion_force == 'V')
oap->motion_type = MLINE;
@@ -1434,8 +1434,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|| oap->op_type == OP_COLON
|| oap->op_type == OP_FUNCTION
|| oap->op_type == OP_FILTER)
- && oap->motion_force == NUL)
+ && oap->motion_force == NUL) {
+ // Make sure redrawing is correct.
+ curwin->w_p_lbr = lbr_saved;
redraw_curbuf_later(INVERTED);
+ }
}
}
@@ -1471,8 +1474,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
* 'modifiable is off or creating a fold. */
if (oap->is_VIsual && (oap->empty || !MODIFIABLE(curbuf)
|| oap->op_type == OP_FOLD
- ))
+ )) {
+ curwin->w_p_lbr = lbr_saved;
redraw_curbuf_later(INVERTED);
+ }
/*
* If the end of an operator is in column one while oap->motion_type
@@ -1544,8 +1549,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
vim_beep();
CancelRedo();
}
- } else
+ } else {
+ curwin->w_p_lbr = lbr_saved;
(void)op_yank(oap, !gui_yank);
+ }
check_cursor_col();
break;
@@ -1564,6 +1571,8 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
else
restart_edit_save = 0;
restart_edit = 0;
+ // Restore linebreak, so that when the user edits it looks as before.
+ curwin->w_p_lbr = lbr_saved;
/* Reset finish_op now, don't want it set inside edit(). */
finish_op = false;
if (op_change(oap)) /* will call edit() */
@@ -1641,8 +1650,14 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
restart_edit_save = restart_edit;
restart_edit = 0;
+ // Restore linebreak, so that when the user edits it looks as before.
+ curwin->w_p_lbr = lbr_saved;
+
op_insert(oap, cap->count1);
+ // Reset linebreak, so that formatting works correctly.
+ curwin->w_p_lbr = false;
+
/* TODO: when inserting in several lines, should format all
* the lines. */
auto_format(false, true);
@@ -1657,8 +1672,11 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (empty_region_error) {
vim_beep();
CancelRedo();
- } else
+ } else {
+ // Restore linebreak, so that when the user edits it looks as before.
+ curwin->w_p_lbr = lbr_saved;
op_replace(oap, cap->nchar);
+ }
break;
case OP_FOLD:
@@ -1695,8 +1713,10 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
*/
if (!p_sol && oap->motion_type == MLINE && !oap->end_adjusted
&& (oap->op_type == OP_LSHIFT || oap->op_type == OP_RSHIFT
- || oap->op_type == OP_DELETE))
+ || oap->op_type == OP_DELETE)) {
+ curwin->w_p_lbr = false;
coladvance(curwin->w_curswant = old_col);
+ }
} else {
curwin->w_cursor = old_cursor;
}
@@ -3379,6 +3399,10 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
width1 = curwin->w_width - col_off1;
width2 = curwin->w_width - col_off2;
+ if (width2 == 0) {
+ width2 = 1; // Avoid divide by zero.
+ }
+
if (curwin->w_width != 0) {
/*
* Instead of sticking at the last character of the buffer line we
diff --git a/src/nvim/option.c b/src/nvim/option.c
index dcf02513dd..8aeeb7fe8b 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -4013,17 +4013,16 @@ did_set_string_option (
else if (varp == &p_cb) {
if (opt_strings_flags(p_cb, p_cb_values, &cb_flags, TRUE) != OK)
errmsg = e_invarg;
- }
- /* When 'spelllang' or 'spellfile' is set and there is a window for this
- * buffer in which 'spell' is set load the wordlists. */
- else if (varp == &(curbuf->b_s.b_p_spl) || varp == &(curbuf->b_s.b_p_spf)) {
- int l;
-
- if (varp == &(curbuf->b_s.b_p_spf)) {
- l = (int)STRLEN(curbuf->b_s.b_p_spf);
- if (l > 0 && (l < 4 || STRCMP(curbuf->b_s.b_p_spf + l - 4,
- ".add") != 0))
+ } else if (varp == &(curwin->w_s->b_p_spl)
+ || varp == &(curwin->w_s->b_p_spf)) {
+ // When 'spelllang' or 'spellfile' is set and there is a window for this
+ // buffer in which 'spell' is set load the wordlists.
+ if (varp == &(curwin->w_s->b_p_spf)) {
+ int l = (int)STRLEN(curwin->w_s->b_p_spf);
+ if (l > 0
+ && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0)) {
errmsg = e_invarg;
+ }
}
if (errmsg == NULL) {
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index ec54887246..0bee42c4a9 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5404,11 +5404,10 @@ void ex_ownsyntax(exarg_T *eap)
if (curwin->w_s == &curwin->w_buffer->b_s) {
curwin->w_s = xmalloc(sizeof(synblock_T));
memset(curwin->w_s, 0, sizeof(synblock_T));
+ // TODO: Keep the spell checking as it was.
curwin->w_p_spell = FALSE; /* No spell checking */
clear_string_option(&curwin->w_s->b_p_spc);
clear_string_option(&curwin->w_s->b_p_spf);
- vim_regfree(curwin->w_s->b_cap_prog);
- curwin->w_s->b_cap_prog = NULL;
clear_string_option(&curwin->w_s->b_p_spl);
}
diff --git a/src/nvim/version.c b/src/nvim/version.c
index e80b653c00..ce7a21a99a 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -177,7 +177,7 @@ static int included_patches[] = {
//609,
//608,
//607,
- //606,
+ 606,
//605,
//604,
//603,
@@ -207,7 +207,7 @@ static int included_patches[] = {
//579,
578,
//577,
- //576,
+ 576,
//575,
574,
//573,
@@ -259,7 +259,7 @@ static int included_patches[] = {
527,
526,
525,
- //524,
+ 524,
//523 NA
//522 NA
521,
diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua
index 234950638e..c2b9390a11 100644
--- a/test/functional/terminal/window_spec.lua
+++ b/test/functional/terminal/window_spec.lua
@@ -14,8 +14,17 @@ describe('terminal window', function()
describe('with colorcolumn set', function()
before_each(function()
- feed('<c-\\><c-n>:set colorcolumn=20<cr>i')
- wait()
+ feed('<c-\\><c-n>')
+ screen:expect([[
+ tty ready |
+ {2: } |
+ |
+ |
+ |
+ ^ |
+ |
+ ]])
+ feed(':set colorcolumn=20<cr>i')
end)
it('wont show the color column', function()
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
new file mode 100644
index 0000000000..ebfe067bbe
--- /dev/null
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -0,0 +1,328 @@
+local helpers = require('test.functional.helpers')
+local Screen = require('test.functional.ui.screen')
+local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
+local insert = helpers.insert
+
+describe('Screen', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(nil,10)
+ screen:attach()
+ screen:set_default_attr_ignore( {{bold=true, foreground=255}} )
+ screen:set_default_attr_ids( {{foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray}} )
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ describe("match and conceal", function()
+
+ before_each(function()
+ execute("let &conceallevel=1")
+ end)
+
+ describe("multiple", function()
+ before_each(function()
+ insert([[
+ &&
+ &&
+ &&
+ &&
+ &&
+ &&
+ ]])
+ execute("syn match dAmpersand '[&][&]' conceal cchar=∧")
+ end)
+
+ it("double characters.", function()
+ screen:expect([[
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ ^ |
+ ~ |
+ ~ |
+ :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ ]])
+ end)
+
+ it('double characters and move the cursor one line up.', function()
+ feed("k")
+ screen:expect([[
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ ^&& |
+ |
+ ~ |
+ ~ |
+ :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ ]])
+ end)
+
+ it('double characters and move the cursor to the beginning of the file.', function()
+ feed("gg")
+ screen:expect([[
+ ^&& |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ |
+ ~ |
+ ~ |
+ :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ ]])
+ end)
+
+ it('double characters and move the cursor to the second line in the file.', function()
+ feed("ggj")
+ screen:expect([[
+ {1:∧} |
+ ^&& |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ |
+ ~ |
+ ~ |
+ :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ ]])
+ end)
+
+ it('double characters and then move the cursor to the beginning of the file and back to the end of the file.', function()
+ feed("ggG")
+ screen:expect([[
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ {1:∧} |
+ ^ |
+ ~ |
+ ~ |
+ :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ ]])
+ end)
+ end) -- multiple
+
+ it("keyword instances in initially in the document.", function()
+ feed("2ilambda<cr><ESC>")
+ execute("let &conceallevel=1")
+ execute("syn keyword kLambda lambda conceal cchar=λ")
+ screen:expect([[
+ {1:λ} |
+ {1:λ} |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :syn keyword kLambda lambda conceal cchar=λ |
+ ]])
+ end) -- Keyword
+
+ describe("regions in the document", function()
+
+ before_each(function()
+ feed("2")
+ insert("<r> a region of text </r>\n")
+ execute("let &conceallevel=1")
+ end)
+
+ it('initially and conceal it.', function()
+ execute("syn region rText start='<r>' end='</r>' conceal cchar=R")
+ screen:expect([[
+ {1:R} |
+ {1:R} |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ end)
+
+ it('initially and conceal its start tag and end tag.', function()
+ execute("syn region rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
+ screen:expect([[
+ {1:-} a region of text {1:-} |
+ {1:-} a region of text {1:-} |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ end)
+
+ it('that are nested and conceal the nested region\'s start and end tags.', function()
+ execute("syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
+ insert("<r> A region with <r> a nested <r> nested region.</r> </r> </r>\n")
+ screen:expect([[
+ {1:-} a region of text {1:-} |
+ {1:-} a region of text {1:-} |
+ {1:-} A region with {1:-} a nested {1:-} nested region.{1:-} |
+ {1:-} {1:-} |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ end)
+ end) -- regions in the document
+
+ describe("a region of text", function()
+ before_each(function()
+ execute("syntax conceal on")
+ feed("2")
+ insert("<r> a region of text </r>\n")
+ execute("syn region rText start='<r>' end='</r>' cchar=-")
+ end)
+
+ it("and turn on implicit concealing", function()
+ screen:expect([[
+ {1:-} |
+ {1:-} |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :syn region rText start='<r>' end='</r>' cchar=- |
+ ]])
+ end)
+
+ it("and then turn on, then off, and then back on implicit concealing.", function()
+ execute("syntax conceal off")
+ feed("2")
+ insert("<i> italian text </i>\n")
+ execute("syn region iText start='<i>' end='</i>' cchar=*")
+ screen:expect([[
+ {1:-} |
+ {1:-} |
+ <i> italian text </i> |
+ <i> italian text </i> |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :syn region iText start='<i>' end='</i>' cchar=* |
+ ]])
+ execute("syntax conceal on")
+ execute("syn region iText start='<i>' end='</i>' cchar=*")
+ screen:expect([[
+ {1:-} |
+ {1:-} |
+ {1:*} |
+ {1:*} |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :syn region iText start='<i>' end='</i>' cchar=* |
+ ]])
+ end)
+ end) -- a region of text (implicit concealing)
+ end) -- match and conceal
+
+ describe("let the conceal level be", function()
+ before_each(function()
+ insert("// No Conceal\n")
+ insert('"Conceal without a cchar"\n')
+ insert("+ With cchar\n\n")
+ execute("syn match noConceal '^//.*$'")
+ execute("syn match concealNoCchar '\".\\{-}\"$' conceal")
+ execute("syn match concealWCchar '^+.\\{-}$' conceal cchar=C")
+ end)
+
+ it("0. No concealing.", function()
+ execute("let &conceallevel=0")
+ screen:expect([[
+ // No Conceal |
+ "Conceal without a cchar" |
+ + With cchar |
+ |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :let &conceallevel=0 |
+ ]])
+ end)
+
+ it("1. Conceal using cchar or reference listchars.", function()
+ execute("let &conceallevel=1")
+ screen:expect([[
+ // No Conceal |
+ {1:-} |
+ {1:C} |
+ |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :let &conceallevel=1 |
+ ]])
+ end)
+
+ it("2. Hidden unless cchar is set.", function()
+ execute("let &conceallevel=2")
+ screen:expect([[
+ // No Conceal |
+ |
+ {1:C} |
+ |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :let &conceallevel=2 |
+ ]])
+ end)
+
+ it("3. Hide all concealed text.", function()
+ execute("let &conceallevel=3")
+ screen:expect([[
+ // No Conceal |
+ |
+ |
+ |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :let &conceallevel=3 |
+ ]])
+ end)
+ end) -- conceallevel
+end)
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 66edf9459c..3db6bb399f 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -74,8 +74,8 @@ set(LIBTERMKEY_SHA256 21846369081e6c9a0b615f4b3889c4cb809321c5ccc6e6c1640eb138f1
set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/1b745d29d45623aa8d22a7b9288c7b0e331c7088.tar.gz)
set(LIBVTERM_SHA256 3fc75908256c0d158d6c2a32d39f34e86bfd26364f5404b7d9c03bb70cdc3611)
-set(JEMALLOC_URL https://github.com/jemalloc/jemalloc/archive/3.6.0.tar.gz)
-set(JEMALLOC_SHA256 68175f729423305dc8573cb093025a8db525e1956583c7c5924416a9abaaacb6)
+set(JEMALLOC_URL https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2)
+set(JEMALLOC_SHA256 e16c2159dd3c81ca2dc3b5c9ef0d43e1f2f45b04548f42db12e7c12d7bdf84fe)
if(USE_BUNDLED_UNIBILIUM)
include(BuildUnibilium)
diff --git a/third-party/cmake/BuildJeMalloc.cmake b/third-party/cmake/BuildJeMalloc.cmake
index c3a0d890fc..9756906d97 100644
--- a/third-party/cmake/BuildJeMalloc.cmake
+++ b/third-party/cmake/BuildJeMalloc.cmake
@@ -10,9 +10,8 @@ ExternalProject_Add(jemalloc
-DTARGET=jemalloc
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
BUILD_IN_SOURCE 1
- CONFIGURE_COMMAND sh ${DEPS_BUILD_DIR}/src/jemalloc/autogen.sh &&
- ${DEPS_BUILD_DIR}/src/jemalloc/configure --enable-cc-silence
- CC=${DEPS_C_COMPILER} --prefix=${DEPS_INSTALL_DIR}
+ CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/jemalloc/configure --enable-cc-silence
+ CC=${DEPS_C_COMPILER} --prefix=${DEPS_INSTALL_DIR}
BUILD_COMMAND ""
INSTALL_COMMAND ${MAKE_PRG} install_include install_lib)