summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-12-22 22:47:02 +0000
committerBram Moolenaar <Bram@vim.org>2005-12-22 22:47:02 +0000
commitf4cd3e8074641af68bf2b6a8579c3da58f0ac013 (patch)
treee0d8399f0df9baaaff825e575da4625935c64583 /src
parentbb1004ee56bde6345b469568e2bdd86b54b32bf7 (diff)
downloadvim-git-f4cd3e8074641af68bf2b6a8579c3da58f0ac013.tar.gz
updated for version 7.0175v7.0175
Diffstat (limited to 'src')
-rwxr-xr-xsrc/configure2
-rw-r--r--src/edit.c3
-rw-r--r--src/eval.c5
-rw-r--r--src/fileio.c16
-rw-r--r--src/gui_w32.c4
-rw-r--r--src/message.c4
-rw-r--r--src/proto/fileio.pro1
-rw-r--r--src/testdir/Make_amiga.mak2
-rw-r--r--src/testdir/Make_dos.mak2
-rw-r--r--src/testdir/Make_os2.mak2
-rw-r--r--src/testdir/Make_vms.mms2
-rw-r--r--src/testdir/Makefile2
-rw-r--r--src/testdir/test60.in71
-rw-r--r--src/testdir/test60.ok16
-rw-r--r--src/version.c2
-rw-r--r--src/version.h4
16 files changed, 123 insertions, 15 deletions
diff --git a/src/configure b/src/configure
index 6aa15be9c..f9f65fa36 100755
--- a/src/configure
+++ b/src/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# run the automatically generated configure script
CONFIG_STATUS=auto/config.status \
- auto/configure "$@" --srcdir="${srcdir-.}" --cache-file=auto/config.cache
+ auto/configure "$@" --srcdir="${srcdir:-.}" --cache-file=auto/config.cache
# Stupid autoconf 2.5x causes this file to be left behind.
if test -f configure.lineno; then rm -f configure.lineno; fi
diff --git a/src/edit.c b/src/edit.c
index f4f3f9a77..c21c7e3fb 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -5113,7 +5113,8 @@ stop_insert(end_insert_pos, esc)
* otherwise CTRL-O w and then <Left> will clear "last_insert".
*/
ptr = get_inserted();
- if (did_restart_edit == 0 || (ptr != NULL && STRLEN(ptr) > new_insert_skip))
+ if (did_restart_edit == 0 || (ptr != NULL
+ && (int)STRLEN(ptr) > new_insert_skip))
{
vim_free(last_insert);
last_insert = ptr;
diff --git a/src/eval.c b/src/eval.c
index e6e712bdf..eef865a4b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -8459,7 +8459,10 @@ f_exists(argvars, rettv)
else if (*p == '#')
{
#ifdef FEAT_AUTOCMD
- n = au_exists(p + 1);
+ if (p[1] == '#')
+ n = autocmd_supported(p + 2);
+ else
+ n = au_exists(p + 1);
#endif
}
else /* internal variable */
diff --git a/src/fileio.c b/src/fileio.c
index 2f93f53e8..1ff4e4609 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -8827,6 +8827,18 @@ get_event_name(xp, idx)
#endif /* FEAT_CMDL_COMPL */
/*
+ * Return TRUE if autocmd is supported.
+ */
+ int
+autocmd_supported(name)
+ char_u *name;
+{
+ char_u *p;
+
+ return (event_name2nr(name, &p) != NUM_EVENTS);
+}
+
+/*
* Return TRUE if an autocommand is defined for a group, event and
* pattern: The group can be omitted to accept any group. "event" and "pattern"
* can be NULL to accept any event and pattern. "pattern" can be NULL to accept
@@ -8852,11 +8864,11 @@ au_exists(arg)
int group;
int retval = FALSE;
- /* Make a copy so that we can change the '#' to a NUL. */
+ /* Make a copy so that we can change the '#' chars to a NUL. */
arg_save = vim_strsave(arg);
if (arg_save == NULL)
return FALSE;
- p = vim_strchr(arg, '#');
+ p = vim_strchr(arg_save, '#');
if (p != NULL)
*p++ = NUL;
diff --git a/src/gui_w32.c b/src/gui_w32.c
index c5d1eb009..c49d82b3e 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2522,8 +2522,7 @@ gui_mch_menu_grey(
#define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1)
#define add_word(x) *p++ = (x)
-#define add_byte(x) *((LPSTR)p)++ = (x)
-#define add_long(x) *((LPDWORD)p)++ = (x)
+#define add_long(x) dwp = (DWORD *)p; *dwp++ = (x); p = (WORD *)dwp
#if defined(FEAT_GUI_DIALOG) || defined(PROTO)
/*
@@ -2650,6 +2649,7 @@ gui_mch_dialog(
char_u *textfield)
{
WORD *p, *pdlgtemplate, *pnumitems;
+ DWORD *dwp;
int numButtons;
int *buttonWidths, *buttonPositions;
int buttonYpos;
diff --git a/src/message.c b/src/message.c
index 147867248..8ea49ae20 100644
--- a/src/message.c
+++ b/src/message.c
@@ -722,6 +722,10 @@ msg_may_trunc(force, s)
{
int size = vim_strsize(s);
+ /* There may be room anyway when there are multibyte chars. */
+ if (size <= room)
+ return s;
+
for (n = 0; size >= room; )
{
size -= (*mb_ptr2cells)(s + n);
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
index 816de42cb..52ae6424e 100644
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -41,6 +41,7 @@ int has_autocmd __ARGS((EVENT_T event, char_u *sfname, buf_T *buf));
char_u *get_augroup_name __ARGS((expand_T *xp, int idx));
char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd));
char_u *get_event_name __ARGS((expand_T *xp, int idx));
+int autocmd_supported __ARGS((char_u *name));
int au_exists __ARGS((char_u *arg));
int match_file_pat __ARGS((char_u *pattern, regprog_T *prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs));
int match_file_list __ARGS((char_u *list, char_u *sfname, char_u *ffname));
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index e9e75e517..aee0894fc 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -24,7 +24,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out test54.out test55.out \
- test56.out test57.out test58.out test59.out
+ test56.out test57.out test58.out test59.out test60.out
.SUFFIXES: .in .out
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index 092b24aac..1821cca4c 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -25,7 +25,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test15.out test17.out test18.out test21.out test26.out \
test30.out test31.out test32.out test33.out test34.out \
test37.out test38.out test39.out test40.out test41.out \
- test42.out test52.out
+ test42.out test52.out test60.out
SCRIPTS32 = test50.out
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index 5236922c5..d8b2f7507 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -24,7 +24,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out test54.out test55.out \
- test56.out test57.out test58.out test59.out
+ test56.out test57.out test58.out test59.out test60.out
.SUFFIXES: .in .out
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 6d08e5041..767ab7840 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -58,7 +58,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out \
test48.out test51.out test53.out test54.out test55.out \
- test56.out test57.out test58.out test59.out
+ test56.out test57.out test58.out test59.out test60.out
.IFDEF WANT_GUI
SCRIPT_GUI = test16.out
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 06c417357..49f14f9f9 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -15,7 +15,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test43.out test44.out test45.out test46.out test47.out \
test48.out test49.out test51.out test52.out test53.out \
test54.out test55.out test56.out test57.out test58.out \
- test59.out
+ test59.out test60.out
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test60.in b/src/testdir/test60.in
new file mode 100644
index 000000000..58a2c9083
--- /dev/null
+++ b/src/testdir/test60.in
@@ -0,0 +1,71 @@
+Tests for the exists() function. vim: set ft=vim :
+
+STARTTEST
+:so small.vim
+:function! RunTest(str, result)
+ if exists(a:str) == a:result
+ echo "OK"
+ else
+ echo "FAILED: Checking for " . a:str
+ endif
+endfunction
+:function! TestExists()
+ augroup myagroup
+ autocmd! BufEnter *.my echo 'myfile edited'
+ augroup END
+ redir! > test.out
+
+ " valid autocmd group
+ call RunTest('#myagroup', 1)
+
+ " Valid autocmd group and event
+ call RunTest('#myagroup#BufEnter', 1)
+
+ " Valid autocmd group, event and pattern
+ call RunTest('#myagroup#BufEnter#*.my', 1)
+
+ " Valid autocmd event
+ call RunTest('#BufEnter', 1)
+
+ " Valid autocmd event and pattern
+ call RunTest('#BufEnter#*.my', 1)
+
+ " Non-existing autocmd group or event
+ call RunTest('#xyzagroup', 0)
+
+ " Non-existing autocmd group and valid autocmd event
+ call RunTest('#xyzagroup#BufEnter', 0)
+
+ " Valid autocmd group and autocmd event with no matching pattern
+ call RunTest('#myagroup#CmdwinEnter', 0)
+
+ " Valid autocmd group and non-existing autocmd event
+ call RunTest('#myagroup#xyzacmd', 0)
+
+ " Valid autocmd group and event and non-matching pattern
+ call RunTest('#myagroup#BufEnter#xyzpat', 0)
+
+ " Valid autocmd event and non-matching pattern
+ call RunTest('#BufEnter#xyzpat', 0)
+
+ " Empty autocmd group, event and pattern
+ call RunTest('###', 0)
+
+ " Empty autocmd group and event or event and pattern
+ call RunTest('##', 0)
+
+ " Testing support for event name that exists.
+ call RunTest('##SwapExists', 1)
+
+ " Testing support for event name that doesn't exist.
+ call RunTest('##SwapNotExists', 0)
+
+ redir END
+endfunction
+:call TestExists()
+:edit! test.out
+:set ff=unix
+:w
+:qa!
+ENDTEST
+
diff --git a/src/testdir/test60.ok b/src/testdir/test60.ok
new file mode 100644
index 000000000..004245ff6
--- /dev/null
+++ b/src/testdir/test60.ok
@@ -0,0 +1,16 @@
+
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
diff --git a/src/version.c b/src/version.c
index 69a47fff7..f14734813 100644
--- a/src/version.c
+++ b/src/version.c
@@ -1082,7 +1082,7 @@ intro_message(colon)
/* Show the sponsor and register message one out of four times, the Uganda
* message two out of four times. */
- sponsor = time(NULL);
+ sponsor = (int)time(NULL);
sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
/* start displaying the message lines after half of the blank lines */
diff --git a/src/version.h b/src/version.h
index cc5a45b0d..e26c13a8e 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 19)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 19, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 22)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Dec 22, compiled "