summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-01-30 00:14:18 +0000
committerBram Moolenaar <Bram@vim.org>2006-01-30 00:14:18 +0000
commit280f126ef03c4e7d71d2c8341d661d3e37157851 (patch)
treed65ce0b9c87c5c0d04432cad5eafcbdbfebf0239 /src
parent17c7c011706af19bb736c6815375f3b67a5646fc (diff)
downloadvim-git-280f126ef03c4e7d71d2c8341d661d3e37157851.tar.gz
updated for version 7.0189v7.0189
Diffstat (limited to 'src')
-rw-r--r--src/diff.c11
-rw-r--r--src/edit.c17
-rw-r--r--src/eval.c71
-rw-r--r--src/os_unix.c14
-rw-r--r--src/proto/edit.pro1
-rw-r--r--src/quickfix.c2
-rw-r--r--src/search.c9
-rw-r--r--src/term.c10
-rw-r--r--src/version.h4
9 files changed, 71 insertions, 68 deletions
diff --git a/src/diff.c b/src/diff.c
index b0958548a..22e18f316 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1893,6 +1893,7 @@ ex_diffgetput(eap)
buf_T *buf;
int start_skip, end_skip;
int new_count;
+ int buf_empty;
/* Find the current buffer in the list of diff buffers. */
idx_cur = diff_buf_idx(curbuf);
@@ -2047,9 +2048,12 @@ ex_diffgetput(eap)
end_skip = 0;
}
+ buf_empty = FALSE;
added = 0;
for (i = 0; i < count; ++i)
{
+ /* remember deleting the last line of the buffer */
+ buf_empty = curbuf->b_ml.ml_line_count == 1;
ml_delete(lnum, FALSE);
--added;
}
@@ -2066,6 +2070,13 @@ ex_diffgetput(eap)
ml_append(lnum + i - 1, p, 0, FALSE);
vim_free(p);
++added;
+ if (buf_empty && curbuf->b_ml.ml_line_count == 2)
+ {
+ /* Added the first line into an empty buffer, need to
+ * delete the dummy empty line. */
+ buf_empty = FALSE;
+ ml_delete((linenr_T)2, FALSE);
+ }
}
}
new_count = dp->df_count[idx_to] + added;
diff --git a/src/edit.c b/src/edit.c
index e331c4c5a..f38422926 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -111,8 +111,7 @@ static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int
static int ins_compl_make_cyclic __ARGS((void));
static void ins_compl_upd_pum __ARGS((void));
static void ins_compl_del_pum __ARGS((void));
-static int pum_wanted __ARGS((void));
-static void ins_compl_show_pum __ARGS((void));
+static int pum_wanted __ARGS((void));
static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int dir, int flags, int thesaurus));
static void ins_compl_free __ARGS((void));
static void ins_compl_clear __ARGS((void));
@@ -2193,7 +2192,7 @@ pum_wanted()
/*
* Show the popup menu for the list of matches.
*/
- static void
+ void
ins_compl_show_pum()
{
compl_T *compl;
@@ -2266,13 +2265,14 @@ ins_compl_show_pum()
pum_display(compl_match_array, compl_match_arraysize, cur,
curwin->w_cline_row + W_WINROW(curwin),
curwin->w_cline_height,
- curwin->w_wcol + W_WINCOL(curwin));
+ curwin->w_wcol + W_WINCOL(curwin) - curwin->w_leftcol);
curwin->w_cursor.col = col;
}
}
#define DICT_FIRST (1) /* use just first element in "dict" */
#define DICT_EXACT (2) /* "dict" is the exact name of a file */
+
/*
* Add any identifiers that match the given pattern to the list of
* completions.
@@ -2842,6 +2842,8 @@ expand_by_function(type, base, matches)
((char_u **)ga.ga_data)[ga.ga_len] = vim_strsave(p);
++ga.ga_len;
}
+ else if (did_emsg)
+ break;
}
list_unref(matchlist);
@@ -3367,9 +3369,6 @@ ins_compl_next(allow_get_expansion, count)
/* may undisplay the popup menu first */
ins_compl_upd_pum();
- /* Display the current match. */
- update_screen(0);
-
/* display the updated popup menu */
ins_compl_show_pum();
@@ -7216,7 +7215,7 @@ ins_bs(c, mode, inserted_space_p)
*/
if ( mode == BACKSPACE_CHAR
&& ((p_sta && in_indent)
- || (curbuf->b_p_sts
+ || (curbuf->b_p_sts != 0
&& (*(ml_get_cursor() - 1) == TAB
|| (*(ml_get_cursor() - 1) == ' '
&& (!*inserted_space_p
@@ -7228,7 +7227,7 @@ ins_bs(c, mode, inserted_space_p)
int extra = 0;
*inserted_space_p = FALSE;
- if (p_sta)
+ if (p_sta && in_indent)
ts = curbuf->b_p_sw;
else
ts = curbuf->b_p_sts;
diff --git a/src/eval.c b/src/eval.c
index 47fccbca9..cfcc9d4ae 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -517,7 +517,6 @@ static void f_getfsize __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getftime __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getftype __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getline __ARGS((typval_T *argvars, typval_T *rettv));
-static void f_getloclist __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getqflist __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getreg __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getregtype __ARGS((typval_T *argvars, typval_T *rettv));
@@ -6866,7 +6865,7 @@ static struct fst
{"getftime", 1, 1, f_getftime},
{"getftype", 1, 1, f_getftype},
{"getline", 1, 2, f_getline},
- {"getloclist", 1, 1, f_getloclist},
+ {"getloclist", 1, 1, f_getqflist},
{"getqflist", 0, 0, f_getqflist},
{"getreg", 0, 2, f_getreg},
{"getregtype", 0, 1, f_getregtype},
@@ -7179,7 +7178,8 @@ get_func_tv(name, len, rettv, arg, firstline, lastline, doesrange,
/*
* Call a function with its resolved parameters
- * Return OK or FAIL.
+ * Return OK when the function can't be called, FAIL otherwise.
+ * Also returns OK when an error was encountered while executing the function.
*/
static int
call_func(name, len, rettv, argcount, argvars, firstline, lastline,
@@ -8829,7 +8829,7 @@ filter_map(argvars, rettv, map)
int rem;
int todo;
char_u *msg = map ? (char_u *)"map()" : (char_u *)"filter()";
-
+ int save_called_emsg;
rettv->vval.v_number = 0;
if (argvars[0].v_type == VAR_LIST)
@@ -8859,6 +8859,12 @@ filter_map(argvars, rettv, map)
prepare_vimvar(VV_VAL, &save_val);
expr = skipwhite(expr);
+ /* We reset "called_emsg" to be able to detect whether an error
+ * occurred during evaluation of the expression. "did_emsg" can't be
+ * used, because it is reset when calling a function. */
+ save_called_emsg = called_emsg;
+ called_emsg = FALSE;
+
if (argvars[0].v_type == VAR_DICT)
{
prepare_vimvar(VV_KEY, &save_key);
@@ -8876,7 +8882,8 @@ filter_map(argvars, rettv, map)
if (tv_check_lock(di->di_tv.v_lock, msg))
break;
vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
- if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL)
+ if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL
+ || called_emsg)
break;
if (!map && rem)
dictitem_remove(d, di);
@@ -8894,7 +8901,8 @@ filter_map(argvars, rettv, map)
if (tv_check_lock(li->li_tv.v_lock, msg))
break;
nli = li->li_next;
- if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL)
+ if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL
+ || called_emsg)
break;
if (!map && rem)
listitem_remove(l, li);
@@ -8902,6 +8910,8 @@ filter_map(argvars, rettv, map)
}
restore_vimvar(VV_VAL, &save_val);
+
+ called_emsg |= save_called_emsg;
}
copy_tv(&argvars[0], rettv);
@@ -9795,18 +9805,18 @@ f_getline(argvars, rettv)
get_buffer_lines(curbuf, lnum, end, retlist, rettv);
}
-static void get_qf_ll_ist __ARGS((win_T *wp, typval_T *rettv));
-
/*
- * Shared by getqflist() and getloclist() functions
+ * "getqflist()" and "getloclist()" functions
*/
+/*ARGSUSED*/
static void
-get_qf_ll_ist(wp, rettv)
- win_T *wp;
+f_getqflist(argvars, rettv)
+ typval_T *argvars;
typval_T *rettv;
{
#ifdef FEAT_QUICKFIX
list_T *l;
+ win_T *wp;
#endif
rettv->vval.v_number = FALSE;
@@ -9817,40 +9827,17 @@ get_qf_ll_ist(wp, rettv)
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
++l->lv_refcount;
+ wp = NULL;
+ if (argvars[0].v_type != VAR_UNKNOWN) /* getloclist() */
+ {
+ wp = find_win_by_nr(&argvars[0]);
+ if (wp == NULL)
+ return;
+ }
+
(void)get_errorlist(wp, l);
}
#endif
-
-}
-
-/*
- * "getloclist()" function
- */
-/*ARGSUSED*/
- static void
-f_getloclist(argvars, rettv)
- typval_T *argvars;
- typval_T *rettv;
-{
- win_T *win;
-
- rettv->vval.v_number = FALSE;
-
- win = find_win_by_nr(&argvars[0]);
- if (win != NULL)
- get_qf_ll_ist(win, rettv);
-}
-
-/*
- * "getqflist()" function
- */
-/*ARGSUSED*/
- static void
-f_getqflist(argvars, rettv)
- typval_T *argvars;
- typval_T *rettv;
-{
- get_qf_ll_ist(NULL, rettv);
}
/*
diff --git a/src/os_unix.c b/src/os_unix.c
index 374d85e76..4a339f90a 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5122,10 +5122,7 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags)
for (j = 0; pat[i][j] != NUL; ++j)
{
if (pat[i][j] == '`')
- {
intick = !intick;
- *p++ = pat[i][j];
- }
else if (pat[i][j] == '\\' && pat[i][j + 1] != NUL)
{
/* Remove a backslash, take char literally. But keep
@@ -5134,19 +5131,16 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags)
if (intick
|| vim_strchr(SHELL_SPECIAL, pat[i][j + 1]) != NULL)
*p++ = '\\';
- *p++ = pat[i][++j];
+ ++j;
}
else if (!intick && vim_strchr(SHELL_SPECIAL,
pat[i][j]) != NULL)
- {
/* Put a backslash before a special character, but not
* when inside ``. */
*p++ = '\\';
- *p++ = pat[i][j];
- }
- else
- /* Simply copy the character. */
- *p++ = pat[i][++j];
+
+ /* Copy one character. */
+ *p++ = pat[i][j];
}
*p = NUL;
#endif
diff --git a/src/proto/edit.pro b/src/proto/edit.pro
index 84ad8fbdd..27594f024 100644
--- a/src/proto/edit.pro
+++ b/src/proto/edit.pro
@@ -9,6 +9,7 @@ void backspace_until_column __ARGS((int col));
int vim_is_ctrl_x_key __ARGS((int c));
int ins_compl_add_infercase __ARGS((char_u *str, int len, char_u *fname, int dir, int flags));
int ins_compl_add __ARGS((char_u *str, int len, char_u *fname, int dir, int flags));
+void ins_compl_show_pum __ARGS((void));
char_u *find_word_start __ARGS((char_u *ptr));
char_u *find_word_end __ARGS((char_u *ptr));
void ins_compl_check_keys __ARGS((int frequency));
diff --git a/src/quickfix.c b/src/quickfix.c
index ff3e4ce09..ca6cc4080 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -3318,7 +3318,7 @@ set_errorlist(wp, list, action)
if (wp != NULL)
{
- qi = ll_get_or_alloc_list(curwin);
+ qi = ll_get_or_alloc_list(wp);
if (qi == NULL)
return FAIL;
}
diff --git a/src/search.c b/src/search.c
index 5e370b899..bcb23aa7e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -521,6 +521,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
int match_ok;
long nmatched;
int submatch = 0;
+ int save_called_emsg = called_emsg;
#ifdef FEAT_SEARCH_EXTRA
int break_loop = FALSE;
#else
@@ -552,9 +553,9 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
else
extra_col = 1;
-/*
- * find the string
- */
+ /*
+ * find the string
+ */
called_emsg = FALSE;
do /* loop for count */
{
@@ -865,6 +866,8 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use)
vim_free(regmatch.regprog);
+ called_emsg |= save_called_emsg;
+
if (!found) /* did not find it */
{
if (got_int)
diff --git a/src/term.c b/src/term.c
index 2dbe55573..e5f2c9a6d 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3140,7 +3140,15 @@ set_shellsize(width, height, mustset)
else
{
update_topline();
- update_screen(NOT_VALID);
+#if defined(FEAT_INS_EXPAND)
+ if (pum_visible())
+ {
+ redraw_later(NOT_VALID);
+ ins_compl_show_pum(); /* This includes the redraw. */
+ }
+ else
+#endif
+ update_screen(NOT_VALID);
if (redrawing())
setcursor();
}
diff --git a/src/version.h b/src/version.h
index 522ec9001..e62531893 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 (2006 Jan 26)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 26, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 29)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 29, compiled "