neovim/neovim — pull request #1734 by fwalch (2014-12-24 22:33:48+00:00)
Title: [RFC] vim-patch: Multiple small patches (4)

Original patches (without version.c changes) are included below.

### 521

```
Problem: When using "vep" a mark is moved to the next line. (Maxi Padulo,
Issue 283)
Solution: Decrement the line number. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-521
```

```diff
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3831,6 +3831,9 @@ do_put(regname, dir, count, flags)
lnum++;
} while (VIsual_active && lnum <= curbuf->b_visual.vi_end.lnum);

+	if (VIsual_active) /* reset lnum to the last visual line */
+	lnum--;
+
curbuf->b_op_end = curwin->w_cursor;
/* For "CTRL-O p" in Insert mode, put cursor after last char */
if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND)))
```

### 536
```
Problem: Test 63 fails when using a black&white terminal.
Solution: Add attributes for a non-color terminal. (Christian Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-536
```

```diff
diff --git a/src/nvim/testdir/test63.in b/src/nvim/testdir/test63.in
--- a/src/nvim/testdir/test63.in
+++ b/src/nvim/testdir/test63.in
@@ -7,9 +7,9 @@ STARTTEST
:" --- Check that "matcharg()" returns the correct group and pattern if a match
:" --- is defined.
:let @r = "*** Test 1: "
-:highlight MyGroup1 ctermbg=red guibg=red
-:highlight MyGroup2 ctermbg=green guibg=green
-:highlight MyGroup3 ctermbg=blue guibg=blue
+:highlight MyGroup1 term=bold ctermbg=red guibg=red
+:highlight MyGroup2 term=italic ctermbg=green guibg=green
+:highlight MyGroup3 term=underline ctermbg=blue guibg=blue
:match MyGroup1 /TODO/
:2match MyGroup2 /FIXME/
:3match MyGroup3 /XXX/
```

### 538
```
Problem: Tests fail with small features plus Python.
Solution: Disallow weird combination of options. Do not set "fdm" when
folding is disabled.

https://code.google.com/p/vim/source/detail?r=v7-4-538
```

```diff
diff --git a/src/nvim/auto/configure b/src/nvim/auto/configure
--- a/src/nvim/auto/configure
+++ b/src/nvim/auto/configure
@@ -5728,6 +5728,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_pythoninterp" >&5
$as_echo "$enable_pythoninterp" >&6; }
if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5
+ fi
+
for ac_prog in python2 python
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -6044,6 +6048,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_python3interp" >&5
$as_echo "$enable_python3interp" >&6; }
if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5
+ fi
+
for ac_prog in python3 python
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -6929,6 +6937,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5
$as_echo "$enable_rubyinterp" >&6; }
if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ as_fn_error $? "cannot use Ruby with tiny or small features" "$LINENO" 5
+ fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5
$as_echo_n "checking --with-ruby-command argument... " >&6; }

diff --git a/src/nvim/configure.in b/src/nvim/configure.in
--- a/src/nvim/configure.in
+++ b/src/nvim/configure.in
@@ -1041,6 +1041,10 @@ AC_ARG_ENABLE(pythoninterp,
[enable_pythoninterp="no"])
AC_MSG_RESULT($enable_pythoninterp)
if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ AC_MSG_ERROR([cannot use Python with tiny or small features])
+ fi
+
dnl -- find the python executable
AC_PATH_PROGS(vi_cv_path_python, python2 python)
if test "X$vi_cv_path_python" != "X"; then
@@ -1243,6 +1247,10 @@ AC_ARG_ENABLE(python3interp,
[enable_python3interp="no"])
AC_MSG_RESULT($enable_python3interp)
if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ AC_MSG_ERROR([cannot use Python with tiny or small features])
+ fi
+
dnl -- find the python3 executable
AC_PATH_PROGS(vi_cv_path_python3, python3 python)
if test "X$vi_cv_path_python3" != "X"; then
@@ -1720,6 +1728,10 @@ AC_ARG_ENABLE(rubyinterp,
[enable_rubyinterp="no"])
AC_MSG_RESULT($enable_rubyinterp)
if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
+ if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
+ AC_MSG_ERROR([cannot use Ruby with tiny or small features])
+ fi
+
AC_MSG_CHECKING(--with-ruby-command argument)
AC_SUBST(vi_cv_path_ruby)
AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -6200,9 +6200,11 @@ prepare_help_buffer()
(void)buf_init_chartab(curbuf, FALSE);
}

+#ifdef FEAT_FOLDING
/* Don't use the global foldmethod.*/
set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual",
OPT_FREE|OPT_LOCAL, 0);
+#endif

curbuf->b_p_ts = 8;	/* 'tabstop' is 8 */
curwin->w_p_list = FALSE;	/* no list mode */
diff --git a/src/nvim/feature.h b/src/nvim/feature.h
--- a/src/nvim/feature.h
+++ b/src/nvim/feature.h
@@ -385,13 +385,6 @@
#endif

/*
- * +python and +python3 require FEAT_EVAL.
- */
-#if !defined(FEAT_EVAL) && (defined(FEAT_PYTHON3) || defined(FEAT_PYTHON))
-# define FEAT_EVAL
-#endif
-
-/*
* +profile	Profiling for functions and scripts.
*/
#if defined(FEAT_HUGE) \
diff --git a/src/nvim/option.c b/src/nvim/option.c
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -5575,6 +5575,7 @@ set_string_option_direct(name, opt_idx,
if (idx < 0)	/* not found (should not happen) */
{
EMSG2(_(e_intern2), "set_string_option_direct()");
+	EMSG2(_("For option %s"), name);
return;
}
}
```

### 545
```
Problem: Highlighting for multi-line matches is not correct.
Solution: Stop highlight at the end of the match. (Hirohito Higashi)

https://code.google.com/p/vim/source/detail?r=v7-4-545
```

```diff
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3864,9 +3864,15 @@ win_line(wp, lnum, startrow, endrow, noc
&& v >= (long)shl->startcol
&& v < (long)shl->endcol)
{
+#ifdef FEAT_MBYTE
+	int tmp_col = v + MB_PTR2LEN(ptr);
+
+	if (shl->endcol < tmp_col)
+	shl->endcol = tmp_col;
+#endif
shl->attr_cur = shl->attr;
}
-	else if (v >= (long)shl->endcol && shl->lnum == lnum)
+	else if (v == (long)shl->endcol)
{
shl->attr_cur = 0;
next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
```

### 547
```
Problem: Using "vit" does not select a multi-byte character at the end
correctly.
Solution: Advance the cursor over the multi-byte character. (Christian
Brabandt)

https://code.google.com/p/vim/source/detail?r=v7-4-547
```

```diff
diff --git a/src/nvim/search.c b/src/nvim/search.c
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -3932,7 +3932,7 @@ again:
if (lt(end_pos, start_pos))
curwin->w_cursor = start_pos;
else if (*p_sel == 'e')
-	++curwin->w_cursor.col;
+	inc_cursor();
VIsual = start_pos;
VIsual_mode = 'v';
redraw_curbuf_later(INVERTED);	/* update the inversion */
```