aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/fold.txt7
-rw-r--r--src/nvim/edit.c30
-rw-r--r--src/nvim/ex_docmd.c14
-rw-r--r--src/nvim/option.c5
-rw-r--r--src/nvim/version.c9
-rw-r--r--test/functional/plugin/matchparen_spec.lua36
6 files changed, 76 insertions, 25 deletions
diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt
index 03dd6a61ba..c01ce4a9ca 100644
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -1,4 +1,4 @@
-*fold.txt* For Vim version 7.4. Last change: 2013 Dec 04
+*fold.txt* For Vim version 7.4. Last change: 2016 Jan 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -570,8 +570,9 @@ what you type!
When using an operator, a closed fold is included as a whole. Thus "dl"
deletes the whole closed fold under the cursor.
-For Ex commands the range is adjusted to always start at the first line of a
-closed fold and end at the last line of a closed fold. Thus this command: >
+For Ex commands that work on buffer lines the range is adjusted to always
+start at the first line of a closed fold and end at the last line of a closed
+fold. Thus this command: >
:s/foo/bar/g
when used with the cursor on a closed fold, will replace "foo" with "bar" in
all lines of the fold.
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 667ce1e779..26966b35c1 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1359,6 +1359,9 @@ ins_redraw (
update_screen(0);
}
if (has_event(EVENT_CURSORMOVEDI)) {
+ // Make sure curswant is correct, an autocommand may call
+ // getcurpos()
+ update_curswant();
apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, false, curbuf);
}
if (curwin->w_p_cole > 0) {
@@ -2319,6 +2322,22 @@ static int ins_compl_make_cyclic(void)
return count;
}
+
+// Set variables that store noselect and noinsert behavior from the
+// 'completeopt' value.
+void completeopt_was_set(void)
+{
+ compl_no_insert = false;
+ compl_no_select = false;
+ if (strstr((char *)p_cot, "noselect") != NULL) {
+ compl_no_select = true;
+ }
+ if (strstr((char *)p_cot, "noinsert") != NULL) {
+ compl_no_insert = true;
+ }
+}
+
+
/*
* Start completion for the complete() function.
* "startcol" is where the matched text starts (1 is first column).
@@ -3097,17 +3116,6 @@ static bool ins_compl_prep(int c)
}
- if (strstr((char *)p_cot, "noselect") != NULL) {
- compl_no_insert = FALSE;
- compl_no_select = TRUE;
- } else if (strstr((char *)p_cot, "noinsert") != NULL) {
- compl_no_insert = TRUE;
- compl_no_select = FALSE;
- } else {
- compl_no_insert = FALSE;
- compl_no_select = FALSE;
- }
-
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET) {
/*
* We have just typed CTRL-X and aren't quite sure which CTRL-X mode
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 648a3a8487..e334e9126d 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1826,9 +1826,10 @@ static char_u * do_one_cmd(char_u **cmdlinep,
correct_range(&ea);
- if (((ea.argt & WHOLEFOLD) || ea.addr_count >= 2) && !global_busy) {
- /* Put the first line at the start of a closed fold, put the last line
- * at the end of a closed fold. */
+ if (((ea.argt & WHOLEFOLD) || ea.addr_count >= 2) && !global_busy
+ && ea.addr_type == ADDR_LINES) {
+ // Put the first line at the start of a closed fold, put the last line
+ // at the end of a closed fold.
(void)hasFolding(ea.line1, &ea.line1, NULL);
(void)hasFolding(ea.line2, NULL, &ea.line2);
}
@@ -5503,7 +5504,8 @@ int parse_addr_type_arg(char_u *value, int vallen, uint32_t *argt,
int *addr_type_arg)
{
int i, a, b;
- for (i = 0; addr_type_complete[i].expand != -1; ++i) {
+
+ for (i = 0; addr_type_complete[i].expand != -1; i++) {
a = (int)STRLEN(addr_type_complete[i].name) == vallen;
b = STRNCMP(value, addr_type_complete[i].name, vallen) == 0;
if (a && b) {
@@ -5514,8 +5516,8 @@ int parse_addr_type_arg(char_u *value, int vallen, uint32_t *argt,
if (addr_type_complete[i].expand == -1) {
char_u *err = value;
- for (i = 0; err[i] == NUL || !ascii_iswhite(err[i]); i++)
- ;
+
+ for (i = 0; err[i] != NUL && !ascii_iswhite(err[i]); i++) {}
err[i] = NUL;
EMSG2(_("E180: Invalid address type value: %s"), err);
return FAIL;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index b255d47c18..df271e9eb5 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2958,8 +2958,11 @@ did_set_string_option (
}
/* 'completeopt' */
else if (varp == &p_cot) {
- if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK)
+ if (check_opt_strings(p_cot, p_cot_values, true) != OK) {
errmsg = e_invarg;
+ } else {
+ completeopt_was_set();
+ }
}
/* 'pastetoggle': translate key codes like in a mapping */
else if (varp == &p_pt) {
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 927958b109..1714661049 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -71,6 +71,7 @@ static char *features[] = {
static int included_patches[] = {
1757,
1755,
+ 1753,
1654,
1652,
1643,
@@ -381,7 +382,7 @@ static int included_patches[] = {
// 1299 NA
// 1298 NA
// 1297 NA
- // 1296,
+ 1296,
// 1295 NA
// 1294 NA
// 1293 NA
@@ -602,8 +603,8 @@ static int included_patches[] = {
// 1078 NA
// 1077 NA
1076,
- // 1075,
- // 1074 NA
+ 1075,
+ // 1074 NA,
// 1073,
1072,
// 1071,
@@ -642,7 +643,7 @@ static int included_patches[] = {
// 1038 NA
// 1037,
// 1036,
- // 1035,
+ 1035,
// 1034,
// 1033 NA
1032,
diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua
new file mode 100644
index 0000000000..d8c1f2d392
--- /dev/null
+++ b/test/functional/plugin/matchparen_spec.lua
@@ -0,0 +1,36 @@
+local helpers = require('test.functional.helpers')
+local Screen = require('test.functional.ui.screen')
+local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
+
+describe('matchparen', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(20,5)
+ screen:attach()
+ screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} )
+ end)
+
+ it('uses correct column after i_<Up>. Vim patch 7.4.1296', function()
+ execute('set noai nosi nocin')
+ execute('runtime plugin/matchparen.vim')
+ feed('ivoid f_test()<cr>')
+ feed('{<cr>')
+ feed('}')
+
+ -- critical part: up + cr should result in an empty line inbetween the
+ -- brackets... if the bug is there, the empty line will be before the '{'
+ feed('<up>')
+ feed('<cr>')
+
+ screen:expect([[
+ void f_test() |
+ { |
+ ^ |
+ } |
+ {1:-- INSERT --} |
+ ]], {[1] = {bold = true}})
+
+ end)
+end)