summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-09-14 21:40:12 +0000
committerBram Moolenaar <Bram@vim.org>2005-09-14 21:40:12 +0000
commitab194816fe4c0edd7e80e3c82bc5d796ca93a2fe (patch)
tree7807b185fcb0ba92a83113de61d7081fb1a84571 /src
parentcd292719e0adeb13564bb294a27b61d3d8c50199 (diff)
updated for version 7.0147
Diffstat (limited to 'src')
-rw-r--r--src/globals.h3
-rw-r--r--src/search.c82
-rw-r--r--src/syntax.c6
-rw-r--r--src/version.h4
4 files changed, 85 insertions, 10 deletions
diff --git a/src/globals.h b/src/globals.h
index 573dc98422..4b916efd8a 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1418,7 +1418,10 @@ EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer"));
EXTERN char_u e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
#endif
EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
+#if defined(FEAT_SYN_HL) || \
+ (defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC))
EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
+#endif
#ifdef MACOS_X_UNIX
EXTERN short disallow_gui INIT(= FALSE);
diff --git a/src/search.c b/src/search.c
index 21daaa3379..456b694268 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4085,11 +4085,10 @@ find_prev_quote(line, col_start, quotechar, escape)
* Find quote under the cursor, cursor at end.
* Returns TRUE if found, else FALSE.
*/
-/*ARGSUSED*/
int
current_quote(oap, count, include, quotechar)
oparg_T *oap;
- long count; /* not used */
+ long count;
int include; /* TRUE == include quote char */
int quotechar; /* Quote character */
{
@@ -4100,15 +4099,51 @@ current_quote(oap, count, include, quotechar)
#ifdef FEAT_VISUAL
int vis_empty = TRUE; /* Visual selection <= 1 char */
int vis_bef_curs = FALSE; /* Visual starts before cursor */
+ int inside_quotes = FALSE; /* Looks like "i'" done before */
+ int selected_quote = FALSE; /* Has quote inside selection */
+ int i;
/* Correct cursor when 'selection' is exclusive */
if (VIsual_active)
{
+ vis_bef_curs = lt(VIsual, curwin->w_cursor);
if (*p_sel == 'e' && vis_bef_curs)
dec_cursor();
vis_empty = equalpos(VIsual, curwin->w_cursor);
- vis_bef_curs = lt(VIsual, curwin->w_cursor);
}
+
+ if (!vis_empty)
+ {
+ /* Check if the existing selection exactly spans the text inside
+ * quotes. */
+ if (vis_bef_curs)
+ {
+ inside_quotes = VIsual.col > 0
+ && line[VIsual.col - 1] == quotechar
+ && line[curwin->w_cursor.col] != NUL
+ && line[curwin->w_cursor.col + 1] == quotechar;
+ i = VIsual.col;
+ col_end = curwin->w_cursor.col;
+ }
+ else
+ {
+ inside_quotes = curwin->w_cursor.col > 0
+ && line[curwin->w_cursor.col - 1] == quotechar
+ && line[VIsual.col] != NUL
+ && line[VIsual.col + 1] == quotechar;
+ i = curwin->w_cursor.col;
+ col_end = VIsual.col;
+ }
+
+ /* Find out if we have a quote in the selection. */
+ while (i <= col_end)
+ if (line[i++] == quotechar)
+ {
+ selected_quote = TRUE;
+ break;
+ }
+ }
+
if (!vis_empty && line[col_start] == quotechar)
{
/* Already selecting something and on a quote character. Find the
@@ -4218,14 +4253,29 @@ current_quote(oap, count, include, quotechar)
--col_start;
}
- /* Set start position */
- if (!include)
+ /* Set start position. After vi" another i" must include the ".
+ * For v2i" include the quotes. */
+ if (!include && count < 2
+#ifdef FEAT_VISUAL
+ && (vis_empty || !inside_quotes)
+#endif
+ )
++col_start;
curwin->w_cursor.col = col_start;
#ifdef FEAT_VISUAL
if (VIsual_active)
{
- if (vis_empty)
+ /* Set the start of the Visual area when the Visual area was empty, we
+ * were just inside quotes or the Visual area didn't start at a quote
+ * and didn't include a quote.
+ */
+ if (vis_empty
+ || (vis_bef_curs
+ && !selected_quote
+ && (inside_quotes
+ || (line[VIsual.col] != quotechar
+ && (VIsual.col == 0
+ || line[VIsual.col - 1] != quotechar)))))
{
VIsual = curwin->w_cursor;
redraw_curbuf_later(INVERTED);
@@ -4240,7 +4290,12 @@ current_quote(oap, count, include, quotechar)
/* Set end position. */
curwin->w_cursor.col = col_end;
- if (include && inc_cursor() == 2)
+ if ((include || count > 1
+#ifdef FEAT_VISUAL
+ /* After vi" another i" must include the ". */
+ || (!vis_empty && inside_quotes)
+#endif
+ ) && inc_cursor() == 2)
inclusive = TRUE;
#ifdef FEAT_VISUAL
if (VIsual_active)
@@ -4253,7 +4308,18 @@ current_quote(oap, count, include, quotechar)
}
else
{
- /* Cursor is at start of Visual area. */
+ /* Cursor is at start of Visual area. Set the end of the Visual
+ * area when it was just inside quotes or it didn't end at a
+ * quote. */
+ if (inside_quotes
+ || (!selected_quote
+ && line[VIsual.col] != quotechar
+ && (line[VIsual.col] == NUL
+ || line[VIsual.col + 1] != quotechar)))
+ {
+ dec_cursor();
+ VIsual = curwin->w_cursor;
+ }
curwin->w_cursor.col = col_start;
}
if (VIsual_mode == 'V')
diff --git a/src/syntax.c b/src/syntax.c
index 116b724edb..a04b81b34f 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -6163,6 +6163,12 @@ init_highlight(both, reset)
for (i = 0; pp[i] != NULL; ++i)
do_highlight((char_u *)pp[i], reset, TRUE);
+ /* Magenta background looks ugly, but grey may not work for 8 colors.
+ * Thus let it depend on the number of colors available. */
+ if (t_colors > 8)
+ do_highlight((char_u *)(*p_bg == 'l' ? "Visual ctermbg=LightGrey"
+ : "Visual ctermbg=DarkGrey"), reset, TRUE);
+
#ifdef FEAT_SYN_HL
/*
* If syntax highlighting is enabled load the highlighting for it.
diff --git a/src/version.h b/src/version.h
index d3e262017b..9402b51ea3 100644
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 13)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 13, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 14)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 14, compiled "