Compare commits

...

21 Commits

Author SHA1 Message Date
Bram Moolenaar
fa316dd1f7 updated for version 7.2-277 2009-11-03 15:23:14 +00:00
Bram Moolenaar
2ac5e603d8 updated for version 7.2-276 2009-11-03 15:04:20 +00:00
Bram Moolenaar
740885b78b updated for version 7.2-275 2009-11-03 14:33:17 +00:00
Bram Moolenaar
ec98647b1c updated for version 7.2-274 2009-11-03 13:46:54 +00:00
Bram Moolenaar
2f59b5c1cc updated for version 7.2-273 2009-11-03 13:26:55 +00:00
Bram Moolenaar
d0ba34a6e5 updated for version 7.2-272 2009-11-03 12:06:23 +00:00
Bram Moolenaar
0af561dbf2 updated for version 7.2-271 2009-11-03 11:53:55 +00:00
Bram Moolenaar
60462877cb updated for version 7.2-270 2009-11-03 11:40:19 +00:00
Bram Moolenaar
3f269675d4 updated for version 7.2-269 2009-11-03 11:11:11 +00:00
Bram Moolenaar
badfde1bfe updated for version 7.2-268 2009-11-03 10:43:27 +00:00
Bram Moolenaar
8701cd6a22 updated for version 7.2-267 2009-10-07 14:20:30 +00:00
Bram Moolenaar
da9591ecfd updated for version 7.2-266 2009-09-30 13:17:02 +00:00
Bram Moolenaar
becf428bc0 updated for version 7.2-265 2009-09-30 11:24:36 +00:00
Bram Moolenaar
09736232af updated for version 7.2-264 2009-09-23 16:14:49 +00:00
Bram Moolenaar
79ef6d642e updated for version 7.2-263 2009-09-23 15:35:48 +00:00
Bram Moolenaar
67b891e16c updated for version 7.2-262 2009-09-18 15:25:52 +00:00
Bram Moolenaar
194b94c5a8 updated for version 7.2-261 2009-09-18 13:17:09 +00:00
Bram Moolenaar
2db24dc29b updated for version 7.2-260 2009-09-18 12:59:26 +00:00
Bram Moolenaar
5b7880dea2 updated for version 7.2-259 2009-09-11 15:24:31 +00:00
Bram Moolenaar
86c800a1b3 updated for version 7.2-258 2009-09-11 14:48:27 +00:00
Bram Moolenaar
5e69de4421 updated for version 7.2-257 2009-09-11 14:17:54 +00:00
36 changed files with 393 additions and 124 deletions

View File

@@ -224,6 +224,10 @@ expression is evaluated to obtain the {rhs} that is used. Example: >
The result of the InsertDot() function will be inserted. It could check the
text before the cursor and start omni completion when some condition is met.
For abbreviations |v:char| is set to the character that was typed to trigger
the abbreviation. You can use this to decide how to expand the {lhs}. You
can't change v:char and you should not insert it.
Be very careful about side effects! The expression is evaluated while
obtaining characters, you may very well make the command dysfunctional.
For this reason the following is blocked:

View File

@@ -144,6 +144,13 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
-u NORC no yes
--noplugin yes no
--startuptime={fname} *--startuptime*
During startup write timing messages to the file {fname}.
This can be used to find out where time is spent while loading
your .vimrc and plugins.
When {fname} already exists new messages are appended.
{only when compiled with this feature}
*--literal*
--literal Take file names literally, don't expand wildcards. Not needed
for Unix, because Vim always takes file names literally (the
@@ -471,6 +478,7 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
window title and copy/paste using the X clipboard. This
avoids a long startup time when running Vim in a terminal
emulator and the connection to the X server is slow.
See |--startuptime| to find out if affects you.
Only makes a difference on Unix or VMS, when compiled with the
|+X11| feature. Otherwise it's ignored.
To disable the connection only for specific terminals, see the

View File

@@ -187,9 +187,14 @@ buf_init_chartab(buf, global)
if (VIM_ISDIGIT(*p))
c2 = getdigits(&p);
else
#ifdef FEAT_MBYTE
if (has_mbyte)
c2 = mb_ptr2char_adv(&p);
else
#endif
c2 = *p++;
}
if (c <= 0 || (c2 < c && c2 != -1) || c2 >= 256
if (c <= 0 || c >= 256 || (c2 < c && c2 != -1) || c2 >= 256
|| !(*p == NUL || *p == ','))
return FAIL;
@@ -1218,6 +1223,8 @@ in_win_border(wp, vcol)
if ((int)vcol == width1 - 1)
return TRUE;
width2 = width1 + win_col_off2(wp);
if (width2 <= 0)
return FALSE;
return ((vcol - width1) % width2 == width2 - 1);
}
#endif /* FEAT_MBYTE */

View File

@@ -988,13 +988,14 @@ var_redir_start(name, append)
int err;
typval_T tv;
/* Make sure a valid variable name is specified */
/* Catch a bad name early. */
if (!eval_isnamec1(*name))
{
EMSG(_(e_invarg));
return FAIL;
}
/* Make a copy of the name, it is used in redir_lval until redir ends. */
redir_varname = vim_strsave(name);
if (redir_varname == NULL)
return FAIL;
@@ -1019,6 +1020,7 @@ var_redir_start(name, append)
EMSG(_(e_trailing));
else
EMSG(_(e_invarg));
redir_endp = NULL; /* don't store a value, only cleanup */
var_redir_stop();
return FAIL;
}
@@ -1037,6 +1039,7 @@ var_redir_start(name, append)
did_emsg |= save_emsg;
if (err)
{
redir_endp = NULL; /* don't store a value, only cleanup */
var_redir_stop();
return FAIL;
}
@@ -1085,6 +1088,7 @@ var_redir_str(value, value_len)
/*
* Stop redirecting command output to a variable.
* Frees the allocated memory.
*/
void
var_redir_stop()
@@ -1093,14 +1097,18 @@ var_redir_stop()
if (redir_lval != NULL)
{
/* Append the trailing NUL. */
ga_append(&redir_ga, NUL);
/* If there was no error: assign the text to the variable. */
if (redir_endp != NULL)
{
ga_append(&redir_ga, NUL); /* Append the trailing NUL. */
tv.v_type = VAR_STRING;
tv.vval.v_string = redir_ga.ga_data;
set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
}
/* Assign the text to the variable. */
tv.v_type = VAR_STRING;
tv.vval.v_string = redir_ga.ga_data;
set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
vim_free(tv.vval.v_string);
/* free the collected output */
vim_free(redir_ga.ga_data);
redir_ga.ga_data = NULL;
clear_lval(redir_lval);
vim_free(redir_lval);
@@ -18100,6 +18108,31 @@ get_vim_var_list(idx)
return vimvars[idx].vv_list;
}
/*
* Set v:char to character "c".
*/
void
set_vim_var_char(c)
int c;
{
#ifdef FEAT_MBYTE
char_u buf[MB_MAXBYTES];
#else
char_u buf[2];
#endif
#ifdef FEAT_MBYTE
if (has_mbyte)
buf[(*mb_char2bytes)(c, buf)] = NUL;
else
#endif
{
buf[0] = c;
buf[1] = NUL;
}
set_vim_var_string(VV_CHAR, buf, -1);
}
/*
* Set v:count to "count" and v:count1 to "count1".
* When "set_prevcount" is TRUE first set v:prevcount from v:count.

View File

@@ -2695,7 +2695,7 @@ doend:
{
/* messages could be enabled for a serious error, need to check if the
* counters don't become negative */
if (!did_emsg)
if (!did_emsg || msg_silent > save_msg_silent)
msg_silent = save_msg_silent;
emsg_silent -= did_esilent;
if (emsg_silent < 0)
@@ -8358,6 +8358,7 @@ ex_at(eap)
exarg_T *eap;
{
int c;
int prev_len = typebuf.tb_len;
curwin->w_cursor.lnum = eap->line2;
@@ -8383,11 +8384,10 @@ ex_at(eap)
/*
* Execute from the typeahead buffer.
* Originally this didn't check for the typeahead buffer to be empty,
* thus could read more Ex commands from stdin. It's not clear why,
* it is certainly unexpected.
* Continue until the stuff buffer is empty and all added characters
* have been consumed.
*/
while ((!stuff_empty() || typebuf.tb_len > 0) && vpeekc() == ':')
while (!stuff_empty() || typebuf.tb_len > prev_len)
(void)do_cmdline(NULL, getexline, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE);
exec_from_reg = save_efr;

View File

@@ -3266,7 +3266,6 @@ nextwild(xp, type, options)
int i, j;
char_u *p1;
char_u *p2;
int oldlen;
int difflen;
int v;
@@ -3291,7 +3290,7 @@ nextwild(xp, type, options)
out_flush();
i = (int)(xp->xp_pattern - ccline.cmdbuff);
oldlen = ccline.cmdpos - i;
xp->xp_pattern_len = ccline.cmdpos - i;
if (type == WILD_NEXT || type == WILD_PREV)
{
@@ -3305,18 +3304,20 @@ nextwild(xp, type, options)
/*
* Translate string into pattern and expand it.
*/
if ((p1 = addstar(&ccline.cmdbuff[i], oldlen, xp->xp_context)) == NULL)
if ((p1 = addstar(xp->xp_pattern, xp->xp_pattern_len,
xp->xp_context)) == NULL)
p2 = NULL;
else
{
p2 = ExpandOne(xp, p1, vim_strnsave(&ccline.cmdbuff[i], oldlen),
p2 = ExpandOne(xp, p1,
vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
|options, type);
vim_free(p1);
/* longest match: make sure it is not shorter (happens with :help */
if (p2 != NULL && type == WILD_LONGEST)
{
for (j = 0; j < oldlen; ++j)
for (j = 0; j < xp->xp_pattern_len; ++j)
if (ccline.cmdbuff[i + j] == '*'
|| ccline.cmdbuff[i + j] == '?')
break;
@@ -3331,7 +3332,7 @@ nextwild(xp, type, options)
if (p2 != NULL && !got_int)
{
difflen = (int)STRLEN(p2) - oldlen;
difflen = (int)STRLEN(p2) - xp->xp_pattern_len;
if (ccline.cmdlen + difflen > ccline.cmdbufflen - 4)
{
v = realloc_cmdbuff(ccline.cmdlen + difflen);
@@ -3620,6 +3621,7 @@ ExpandInit(xp)
expand_T *xp;
{
xp->xp_pattern = NULL;
xp->xp_pattern_len = 0;
xp->xp_backslash = XP_BS_NONE;
#ifndef BACKSLASH_IN_FILENAME
xp->xp_shell = FALSE;
@@ -4311,8 +4313,8 @@ expand_cmdline(xp, str, col, matchcount, matches)
}
/* add star to file name, or convert to regexp if not exp. files. */
file_str = addstar(xp->xp_pattern,
(int)(str + col - xp->xp_pattern), xp->xp_context);
xp->xp_pattern_len = (int)(str + col - xp->xp_pattern);
file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
if (file_str == NULL)
return EXPAND_UNSUCCESSFUL;
@@ -4781,7 +4783,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file)
sprintf((char *)num, "%d", ccline.cmdpos);
args[1] = ccline.cmdbuff;
}
args[0] = xp->xp_pattern;
args[0] = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len);
args[2] = num;
/* Save the cmdline, we don't know what the function may do. */
@@ -4797,6 +4799,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file)
if (ccline.cmdbuff != NULL)
ccline.cmdbuff[ccline.cmdlen] = keep;
vim_free(args[0]);
return ret;
}

View File

@@ -844,10 +844,14 @@
/* #define DEBUG */
/*
* STARTUPTIME Time the startup process. Writes a "vimstartup" file
* with timestamps.
* STARTUPTIME Time the startup process. Writes a file with
* timestamps.
*/
/* #define STARTUPTIME "vimstartup" */
#if defined(FEAT_NORMAL) \
&& ((defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)) \
|| defined(WIN3264))
# define STARTUPTIME 1
#endif
/*
* MEM_PROFILE Debugging of memory allocation and freeing.

View File

@@ -9498,15 +9498,10 @@ au_exists(arg)
ap = first_autopat[(int)event];
if (ap == NULL)
goto theend;
if (pattern == NULL)
{
retval = TRUE;
goto theend;
}
/* if pattern is "<buffer>", special handling is needed which uses curbuf */
/* for pattern "<buffer=N>, fnamecmp() will work fine */
if (STRICMP(pattern, "<buffer>") == 0)
if (pattern != NULL && STRICMP(pattern, "<buffer>") == 0)
buflocal_buf = curbuf;
/* Check if there is an autocommand with the given pattern. */
@@ -9515,9 +9510,10 @@ au_exists(arg)
/* For buffer-local autocommands, fnamecmp() works fine. */
if (ap->pat != NULL && ap->cmds != NULL
&& (group == AUGROUP_ALL || ap->group == group)
&& (buflocal_buf == NULL
? fnamecmp(ap->pat, pattern) == 0
: ap->buflocal_nr == buflocal_buf->b_fnum))
&& (pattern == NULL
|| (buflocal_buf == NULL
? fnamecmp(ap->pat, pattern) == 0
: ap->buflocal_nr == buflocal_buf->b_fnum)))
{
retval = TRUE;
break;

View File

@@ -1607,11 +1607,11 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
}
else
{
/* 2, 3, or 5: need to correct nested folds too */
foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top,
line2 - fp->fd_top, amount, amount_after);
if (fp->fd_top < top)
{
/* 2 or 3: need to correct nested folds too */
foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top,
line2 - fp->fd_top, amount, amount_after);
if (last <= line2)
{
/* 2. fold contains line1, line2 is below fold */
@@ -1628,7 +1628,11 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
}
else
{
/* 5. fold is below line1 and contains line2 */
/* 5. fold is below line1 and contains line2; need to
* correct nested folds too */
foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top,
line2 - fp->fd_top, amount,
amount_after + (fp->fd_top - top));
if (amount == MAXLNUM)
{
fp->fd_len -= line2 - fp->fd_top + 1;
@@ -2252,6 +2256,40 @@ foldUpdateIEMS(wp, top, bot)
}
}
/*
* If folding is defined by the syntax, it is possible that a change in
* one line will cause all sub-folds of the current fold to change (e.g.,
* closing a C-style comment can cause folds in the subsequent lines to
* appear). To take that into account we should adjust the value of "bot"
* to point to the end of the current fold:
*/
if (foldlevelSyntax == getlevel)
{
garray_T *gap = &wp->w_folds;
fold_T *fp = NULL;
int current_fdl = 0;
linenr_T fold_start_lnum = 0;
linenr_T lnum_rel = fline.lnum;
while (current_fdl < fline.lvl)
{
if (!foldFind(gap, lnum_rel, &fp))
break;
++current_fdl;
fold_start_lnum += fp->fd_top;
gap = &fp->fd_nested;
lnum_rel -= fp->fd_top;
}
if (fp != NULL && current_fdl == fline.lvl)
{
linenr_T fold_end_lnum = fold_start_lnum + fp->fd_len;
if (fold_end_lnum > bot)
bot = fold_end_lnum;
}
}
start = fline.lnum;
end = bot;
/* Do at least one line. */

View File

@@ -129,7 +129,7 @@ static void map_free __ARGS((mapblock_T **));
static void validate_maphash __ARGS((void));
static void showmap __ARGS((mapblock_T *mp, int local));
#ifdef FEAT_EVAL
static char_u *eval_map_expr __ARGS((char_u *str));
static char_u *eval_map_expr __ARGS((char_u *str, int c));
#endif
/*
@@ -2446,7 +2446,7 @@ vgetorpeek(advance)
if (tabuf.typebuf_valid)
{
vgetc_busy = 0;
s = eval_map_expr(mp->m_str);
s = eval_map_expr(mp->m_str, NUL);
vgetc_busy = save_vgetc_busy;
}
else
@@ -4367,9 +4367,9 @@ check_abbr(c, ptr, col, mincol)
* abbreviation, but is not inserted into the input stream.
*/
j = 0;
/* special key code, split up */
if (c != Ctrl_RSB)
{
/* special key code, split up */
if (IS_SPECIAL(c) || c == K_SPECIAL)
{
tb[j++] = K_SPECIAL;
@@ -4398,7 +4398,7 @@ check_abbr(c, ptr, col, mincol)
}
#ifdef FEAT_EVAL
if (mp->m_expr)
s = eval_map_expr(mp->m_str);
s = eval_map_expr(mp->m_str, c);
else
#endif
s = mp->m_str;
@@ -4434,8 +4434,9 @@ check_abbr(c, ptr, col, mincol)
* special characters.
*/
static char_u *
eval_map_expr(str)
eval_map_expr(str, c)
char_u *str;
int c; /* NUL or typed character for abbreviation */
{
char_u *res;
char_u *p;
@@ -4452,6 +4453,7 @@ eval_map_expr(str)
#ifdef FEAT_EX_EXTRA
++ex_normal_lock;
#endif
set_vim_var_char(c); /* set v:char to the typed character */
save_cursor = curwin->w_cursor;
p = eval_to_string(str, NULL, FALSE);
--textlock;

View File

@@ -1567,6 +1567,10 @@ EXTERN int xsmp_icefd INIT(= -1); /* The actual connection */
/* For undo we need to know the lowest time possible. */
EXTERN time_t starttime;
#ifdef STARTUPTIME
EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */
#endif
/*
* Some compilers warn for not using a return value, but in some situations we
* can't do anything useful with the value. Assign to this variable to avoid

View File

@@ -1386,6 +1386,10 @@ gui_set_shellsize(mustset, fit_to_display, direction)
int min_height;
int screen_w;
int screen_h;
#ifdef HAVE_GTK2
int un_maximize = mustset;
int did_adjust = 0;
#endif
if (!gui.shell_created)
return;
@@ -1425,22 +1429,47 @@ gui_set_shellsize(mustset, fit_to_display, direction)
if (Columns < MIN_COLUMNS)
Columns = MIN_COLUMNS;
width = Columns * gui.char_width + base_width;
#ifdef HAVE_GTK2
++did_adjust;
#endif
}
if ((direction & RESIZE_VERT) && height > screen_h)
{
Rows = (screen_h - base_height) / gui.char_height;
check_shellsize();
height = Rows * gui.char_height + base_height;
#ifdef HAVE_GTK2
++did_adjust;
#endif
}
#ifdef HAVE_GTK2
if (did_adjust == 2 || (width + gui.char_width >= screen_w
&& height + gui.char_height >= screen_h))
/* don't unmaximize if at maximum size */
un_maximize = FALSE;
#endif
}
gui.num_cols = Columns;
gui.num_rows = Rows;
min_width = base_width + MIN_COLUMNS * gui.char_width;
min_height = base_height + MIN_LINES * gui.char_height;
# ifdef FEAT_WINDOWS
#ifdef FEAT_WINDOWS
min_height += tabline_height() * gui.char_height;
# endif
#endif
#ifdef HAVE_GTK2
if (un_maximize)
{
/* If the window size is smaller than the screen unmaximize the
* window, otherwise resizing won't work. */
gui_mch_get_screen_dimensions(&screen_w, &screen_h);
if ((width + gui.char_width < screen_w
|| height + gui.char_height * 2 < screen_h)
&& gui_mch_maximized())
gui_mch_unmaximize();
}
#endif
gui_mch_set_shellsize(width, height, min_width, min_height,
base_width, base_height, direction);

View File

@@ -860,11 +860,9 @@ gtk_form_main_filter(GdkXEvent *gdk_xevent,
gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static)
{
#ifdef HAVE_GTK2
gboolean static_gravity_supported;
static_gravity_supported = gdk_window_set_static_gravities(window,
use_static);
g_return_if_fail(static_gravity_supported);
/* We don't check if static gravity is actually supported, because it
* results in an annoying assertion error message. */
gdk_window_set_static_gravities(window, use_static);
#else
XSetWindowAttributes xattributes;

View File

@@ -4066,6 +4066,8 @@ gui_mch_open(void)
{
guicolor_T fg_pixel = INVALCOLOR;
guicolor_T bg_pixel = INVALCOLOR;
guint pixel_width;
guint pixel_height;
#ifdef HAVE_GTK2
/*
@@ -4106,8 +4108,6 @@ gui_mch_open(void)
unsigned int w, h;
int x = 0;
int y = 0;
guint pixel_width;
guint pixel_height;
mask = XParseGeometry((char *)gui.geom, &x, &y, &w, &h);
@@ -4160,9 +4160,16 @@ gui_mch_open(void)
}
}
gtk_form_set_size(GTK_FORM(gui.formwin),
(guint)(gui_get_base_width() + Columns * gui.char_width),
(guint)(gui_get_base_height() + Rows * gui.char_height));
pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width);
pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height);
#ifdef HAVE_GTK2
/* For GTK2 changing the size of the form widget doesn't cause window
* resizing. */
if (gtk_socket_id == 0)
gtk_window_resize(GTK_WINDOW(gui.mainwin), pixel_width, pixel_height);
#else
gtk_form_set_size(GTK_FORM(gui.formwin), pixel_width, pixel_height);
#endif
update_window_manager_hints(0, 0);
if (foreground_argument != NULL)
@@ -4369,6 +4376,29 @@ force_shell_resize_idle(gpointer data)
#endif
#endif /* HAVE_GTK2 */
#if defined(HAVE_GTK2) || defined(PROTO)
/*
* Return TRUE if the main window is maximized.
*/
int
gui_mch_maximized()
{
return (gui.mainwin != NULL && gui.mainwin->window != NULL
&& (gdk_window_get_state(gui.mainwin->window)
& GDK_WINDOW_STATE_MAXIMIZED));
}
/*
* Unmaximize the main window
*/
void
gui_mch_unmaximize()
{
if (gui.mainwin != NULL)
gtk_window_unmaximize(GTK_WINDOW(gui.mainwin));
}
#endif
/*
* Set the windows size.
*/

View File

@@ -10,7 +10,7 @@
/*
* (C) 2001,2005 by Marcin Dalecki <martin@dalecki.de>
*
* Implementation of dialogue functions for the Motif GUI variant.
* Implementation of dialog functions for the Motif GUI variant.
*
* Note about Lesstif: Apparently lesstif doesn't get the widget layout right,
* when using a dynamic scrollbar policy.
@@ -633,16 +633,19 @@ do_choice(Widget w,
data->sel[which] = XtNewString(sel);
else
{
XtFree(data->sel[which]);
if (!strcmp(data->sel[which], sel))
{
/* unselecting current selection */
XtFree(data->sel[which]);
data->sel[which] = NULL;
if (w)
XmListDeselectItem(w, call_data->item);
}
else
{
XtFree(data->sel[which]);
data->sel[which] = XtNewString(sel);
}
}
XtFree(sel);

View File

@@ -2058,6 +2058,7 @@ WindowSetattr(PyObject *self, char *name, PyObject *val)
{
long lnum;
long col;
long len;
if (!PyArg_Parse(val, "(ll)", &lnum, &col))
return -1;
@@ -2072,10 +2073,16 @@ WindowSetattr(PyObject *self, char *name, PyObject *val)
if (VimErrorCheck())
return -1;
/* NO CHECK ON COLUMN - SEEMS NOT TO MATTER */
/* When column is out of range silently correct it. */
len = STRLEN(ml_get_buf(this->win->w_buffer, lnum, FALSE));
if (col > len)
col = len;
this->win->w_cursor.lnum = lnum;
this->win->w_cursor.col = col;
#ifdef FEAT_VIRTUALEDIT
this->win->w_cursor.coladd = 0;
#endif
update_screen(VALID);
return 0;

View File

@@ -243,7 +243,7 @@
#endif
#ifdef STARTUPTIME
# define TIME_MSG(s) time_msg(s, NULL)
# define TIME_MSG(s) { if (time_fd != NULL) time_msg(s, NULL); }
#else
# define TIME_MSG(s)
#endif

View File

@@ -130,10 +130,6 @@ static char_u *serverMakeName __ARGS((char_u *arg, char *cmd));
#endif
#ifdef STARTUPTIME
static FILE *time_fd = NULL;
#endif
/*
* Different types of error messages.
*/
@@ -173,6 +169,9 @@ main
char_u *fname = NULL; /* file name from command line */
mparm_T params; /* various parameters passed between
* main() and other functions. */
#ifdef STARTUPTIME
int i;
#endif
/*
* Do any system-specific initialisations. These can NOT use IObuff or
@@ -203,8 +202,15 @@ main
#endif
#ifdef STARTUPTIME
time_fd = mch_fopen(STARTUPTIME, "a");
TIME_MSG("--- VIM STARTING ---");
for (i = 1; i < argc; ++i)
{
if (STRNICMP(argv[i], "--startuptime=", 14) == 0)
{
time_fd = mch_fopen(argv[i] + 14, "a");
TIME_MSG("--- VIM STARTING ---");
break;
}
}
#endif
starttime = time(NULL);
@@ -1150,6 +1156,18 @@ main_loop(cmdwin, noexmode)
cursor_on();
do_redraw = FALSE;
#ifdef STARTUPTIME
/* Now that we have drawn the first screen all the startup stuff
* has been done, close any file for startup messages. */
if (time_fd != NULL)
{
TIME_MSG("first screen update");
TIME_MSG("--- VIM STARTED ---");
fclose(time_fd);
time_fd = NULL;
}
#endif
}
#ifdef FEAT_GUI
if (need_mouse_correct)
@@ -1743,6 +1761,10 @@ command_line_scan(parmp)
/* already processed, skip */
}
#endif
else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0)
{
/* already processed, skip */
}
else
{
if (argv[0][argv_idx])
@@ -3211,6 +3233,20 @@ static void time_diff __ARGS((struct timeval *then, struct timeval *now));
static struct timeval prev_timeval;
# ifdef WIN3264
/*
* Windows doesn't have gettimeofday(), although it does have struct timeval.
*/
static int
gettimeofday(struct timeval *tv, char *dummy)
{
long t = clock();
tv->tv_sec = t / CLOCKS_PER_SEC;
tv->tv_usec = (t - tv->tv_sec * CLOCKS_PER_SEC) * 1000000 / CLOCKS_PER_SEC;
return 0;
}
# endif
/*
* Save the previous time before doing something that could nest.
* set "*tv_rel" to the time elapsed so far.
@@ -3299,20 +3335,6 @@ time_msg(msg, tv_start)
}
}
# ifdef WIN3264
/*
* Windows doesn't have gettimeofday(), although it does have struct timeval.
*/
int
gettimeofday(struct timeval *tv, char *dummy)
{
long t = clock();
tv->tv_sec = t / CLOCKS_PER_SEC;
tv->tv_usec = (t - tv->tv_sec * CLOCKS_PER_SEC) * 1000000 / CLOCKS_PER_SEC;
return 0;
}
# endif
#endif
#if defined(FEAT_CLIENTSERVER) || defined(PROTO)

View File

@@ -864,21 +864,24 @@ ml_recover()
recoverymode = TRUE;
called_from_main = (curbuf->b_ml.ml_mfp == NULL);
attr = hl_attr(HLF_E);
/*
* If the file name ends in ".sw?" we use it directly.
* Otherwise a search is done to find the swap file(s).
*/
/*
* If the file name ends in ".s[uvw][a-z]" we assume this is the swap file.
* Otherwise a search is done to find the swap file(s).
*/
fname = curbuf->b_fname;
if (fname == NULL) /* When there is no file name */
fname = (char_u *)"";
len = (int)STRLEN(fname);
if (len >= 4 &&
#if defined(VMS) || defined(RISCOS)
STRNICMP(fname + len - 4, "_sw" , 3)
STRNICMP(fname + len - 4, "_s" , 2)
#else
STRNICMP(fname + len - 4, ".sw" , 3)
STRNICMP(fname + len - 4, ".s" , 2)
#endif
== 0)
== 0
&& vim_strchr((char_u *)"UVWuvw", fname[len - 2]) != NULL
&& ASCII_ISALPHA(fname[len - 1]))
{
directly = TRUE;
fname = vim_strsave(fname); /* make a copy for mf_open() */
@@ -1282,7 +1285,7 @@ ml_recover()
for (i = 0; i < dp->db_line_count; ++i)
{
txt_start = (dp->db_index[i] & DB_INDEX_MASK);
if (txt_start <= HEADER_SIZE
if (txt_start <= (int)HEADER_SIZE
|| txt_start >= (int)dp->db_txt_end)
{
p = (char_u *)"???";
@@ -1293,7 +1296,8 @@ ml_recover()
ml_append(lnum++, p, (colnr_T)0, TRUE);
}
if (has_error)
ml_append(lnum++, (char_u *)_("???END"), (colnr_T)0, TRUE);
ml_append(lnum++, (char_u *)_("???END"),
(colnr_T)0, TRUE);
}
}
}
@@ -3573,11 +3577,10 @@ resolve_symlink(fname, buf)
* Make swap file name out of the file name and a directory name.
* Returns pointer to allocated memory or NULL.
*/
/*ARGSUSED*/
char_u *
makeswapname(fname, ffname, buf, dir_name)
char_u *fname;
char_u *ffname;
char_u *ffname UNUSED;
buf_T *buf;
char_u *dir_name;
{

View File

@@ -183,9 +183,6 @@ update_topline()
if (curwin->w_topline != 1)
redraw_later(NOT_VALID);
curwin->w_topline = 1;
#ifdef FEAT_DIFF
curwin->w_topfill = 0;
#endif
curwin->w_botline = 2;
curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP;
#ifdef FEAT_SCROLLBIND
@@ -1257,7 +1254,8 @@ scrolldown(line_count, byfold)
while (line_count-- > 0)
{
#ifdef FEAT_DIFF
if (curwin->w_topfill < diff_check(curwin, curwin->w_topline))
if (curwin->w_topfill < diff_check(curwin, curwin->w_topline)
&& curwin->w_topfill < curwin->w_height - 1)
{
++curwin->w_topfill;
++done;

View File

@@ -4473,11 +4473,6 @@ fex_format(lnum, count, c)
int use_sandbox = was_set_insecurely((char_u *)"formatexpr",
OPT_LOCAL);
int r;
#ifdef FEAT_MBYTE
char_u buf[MB_MAXBYTES];
#else
char_u buf[2];
#endif
/*
* Set v:lnum to the first line number and v:count to the number of lines.
@@ -4485,17 +4480,7 @@ fex_format(lnum, count, c)
*/
set_vim_var_nr(VV_LNUM, lnum);
set_vim_var_nr(VV_COUNT, count);
#ifdef FEAT_MBYTE
if (has_mbyte)
buf[(*mb_char2bytes)(c, buf)] = NUL;
else
#endif
{
buf[0] = c;
buf[1] = NUL;
}
set_vim_var_string(VV_CHAR, buf, -1);
set_vim_var_char(c);
/*
* Evaluate the function.

View File

@@ -61,6 +61,7 @@ void set_vim_var_nr __ARGS((int idx, long val));
long get_vim_var_nr __ARGS((int idx));
char_u *get_vim_var_str __ARGS((int idx));
list_T *get_vim_var_list __ARGS((int idx));
void set_vim_var_char __ARGS((int c));
void set_vcount __ARGS((long count, long count1, int set_prevcount));
void set_vim_var_string __ARGS((int idx, char_u *val, int len));
void set_vim_var_list __ARGS((int idx, list_T *val));

View File

@@ -16,6 +16,8 @@ int gui_mch_open __ARGS((void));
void gui_mch_exit __ARGS((int rc));
int gui_mch_get_winpos __ARGS((int *x, int *y));
void gui_mch_set_winpos __ARGS((int x, int y));
int gui_mch_maximized __ARGS((void));
void gui_mch_unmaximize __ARGS((void));
void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction));
void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h));
void gui_mch_settitle __ARGS((char_u *title, char_u *icon));

View File

@@ -432,6 +432,7 @@ typedef struct expand
{
int xp_context; /* type of expansion */
char_u *xp_pattern; /* start of item to expand */
int xp_pattern_len; /* bytes in xp_pattern before cursor */
#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
char_u *xp_arg; /* completion function */
int xp_scriptID; /* SID for completion function */

View File

@@ -26,7 +26,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test48.out test51.out test53.out test54.out test55.out \
test56.out test57.out test58.out test59.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out
test66.out test67.out
.SUFFIXES: .in .out
@@ -112,3 +112,4 @@ test63.out: test63.in
test64.out: test64.in
test65.out: test65.in
test66.out: test66.in
test67.out: test67.in

View File

@@ -26,7 +26,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 test65.out test66.out
test42.out test52.out test65.out test66.out test67.out
SCRIPTS32 = test50.out

View File

@@ -45,7 +45,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 test65.out test66.out
test42.out test52.out test65.out test66.out test67.out
SCRIPTS32 = test50.out

View File

@@ -26,7 +26,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test48.out test51.out test53.out test54.out test55.out \
test56.out test57.out test58.out test59.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out
test66.out test67.out
.SUFFIXES: .in .out

View File

@@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
# Last change: 2009 Mar 05
# Last change: 2009 Sep 11
#
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select.
@@ -69,7 +69,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test48.out test51.out test53.out test54.out test55.out \
test56.out test57.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out
test66.out test67.out
.IFDEF WANT_GUI
SCRIPT_GUI = test16.out

View File

@@ -22,7 +22,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test48.out test49.out test51.out test52.out test53.out \
test54.out test55.out test56.out test57.out test58.out \
test59.out test60.out test61.out test62.out test63.out \
test64.out test65.out test66.out
test64.out test65.out test66.out test67.out
SCRIPTS_GUI = test16.out

View File

@@ -28,9 +28,14 @@ i jI :call append("$", "indent " . foldlevel("."))
k:call append("$", foldlevel("."))
:" test syntax folding
:set fdm=syntax fdl=0
:syn region Hup start="dd" end="hh" fold
:syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3
:syn region Fd1 start="ee" end="ff" fold contained
:syn region Fd2 start="gg" end="hh" fold contained
:syn region Fd3 start="commentstart" end="commentend" fold contained
Gzk:call append("$", "folding " . getline("."))
k:call append("$", getline("."))
jAcommentstart Acommentend:set fdl=1
3j:call append("$", getline("."))
:" test expression folding
:fun Flvl()
let l = getline(v:lnum)

View File

@@ -8,8 +8,9 @@ marker 2
0
indent 2
1
folding 8 hh
folding 9 ii
3 cc
7 gg
expr 2
1
2

33
src/testdir/test67.in Normal file
View File

@@ -0,0 +1,33 @@
Test that groups and patterns are tested correctly when calling exists() for
autocommands.
STARTTEST
:so small.vim
:let results=[]
:augroup auexists
:augroup END
:call add(results, "##BufEnter: " . exists("##BufEnter"))
:call add(results, "#BufEnter: " . exists("#BufEnter"))
:au BufEnter * let g:entered=1
:call add(results, "#BufEnter: " . exists("#BufEnter"))
:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))
:augroup auexists
:au BufEnter * let g:entered=1
:augroup END
:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))
:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))
:au BufEnter *.test let g:entered=1
:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))
:edit testfile.test
:call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))
:au BufEnter <buffer> let g:entered=1
:call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))
:edit testfile2.test
:call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))
:e test.out
:call append(0, results)
:$d
:w
:qa!
ENDTEST

10
src/testdir/test67.ok Normal file
View File

@@ -0,0 +1,10 @@
##BufEnter: 1
#BufEnter: 0
#BufEnter: 1
#auexists#BufEnter: 0
#auexists#BufEnter: 1
#BufEnter#*.test: 0
#BufEnter#*.test: 1
#BufEnter#<buffer>: 0
#BufEnter#<buffer>: 1
#BufEnter#<buffer>: 0

View File

@@ -3055,18 +3055,17 @@ vcol2col(wp, lnum, vcol)
int vcol;
{
/* try to advance to the specified column */
int col = 0;
int count = 0;
char_u *ptr;
char_u *start;
ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
start = ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
while (count <= vcol && *ptr != NUL)
{
++col;
count += win_lbr_chartabsize(wp, ptr, count, NULL);
mb_ptr_adv(ptr);
}
return col;
return (int)(ptr - start);
}
#endif

View File

@@ -676,6 +676,48 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
277,
/**/
276,
/**/
275,
/**/
274,
/**/
273,
/**/
272,
/**/
271,
/**/
270,
/**/
269,
/**/
268,
/**/
267,
/**/
266,
/**/
265,
/**/
264,
/**/
263,
/**/
262,
/**/
261,
/**/
260,
/**/
259,
/**/
258,
/**/
257,
/**/
256,
/**/