summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvimboss <devnull@localhost>2005-12-28 22:39:57 +0000
committervimboss <devnull@localhost>2005-12-28 22:39:57 +0000
commitb9a2bd01096e7c8ba098abf050fd6887051b9cf4 (patch)
tree63e6374375ebc6744379fba43c1c557187490143
parent16e3463fe0130f38fd5a7643fa42253a180d8124 (diff)
downloadvim-b9a2bd01096e7c8ba098abf050fd6887051b9cf4.tar.gz
updated for version 7.0177v7.0177v7-0177
-rw-r--r--runtime/doc/cmdline.txt5
-rw-r--r--runtime/doc/eval.txt4
-rw-r--r--runtime/doc/insert.txt4
-rw-r--r--runtime/doc/todo.txt11
-rw-r--r--runtime/doc/version7.txt18
-rw-r--r--runtime/mswin.vim8
-rw-r--r--src/edit.c6
-rw-r--r--src/ex_cmds.c2
-rw-r--r--src/ex_docmd.c6
-rw-r--r--src/ex_getln.c10
-rw-r--r--src/getchar.c44
-rw-r--r--src/keymap.h2
-rw-r--r--src/main.c2
-rw-r--r--src/misc2.c11
-rw-r--r--src/normal.c24
-rw-r--r--src/proto/getchar.pro2
-rw-r--r--src/search.c2
-rw-r--r--src/spell.c3
-rw-r--r--src/term.c3
-rw-r--r--src/testdir/test60.in217
-rw-r--r--src/testdir/test60.ok80
-rw-r--r--src/ui.c10
-rw-r--r--src/version.h4
23 files changed, 415 insertions, 63 deletions
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index f577ef24..72b3c295 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -1,4 +1,4 @@
-*cmdline.txt* For Vim version 7.0aa. Last change: 2005 Dec 23
+*cmdline.txt* For Vim version 7.0aa. Last change: 2005 Dec 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -153,7 +153,8 @@ CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_<C-R>*
*c_CTRL-R_=*
'=' the expression register: you are prompted to
enter an expression (see |expression|)
- (doesn't work at the expression prompt)
+ (doesn't work at the expression prompt; uses
+ the |sandbox| to avoid side effects)
See |registers| about registers. {not in Vi}
Implementation detail: When using the |expression| register
and invoking setcmdpos(), this sets the position before
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 50cbec9b..7d705820 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.0aa. Last change: 2005 Dec 19
+*eval.txt* For Vim version 7.0aa. Last change: 2005 Dec 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -6804,7 +6804,7 @@ The 'foldexpr', 'includeexpr', 'indentexpr', 'statusline' and 'foldtext'
options are evaluated in a sandbox. This means that you are protected from
these expressions having nasty side effects. This gives some safety for when
these options are set from a modeline. It is also used when the command from
-a tags file is executed.
+a tags file is executed and for CTRL-R = in the command line.
The sandbox is also used for the |:sandbox| command.
These items are not allowed in the sandbox:
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 9fc2f5ad..f7db100c 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt* For Vim version 7.0aa. Last change: 2005 Dec 18
+*insert.txt* For Vim version 7.0aa. Last change: 2005 Dec 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -953,7 +953,7 @@ CTRL-P Find previous match for words that start with the
INSERT COMPLETION POPUP MENU *ins-completion-menu*
-
+ *popupmenu-completion*
Vim can display the matches in a simplistic popup menu.
The menu is used when:
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 8ce42e3b..740fe935 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.0aa. Last change: 2005 Dec 23
+*todo.txt* For Vim version 7.0aa. Last change: 2005 Dec 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,6 +30,8 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
+Win32: test52 fails.
+
ccomplete:
- When an option is set: In completion mode and the user types (identifier)
characters, advance to the first match instead of removing the popup menu.
@@ -1860,8 +1862,6 @@ Robustness:
Performance:
7 For strings up to 3 bytes don't allocate memory, use v_list itself as a
character array. Use VAR_SSTRING (short string).
-8 Loading plugins takes startup time. Only load the part that is used to
- trigger the rest, and load the rest when it's needed?
8 Turn b_syn_ic and b_syn_containedin into b_syn_flags.
9 Loading menu.vim still takes quite a bit of time. How to make it faster?
8 in_id_list() takes much time for syntax highlighting. Cache the result?
@@ -2243,6 +2243,7 @@ Autocommands:
8 Use another option than 'updatetime' for the CursorHold event. The two
things are unrelated for the user (but the implementation is more
difficult).
+8 Add an event like CursorHold that is triggered repeatedly, not just once.
8 Also trigger CursorHold in Insert mode?
7 Add autocommand event for when a buffer cannot be abandoned. So that user
can define the action taking (autowrite, dialog, fail) based on the kind
@@ -2312,8 +2313,7 @@ Autocommands:
that marks can be updated. HierAssist has patch to add
BufChangePre, BufChangePost and RevertBuf. (Shah)
WinResized - When a window has been resized
-- Add autocommand to be executed every so many seconds? For writing the
- file now and then ('autosave').
+- Write the file now and then ('autosave'):
*'autosave'* *'as'* *'noautosave'* *'noas'*
'autosave' 'aw' number (default 0)
Automatically write the current buffer to file N seconds after the
@@ -3356,6 +3356,7 @@ Various improvements:
8 Add "g^E" and "g^Y", to scroll a screen-full line up and down.
6 Add ":timer" command, to set a command to be executed at a certain
interval, or once after some time has elapsed. (Aaron)
+ Perhaps an autocommand event like CursorHold is better?
8 Add ":confirm" handling in open_exfile(), for when file already exists.
8 When quitting with changed files, make the dialog list the changed file
and allow "write all", "discard all", "write some". The last one would
diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt
index 953c7e74..8518f828 100644
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt* For Vim version 7.0aa. Last change: 2005 Dec 23
+*version7.txt* For Vim version 7.0aa. Last change: 2005 Dec 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1517,4 +1517,20 @@ writing file "a" to create "b" and then ":split b" resulted in two buffers on
the same file with two different swapfile names. Now set the inode in the
buffer when creating a new file.
+When 'esckeys' is not set don't send the xterm code to request the version
+string, because it may cause trouble in Insert mode.
+
+When evaluating an expression for CTRL-R = on the command line it was possible
+to open a new window, resulting in errors for incremental search, and many
+other nasty things were possible. Now evaluate the expression in the sandbox
+to protect from unexpected behavior.
+
+"d(" deleted the character under the cursor, while the documentation specified
+an exclusive motion. Vi also doesn't delete the character under the cursor.
+
+Shift-Insert in Insert mode could put the cursor before the last character
+when it just fits in the window. In coladvance() don't stop at the window
+edge when filling with spaces and when in Insert mode. In mswin.vim avoid
+getting a beep from the "l" command.
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/mswin.vim b/runtime/mswin.vim
index d82b6774..48458ed4 100644
--- a/runtime/mswin.vim
+++ b/runtime/mswin.vim
@@ -1,7 +1,7 @@
" Set options and add mapping such that Vim behaves a lot like MS-Windows
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last change: 2004 Jul 27
+" Last change: 2005 Dec 28
" bail out if this isn't wanted (mrsvim.vim uses this).
if exists("g:skip_loading_mswin") && g:skip_loading_mswin
@@ -54,7 +54,13 @@ if has("virtualedit")
let c = col(".")
normal i
if col(".") < c " compensate for i<ESC> moving the cursor left
+ " Avoid a beep when the text ends at the window edge.
+ let vb_save = &vb
+ let t_vb_save = &t_vb
+ set vb t_vb=
normal l
+ let &vb = vb_save
+ let &t_vb = t_vb_save
endif
let &ve = ove
endfunc
diff --git a/src/edit.c b/src/edit.c
index c21c7e3f..23dd57eb 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2657,7 +2657,7 @@ ins_compl_prep(c)
}
for (temp = 0; p[temp]; ++temp)
AppendCharToRedobuff(K_BS);
- AppendToRedobuffLit(ptr);
+ AppendToRedobuffLit(ptr, -1);
}
#ifdef FEAT_CINDENT
@@ -4240,7 +4240,7 @@ insert_special(c, allow_modmask, ctrlv)
return;
p[len - 1] = NUL;
ins_str(p);
- AppendToRedobuffLit(p);
+ AppendToRedobuffLit(p, -1);
ctrlv = FALSE;
}
}
@@ -4756,7 +4756,7 @@ insertchar(c, flags, second_indent)
else
i = 0;
if (buf[i] != NUL)
- AppendToRedobuffLit(buf + i);
+ AppendToRedobuffLit(buf + i, -1);
}
else
{
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 1d8348d2..006733c4 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -921,7 +921,7 @@ do_bang(addr_count, eap, forceit, do_in, do_out)
if (bangredo) /* put cmd in redo buffer for ! command */
{
- AppendToRedobuffLit(prevcmd);
+ AppendToRedobuffLit(prevcmd, -1);
AppendToRedobuff((char_u *)"\n");
bangredo = FALSE;
}
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 3e001a24..a49dfce8 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2826,11 +2826,7 @@ find_ucmd(eap, p, full, xp, compl)
if (k == len && found && *np != NUL)
{
if (gap == &ucmds)
- {
- if (xp != NULL)
- xp->xp_context = EXPAND_UNSUCCESSFUL;
return NULL;
- }
amb_local = TRUE;
}
@@ -3091,6 +3087,8 @@ set_one_cmd_context(xp, buff)
NULL
# endif
);
+ if (p == NULL)
+ ea.cmdidx = CMD_SIZE; /* ambiguous user command */
}
#endif
}
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 508c563a..335f2a41 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2765,9 +2765,17 @@ cmdline_paste(regname, literally)
regname = may_get_selection(regname);
#endif
- /* Need to save and restore ccline. */
+ /* Need to save and restore ccline. And go into the sandbox to avoid
+ * nasty things like going to another buffer when evaluating an
+ * expression. */
save_cmdline(&save_ccline);
+#ifdef HAVE_SANDBOX
+ ++sandbox;
+#endif
i = get_spec_reg(regname, &arg, &allocated, TRUE);
+#ifdef HAVE_SANDBOX
+ --sandbox;
+#endif
restore_cmdline(&save_ccline);
if (i)
diff --git a/src/getchar.c b/src/getchar.c
index 69cebaee..c1c9bca7 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -529,16 +529,18 @@ AppendToRedobuff(s)
* K_SPECIAL and CSI are escaped as well.
*/
void
-AppendToRedobuffLit(s)
- char_u *s;
+AppendToRedobuffLit(str, len)
+ char_u *str;
+ int len; /* length of "str" or -1 for up to the NUL */
{
+ char_u *s = str;
int c;
char_u *start;
if (block_redo)
return;
- while (*s != NUL)
+ while (len < 0 ? *s != NUL : s - str < len)
{
/* Put a string of normal characters in the redo buffer (that's
* faster). */
@@ -547,7 +549,7 @@ AppendToRedobuffLit(s)
#ifndef EBCDIC
&& *s < DEL /* EBCDIC: all chars above space are normal */
#endif
- )
+ && (len < 0 || s - str < len))
++s;
/* Don't put '0' or '^' as last character, just in case a CTRL-D is
@@ -557,29 +559,29 @@ AppendToRedobuffLit(s)
if (s > start)
add_buff(&redobuff, start, (long)(s - start));
- if (*s != NUL)
- {
- /* Handle a special or multibyte character. */
+ if (*s == NUL || (len >= 0 && s - str >= len))
+ break;
+
+ /* Handle a special or multibyte character. */
#ifdef FEAT_MBYTE
- if (has_mbyte)
- /* Handle composing chars separately. */
- c = mb_cptr2char_adv(&s);
- else
+ if (has_mbyte)
+ /* Handle composing chars separately. */
+ c = mb_cptr2char_adv(&s);
+ else
#endif
- c = *s++;
- if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^')))
- add_char_buff(&redobuff, Ctrl_V);
+ c = *s++;
+ if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^')))
+ add_char_buff(&redobuff, Ctrl_V);
- /* CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0) */
- if (*s == NUL && c == '0')
+ /* CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0) */
+ if (*s == NUL && c == '0')
#ifdef EBCDIC
- add_buff(&redobuff, (char_u *)"xf0", 3L);
+ add_buff(&redobuff, (char_u *)"xf0", 3L);
#else
- add_buff(&redobuff, (char_u *)"048", 3L);
+ add_buff(&redobuff, (char_u *)"048", 3L);
#endif
- else
- add_char_buff(&redobuff, c);
- }
+ else
+ add_char_buff(&redobuff, c);
}
}
diff --git a/src/keymap.h b/src/keymap.h
index 88855f1f..0aa44749 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -247,6 +247,7 @@ enum key_extra
, KE_DROP /* DnD data is available */
, KE_CURSORHOLD /* CursorHold event */
+ , KE_NOP /* doesn't do something */
};
/*
@@ -422,6 +423,7 @@ enum key_extra
#define K_X2RELEASE TERMCAP2KEY(KS_EXTRA, KE_X2RELEASE)
#define K_IGNORE TERMCAP2KEY(KS_EXTRA, KE_IGNORE)
+#define K_NOP TERMCAP2KEY(KS_EXTRA, KE_NOP)
#define K_SNIFF TERMCAP2KEY(KS_EXTRA, KE_SNIFF)
diff --git a/src/main.c b/src/main.c
index 89bad4c9..551e980f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -871,7 +871,7 @@ main
/* If ":startinsert" command used, stuff a dummy command to be able to
* call normal_cmd(), which will then start Insert mode. */
if (restart_edit != 0)
- stuffcharReadbuff(K_IGNORE);
+ stuffcharReadbuff(K_NOP);
#ifdef FEAT_NETBEANS_INTG
if (usingNetbeans)
diff --git a/src/misc2.c b/src/misc2.c
index e8845e25..c3f2b379 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -177,7 +177,7 @@ coladvance2(pos, addspaces, finetune, wcol)
#ifdef FEAT_VIRTUALEDIT
int width = W_WIDTH(curwin) - win_col_off(curwin);
- if ((addspaces || finetune)
+ if (finetune
&& curwin->w_p_wrap
# ifdef FEAT_VERTSPLIT
&& curwin->w_width != 0
@@ -188,10 +188,13 @@ coladvance2(pos, addspaces, finetune, wcol)
if (csize > 0)
csize--;
- if (wcol / width > (colnr_T)csize / width)
+ if (wcol / width > (colnr_T)csize / width
+ && ((State & INSERT) == 0 || (int)wcol > csize + 1))
{
/* In case of line wrapping don't move the cursor beyond the
- * right screen edge. */
+ * right screen edge. In Insert mode allow going just beyond
+ * the last character (like what happens when typing and
+ * reaching the right window edge). */
wcol = (csize / width + 1) * width - 1;
}
}
@@ -501,7 +504,7 @@ check_cursor_col()
{
/* Allow cursor past end-of-line in Insert mode, restarting Insert
* mode or when in Visual mode and 'selection' isn't "old" */
- if (State & INSERT || restart_edit
+ if ((State & INSERT) || restart_edit
#ifdef FEAT_VISUAL
|| (VIsual_active && *p_sel != 'o')
#endif
diff --git a/src/normal.c b/src/normal.c
index 80f08645..b0262b22 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -57,6 +57,7 @@ static void del_from_showcmd __ARGS((int));
* v_*(): functions called to handle Visual mode commands.
*/
static void nv_ignore __ARGS((cmdarg_T *cap));
+static void nv_nop __ARGS((cmdarg_T *cap));
static void nv_error __ARGS((cmdarg_T *cap));
static void nv_help __ARGS((cmdarg_T *cap));
static void nv_addsub __ARGS((cmdarg_T *cap));
@@ -378,6 +379,7 @@ static const struct nv_cmd
{K_X2RELEASE, nv_mouse, 0, 0},
#endif
{K_IGNORE, nv_ignore, 0, 0},
+ {K_NOP, nv_nop, 0, 0},
{K_INS, nv_edit, 0, 0},
{K_KINS, nv_edit, 0, 0},
{K_BS, nv_ctrlh, 0, 0},
@@ -1415,7 +1417,7 @@ do_pending_operator(cap, old_col, gui_yank)
* pattern to really repeat the same command.
*/
if (vim_strchr(p_cpo, CPO_REDO) == NULL)
- AppendToRedobuffLit(cap->searchbuf);
+ AppendToRedobuffLit(cap->searchbuf, -1);
AppendToRedobuff(NL_STR);
}
else if (cap->cmdchar == ':')
@@ -1427,7 +1429,7 @@ do_pending_operator(cap, old_col, gui_yank)
ResetRedobuff();
else
{
- AppendToRedobuffLit(repeat_cmdline);
+ AppendToRedobuffLit(repeat_cmdline, -1);
AppendToRedobuff(NL_STR);
vim_free(repeat_cmdline);
repeat_cmdline = NULL;
@@ -3928,7 +3930,6 @@ check_scrollbind(topline_diff, leftcol_diff)
* Used for CTRL-Q and CTRL-S to avoid problems with terminals that use
* xon/xoff
*/
-/*ARGSUSED */
static void
nv_ignore(cap)
cmdarg_T *cap;
@@ -3937,6 +3938,17 @@ nv_ignore(cap)
}
/*
+ * Command character that doesn't do anything, but unlike nv_ignore() does
+ * start edit(). Used for "startinsert" executed while starting up.
+ */
+/*ARGSUSED */
+ static void
+nv_nop(cap)
+ cmdarg_T *cap;
+{
+}
+
+/*
* Command character doesn't exist.
*/
static void
@@ -6320,10 +6332,8 @@ nv_brace(cap)
{
cap->oap->motion_type = MCHAR;
cap->oap->use_reg_one = TRUE;
- if (cap->cmdchar == ')')
- cap->oap->inclusive = FALSE;
- else
- cap->oap->inclusive = TRUE;
+ /* The motion used to be inclusive for "(", but that is not what Vi does. */
+ cap->oap->inclusive = FALSE;
curwin->w_set_curswant = TRUE;
if (findsent(cap->arg, cap->count1) == FAIL)
diff --git a/src/proto/getchar.pro b/src/proto/getchar.pro
index 27099898..e38f3800 100644
--- a/src/proto/getchar.pro
+++ b/src/proto/getchar.pro
@@ -9,7 +9,7 @@ void ResetRedobuff __ARGS((void));
void saveRedobuff __ARGS((void));
void restoreRedobuff __ARGS((void));
void AppendToRedobuff __ARGS((char_u *s));
-void AppendToRedobuffLit __ARGS((char_u *s));
+void AppendToRedobuffLit __ARGS((char_u *str, int len));
void AppendCharToRedobuff __ARGS((int c));
void AppendNumberToRedobuff __ARGS((long n));
void stuffReadbuff __ARGS((char_u *s));
diff --git a/src/search.c b/src/search.c
index 5311141d..5e370b89 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2394,7 +2394,7 @@ showmatch(c)
/*
* findsent(dir, count) - Find the start of the next sentence in direction
- * 'dir' Sentences are supposed to end in ".", "!" or "?" followed by white
+ * "dir" Sentences are supposed to end in ".", "!" or "?" followed by white
* space or a line break. Also stop at an empty line.
* Return OK if the next sentence was found.
*/
diff --git a/src/spell.c b/src/spell.c
index 303ed587..d12a4bc5 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -8594,7 +8594,8 @@ spell_suggest(count)
/* For redo we use a change-word command. */
ResetRedobuff();
AppendToRedobuff((char_u *)"ciw");
- AppendToRedobuff(stp->st_word);
+ AppendToRedobuffLit(p + c,
+ STRLEN(stp->st_word) + sug.su_badlen - stp->st_orglen);
AppendCharToRedobuff(ESC);
}
}
diff --git a/src/term.c b/src/term.c
index a52e3fa2..cc3c0365 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3256,6 +3256,8 @@ stoptermcap()
* echoed.
* Only do this after termcap mode has been started, otherwise the codes for
* the cursor keys may be wrong.
+ * Only do this when 'esckeys' is on, otherwise the response causes trouble in
+ * Insert mode.
* On Unix only do it when both output and input are a tty (avoid writing
* request to terminal while reading from a file).
* The result is caught in check_termcode().
@@ -3266,6 +3268,7 @@ may_req_termresponse()
if (crv_status == CRV_GET
&& cur_tmode == TMODE_RAW
&& termcap_active
+ && p_ek
#ifdef UNIX
&& isatty(1)
&& isatty(read_cmd_fd)
diff --git a/src/testdir/test60.in b/src/testdir/test60.in
index 4435343a..9899a94e 100644
--- a/src/testdir/test60.in
+++ b/src/testdir/test60.in
@@ -47,6 +47,40 @@ endfunction
" Non-existing autocmd event
let test_cases += [['##MySpecialCmd', 0]]
+ " Existing and working option (long form)
+ let test_cases += [['&textwidth', 1]]
+ " Existing and working option (short form)
+ let test_cases += [['&tw', 1]]
+ " Negative form of existing and working option (long form)
+ let test_cases += [['&nojoinspaces', 0]]
+ " Negative form of existing and working option (short form)
+ let test_cases += [['&nojs', 0]]
+ " Non-existing option
+ let test_cases += [['&myxyzoption', 0]]
+
+ " Existing and working option (long form)
+ let test_cases += [['+incsearch', 1]]
+ " Existing and working option (short form)
+ let test_cases += [['+is', 1]]
+ " Existing option that is hidden.
+ let test_cases += [['+autoprint', 0]]
+
+ " Existing environment variable
+ let $EDITOR_NAME = 'Vim Editor'
+ let test_cases += [['$EDITOR_NAME', 1]]
+ " Non-existing environment variable
+ let test_cases += [['$NON_ENV_VAR', 0]]
+
+ " Valid internal function
+ let test_cases += [['*bufnr', 1]]
+ " Non-existing internal function
+ let test_cases += [['*myxyzfunc', 0]]
+
+ " Valid user defined function
+ let test_cases += [['*TestExists', 1]]
+ " Non-existing user defined function
+ let test_cases += [['*MyxyzFunc', 0]]
+
redir! > test.out
for [test_case, result] in test_cases
@@ -54,6 +88,189 @@ endfunction
call RunTest(test_case, result)
endfor
+ " Valid internal command (full match)
+ echo ':edit: 2'
+ if exists(':edit') == 2
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Valid internal command (partial match)
+ echo ':q: 1'
+ if exists(':q') == 1
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing internal command
+ echo ':invalidcmd: 0'
+ if !exists(':invalidcmd')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " User defined command (full match)
+ command! MyCmd :echo 'My command'
+ echo ':MyCmd: 2'
+ if exists(':MyCmd') == 2
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " User defined command (partial match)
+ command! MyOtherCmd :echo 'Another command'
+ echo ':My: 3'
+ if exists(':My') == 3
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Command modifier
+ echo ':rightbelow: 2'
+ if exists(':rightbelow') == 2
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing user defined command (full match)
+ delcommand MyCmd
+
+ echo ':MyCmd: 0'
+ if !exists(':MyCmd')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing user defined command (partial match)
+ delcommand MyOtherCmd
+
+ echo ':My: 0'
+ if !exists(':My')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Valid local variable
+ let local_var = 1
+ echo 'local_var: 1'
+ if exists('local_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing local variable
+ unlet local_var
+ echo 'local_var: 0'
+ if !exists('local_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Valid local list
+ let local_list = ["blue", "orange"]
+ echo 'local_list: 1'
+ if exists('local_list')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing local list
+ unlet local_list
+ echo 'local_list: 0'
+ if !exists('local_list')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Valid local dictionary
+ let local_dict = {"xcord":100, "ycord":2}
+ echo 'local_dict: 1'
+ if exists('local_dict')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing local dictionary
+ unlet local_dict
+ echo 'local_dict: 0'
+ if !exists('local_dict')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Existing global variable
+ let g:global_var = 1
+ echo 'g:global_var: 1'
+ if exists('g:global_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing global variable
+ unlet g:global_var
+ echo 'g:global_var: 0'
+ if !exists('g:global_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Existing local curly-brace variable
+ let curly_local_var = 1
+ let str = "local"
+ echo 'curly_{str}_var: 1'
+ if exists('curly_{str}_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing local curly-brace variable
+ unlet curly_local_var
+ echo 'curly_{str}_var: 0'
+ if !exists('curly_{str}_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Existing global curly-brace variable
+ let g:curly_global_var = 1
+ let str = "global"
+ echo 'g:curly_{str}_var: 1'
+ if exists('g:curly_{str}_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Non-existing global curly-brace variable
+ unlet g:curly_global_var
+ echo 'g:curly_{str}_var: 0'
+ if !exists('g:curly_{str}_var')
+ echo "OK"
+ else
+ echo "FAILED"
+ endif
+
+ " Script-local tests
+ source test60.vim
+
redir END
endfunction
:call TestExists()
diff --git a/src/testdir/test60.ok b/src/testdir/test60.ok
index 0d1e3dcc..fe6c4b76 100644
--- a/src/testdir/test60.ok
+++ b/src/testdir/test60.ok
@@ -29,3 +29,83 @@ OK
OK
##MySpecialCmd: 0
OK
+&textwidth: 1
+OK
+&tw: 1
+OK
+&nojoinspaces: 0
+OK
+&nojs: 0
+OK
+&myxyzoption: 0
+OK
++incsearch: 1
+OK
++is: 1
+OK
++autoprint: 0
+OK
+$EDITOR_NAME: 1
+OK
+$NON_ENV_VAR: 0
+OK
+*bufnr: 1
+OK
+*myxyzfunc: 0
+OK
+*TestExists: 1
+OK
+*MyxyzFunc: 0
+OK
+:edit: 2
+OK
+:q: 1
+OK
+:invalidcmd: 0
+OK
+:MyCmd: 2
+OK
+:My: 3
+OK
+:rightbelow: 2
+OK
+:MyCmd: 0
+OK
+:My: 0
+OK
+local_var: 1
+OK
+local_var: 0
+OK
+local_list: 1
+OK
+local_list: 0
+OK
+local_dict: 1
+OK
+local_dict: 0
+OK
+g:global_var: 1
+OK
+g:global_var: 0
+OK
+curly_{str}_var: 1
+OK
+curly_{str}_var: 0
+OK
+g:curly_{str}_var: 1
+OK
+g:curly_{str}_var: 0
+OK
+s:script_var: 1
+OK
+s:script_var: 0
+OK
+s:curly_{str}_var: 1
+OK
+s:curly_{str}_var: 0
+OK
+*s:my_script_func: 1
+OK
+*s:my_script_func: 0
+OK
diff --git a/src/ui.c b/src/ui.c
index c48af4ef..ba5911f8 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -469,9 +469,9 @@ clip_own_selection(cbd)
#ifdef FEAT_X11
if (cbd == &clip_star)
{
- /* May have to show a different kind of highlighting for the selected
- * area. There is no specific redraw command for this, just redraw
- * all windows on the current buffer. */
+ /* May have to show a different kind of highlighting for the
+ * selected area. There is no specific redraw command for this,
+ * just redraw all windows on the current buffer. */
if (cbd->owned
&& get_real_state() == VISUAL
&& clip_isautosel()
@@ -2130,6 +2130,10 @@ clip_x11_request_selection(myShell, dpy, cbd)
{
if (XCheckTypedEvent(dpy, SelectionNotify, &event))
break;
+ if (XCheckTypedEvent(dpy, SelectionRequest, &event))
+ /* We may get a SelectionRequest here and if we don't handle
+ * it we hang. KDE klipper does this, for example. */
+ XtDispatchEvent(&event);
/* Do we need this? Probably not. */
XSync(dpy, False);
diff --git a/src/version.h b/src/version.h
index 1402a487..3e0e393b 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 Dec 23)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 23, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 28)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 28, compiled "