Compare commits

...

20 Commits

Author SHA1 Message Date
Bram Moolenaar
76675565ac updated for version 7.2-285 2009-11-11 12:22:32 +00:00
Bram Moolenaar
3234cc6a31 updated for version 7.2-284 2009-11-03 17:47:12 +00:00
Bram Moolenaar
e161c791f6 updated for version 7.2-283 2009-11-03 17:13:59 +00:00
Bram Moolenaar
eda6eb9f00 updated for version 7.2-282 2009-11-03 17:04:43 +00:00
Bram Moolenaar
bb6a705451 updated for version 7.2-281 2009-11-03 16:36:44 +00:00
Bram Moolenaar
362f3569ae updated for version 7.2-280 2009-11-03 16:20:34 +00:00
Bram Moolenaar
a1381de5f3 updated for version 7.2-279 2009-11-03 15:44:21 +00:00
Bram Moolenaar
5b88ba47e8 updated for version 7.2-278 2009-11-03 15:30:12 +00:00
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
25 changed files with 338 additions and 113 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

@@ -8519,7 +8519,7 @@ ins_bs(c, mode, inserted_space_p)
{
save_col = curwin->w_cursor.col;
beginline(BL_WHITE);
if (curwin->w_cursor.col < (colnr_T)temp)
if (curwin->w_cursor.col < save_col)
mincol = curwin->w_cursor.col;
curwin->w_cursor.col = save_col;
}

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

@@ -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

@@ -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

@@ -1932,7 +1932,7 @@ get_foldtext(wp, lnum, lnume, foldinfo, buf)
#ifdef FEAT_EVAL
if (*wp->w_p_fdt != NUL)
{
char_u dashes[51];
char_u dashes[MAX_LEVEL + 2];
win_T *save_curwin;
int level;
char_u *p;
@@ -1944,8 +1944,8 @@ get_foldtext(wp, lnum, lnume, foldinfo, buf)
/* Set "v:folddashes" to a string of "level" dashes. */
/* Set "v:foldlevel" to "level". */
level = foldinfo->fi_level;
if (level > 50)
level = 50;
if (level > (int)sizeof(dashes) - 1)
level = (int)sizeof(dashes) - 1;
vim_memset(dashes, '-', (size_t)level);
dashes[level] = NUL;
set_vim_var_string(VV_FOLDDASHES, dashes, -1);
@@ -2256,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. */
@@ -2817,6 +2851,8 @@ foldSplit(gap, i, top, bot)
fp[1].fd_top = bot + 1;
fp[1].fd_len = fp->fd_len - (fp[1].fd_top - fp->fd_top);
fp[1].fd_flags = fp->fd_flags;
fp[1].fd_small = MAYBE;
fp->fd_small = MAYBE;
/* Move nested folds below bot to new fold. There can't be
* any between top and bot, they have been removed by the caller. */

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

@@ -5267,8 +5267,24 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
# endif
#endif /* !HAVE_GTK2 */
/* Preserve the logical dimensions of the screen. */
update_window_manager_hints(0, 0);
#ifdef HAVE_GTK2
if (gui_mch_maximized())
{
int w, h;
/* Update lines and columns in accordance with the new font, keep the
* window maximized. */
gtk_window_get_size(GTK_WINDOW(gui.mainwin), &w, &h);
w -= get_menu_tool_width();
h -= get_menu_tool_height();
gui_resize_shell(w, h);
}
else
#endif
{
/* Preserve the logical dimensions of the screen. */
update_window_manager_hints(0, 0);
}
return OK;
}

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

@@ -2886,6 +2886,13 @@ changed_common(lnum, col, lnume, xtra)
}
#endif
}
#ifdef FEAT_FOLDING
/* Take care of side effects for setting w_topline when folds have
* changed. Esp. when the buffer was changed in another window. */
if (hasAnyFolding(wp))
set_topline(wp, wp->w_topline);
#endif
}
}

View File

@@ -156,7 +156,7 @@ coladvance2(pos, addspaces, finetune, wcol)
|| ((ve_flags & VE_ONEMORE) && wcol < MAXCOL)
#endif
;
line = ml_get_curline();
line = ml_get_buf(curbuf, pos->lnum, FALSE);
if (wcol >= MAXCOL)
{
@@ -332,9 +332,9 @@ coladvance2(pos, addspaces, finetune, wcol)
#endif
#ifdef FEAT_MBYTE
/* prevent cursor from moving on the trail byte */
/* prevent from moving onto a trail byte */
if (has_mbyte)
mb_adjust_cursor();
mb_adjustpos(pos);
#endif
if (col < wcol)

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

@@ -2020,6 +2020,7 @@ op_replace(oap, c)
bd.is_MAX = (curwin->w_curswant == MAXCOL);
for ( ; curwin->w_cursor.lnum <= oap->end.lnum; ++curwin->w_cursor.lnum)
{
curwin->w_cursor.col = 0; /* make sure cursor position is valid */
block_prep(oap, &bd, curwin->w_cursor.lnum, TRUE);
if (bd.textlen == 0 && (!virtual_op || bd.is_MAX))
continue; /* nothing to replace */
@@ -2035,6 +2036,7 @@ op_replace(oap, c)
{
pos_T vpos;
vpos.lnum = curwin->w_cursor.lnum;
getvpos(&vpos, oap->start_vcol);
bd.startspaces += vpos.coladd;
n = bd.startspaces;
@@ -2693,11 +2695,8 @@ op_change(oap)
* initial coladd offset as part of "startspaces" */
if (bd.is_short)
{
linenr_T lnum = curwin->w_cursor.lnum;
curwin->w_cursor.lnum = linenr;
vpos.lnum = linenr;
(void)getvpos(&vpos, oap->start_vcol);
curwin->w_cursor.lnum = lnum;
}
else
vpos.coladd = 0;
@@ -4473,11 +4472,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 +4479,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

@@ -132,7 +132,7 @@ static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width
static void draw_vsep_win __ARGS((win_T *wp, int row));
#endif
#ifdef FEAT_STL_OPT
static void redraw_custum_statusline __ARGS((win_T *wp));
static void redraw_custom_statusline __ARGS((win_T *wp));
#endif
#ifdef FEAT_SEARCH_EXTRA
#define SEARCH_HL_PRIORITY 0
@@ -3008,11 +3008,33 @@ win_line(wp, lnum, startrow, endrow, nochange)
mb_ptr_adv(ptr);
}
#ifdef FEAT_VIRTUALEDIT
/* When 'virtualedit' is set the end of the line may be before the
* start of the displayed part. */
if (vcol < v && *ptr == NUL && virtual_active())
#if defined(FEAT_SYN_HL) || defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL)
/* When:
* - 'cuc' is set, or
* - 'virtualedit' is set, or
* - the visual mode is active,
* the end of the line may be before the start of the displayed part.
*/
if (vcol < v && (
# ifdef FEAT_SYN_HL
wp->w_p_cuc
# if defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL)
||
# endif
# endif
# ifdef FEAT_VIRTUALEDIT
virtual_active()
# ifdef FEAT_VISUAL
||
# endif
# endif
# ifdef FEAT_VISUAL
(VIsual_active && wp->w_buffer == curwin->w_buffer)
# endif
))
{
vcol = v;
}
#endif
/* Handle a character that's not completely on the screen: Put ptr at
@@ -5772,7 +5794,7 @@ win_redr_status(wp)
else if (*p_stl != NUL || *wp->w_p_stl != NUL)
{
/* redraw custom status line */
redraw_custum_statusline(wp);
redraw_custom_statusline(wp);
}
#endif
else
@@ -5897,18 +5919,31 @@ win_redr_status(wp)
* errors encountered.
*/
static void
redraw_custum_statusline(wp)
redraw_custom_statusline(wp)
win_T *wp;
{
int save_called_emsg = called_emsg;
static int entered = FALSE;
int save_called_emsg = called_emsg;
/* When called recursively return. This can happen when the statusline
* contains an expression that triggers a redraw. */
if (entered)
return;
entered = TRUE;
called_emsg = FALSE;
win_redr_custom(wp, FALSE);
if (called_emsg)
{
/* When there is an error disable the statusline, otherwise the
* display is messed up with errors and a redraw triggers the problem
* again and again. */
set_string_option_direct((char_u *)"statusline", -1,
(char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
}
called_emsg |= save_called_emsg;
entered = FALSE;
}
#endif
@@ -6016,6 +6051,7 @@ win_redr_custom(wp, draw_ruler)
int len;
int fillchar;
char_u buf[MAXPATHL];
char_u *stl;
char_u *p;
struct stl_hlrec hltab[STL_MAX_ITEM];
struct stl_hlrec tabtab[STL_MAX_ITEM];
@@ -6025,7 +6061,7 @@ win_redr_custom(wp, draw_ruler)
if (wp == NULL)
{
/* Use 'tabline'. Always at the first line of the screen. */
p = p_tal;
stl = p_tal;
row = 0;
fillchar = ' ';
attr = hl_attr(HLF_TPF);
@@ -6042,17 +6078,17 @@ win_redr_custom(wp, draw_ruler)
if (draw_ruler)
{
p = p_ruf;
stl = p_ruf;
/* advance past any leading group spec - implicit in ru_col */
if (*p == '%')
if (*stl == '%')
{
if (*++p == '-')
p++;
if (atoi((char *) p))
while (VIM_ISDIGIT(*p))
p++;
if (*p++ != '(')
p = p_ruf;
if (*++stl == '-')
stl++;
if (atoi((char *)stl))
while (VIM_ISDIGIT(*stl))
stl++;
if (*stl++ != '(')
stl = p_ruf;
}
#ifdef FEAT_VERTSPLIT
col = ru_col - (Columns - W_WIDTH(wp));
@@ -6081,9 +6117,9 @@ win_redr_custom(wp, draw_ruler)
else
{
if (*wp->w_p_stl != NUL)
p = wp->w_p_stl;
stl = wp->w_p_stl;
else
p = p_stl;
stl = p_stl;
# ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"statusline",
*wp->w_p_stl == NUL ? 0 : OPT_LOCAL);
@@ -6098,10 +6134,14 @@ win_redr_custom(wp, draw_ruler)
if (maxwidth <= 0)
return;
/* Make a copy, because the statusline may include a function call that
* might change the option value and free the memory. */
stl = vim_strsave(stl);
width = build_stl_str_hl(wp == NULL ? curwin : wp,
buf, sizeof(buf),
p, use_sandbox,
stl, use_sandbox,
fillchar, maxwidth, hltab, tabtab);
vim_free(stl);
len = (int)STRLEN(buf);
while (width < maxwidth && len < (int)sizeof(buf) - 1)
@@ -9465,7 +9505,7 @@ showruler(always)
#if defined(FEAT_STL_OPT) && defined(FEAT_WINDOWS)
if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height)
{
redraw_custum_statusline(curwin);
redraw_custom_statusline(curwin);
}
else
#endif

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

View File

@@ -676,6 +676,46 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
285,
/**/
284,
/**/
283,
/**/
282,
/**/
281,
/**/
280,
/**/
279,
/**/
278,
/**/
277,
/**/
276,
/**/
275,
/**/
274,
/**/
273,
/**/
272,
/**/
271,
/**/
270,
/**/
269,
/**/
268,
/**/
267,
/**/
266,
/**/
265,
/**/