Compare commits

...

33 Commits

Author SHA1 Message Date
Bram Moolenaar
34ef52dd56 updated for version 7.2-296 2009-11-17 11:31:25 +00:00
Bram Moolenaar
627b1d3862 updated for version 7.2-295 2009-11-17 11:20:35 +00:00
Bram Moolenaar
eaf0339211 updated for version 7.2-294 2009-11-17 11:08:52 +00:00
Bram Moolenaar
d7d5b47dc7 updated for version 7.2-293 2009-11-11 16:30:08 +00:00
Bram Moolenaar
be1138baba updated for version 7.2-292 2009-11-11 16:22:28 +00:00
Bram Moolenaar
5462018872 updated for version 7.2-291 2009-11-11 16:07:20 +00:00
Bram Moolenaar
21160b9808 updated for version 7.2-290 2009-11-11 15:56:10 +00:00
Bram Moolenaar
f6f95d962f updated for version 7.2-289 2009-11-11 15:23:37 +00:00
Bram Moolenaar
be2c9ae915 updated for version 7.2-288 2009-11-11 14:06:59 +00:00
Bram Moolenaar
954e8c54a0 updated for version 7.2-287 2009-11-11 13:45:33 +00:00
Bram Moolenaar
ef94eec644 updated for version 7.2-286 2009-11-11 13:22:11 +00:00
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
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
34 changed files with 545 additions and 176 deletions

View File

@@ -3802,7 +3802,8 @@ map({expr}, {string}) *map()*
Replace each item in {expr} with the result of evaluating
{string}.
Inside {string} |v:val| has the value of the current item.
For a |Dictionary| |v:key| has the key of the current item.
For a |Dictionary| |v:key| has the key of the current item
and for a |List| |v:key| has the index of the current item.
Example: >
:call map(mylist, '"> " . v:val . " <"')
< This puts "> " before and " <" after each item in "mylist".
@@ -5869,6 +5870,7 @@ showcmd Compiled with 'showcmd' support.
signs Compiled with |:sign| support.
smartindent Compiled with 'smartindent' support.
sniff Compiled with SNiFF interface support.
startuptime Compiled with |--startuptime| support.
statusline Compiled with support for 'statusline', 'rulerformat'
and special formats of 'titlestring' and 'iconstring'.
sun_workshop Compiled with support for Sun |workshop|.

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,14 @@ 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, plugins and opening the first file.
When {fname} already exists new messages are appended.
(Only available when compiled with the |+startuptime|
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 +479,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

@@ -374,6 +374,7 @@ N *+scrollbind* |'scrollbind'|
B *+signs* |:sign|
N *+smartindent* |'smartindent'|
m *+sniff* SniFF interface |sniff|
N *+startuptime* |--startuptime| argument
N *+statusline* Options 'statusline', 'rulerformat' and special
formats of 'titlestring' and 'iconstring'
m *+sun_workshop* |workshop|

3
src/auto/configure vendored
View File

@@ -14017,11 +14017,12 @@ fi
for ac_func in bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
memset nanosleep opendir putenv qsort readlink select setenv \
memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigvec strcasecmp strerror strftime stricmp strncasecmp \
strnicmp strpbrk strtol tgetent towlower towupper iswupper \

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

@@ -157,6 +157,7 @@
#undef HAVE_LSTAT
#undef HAVE_MEMCMP
#undef HAVE_MEMSET
#undef HAVE_MKDTEMP
#undef HAVE_NANOSLEEP
#undef HAVE_OPENDIR
#undef HAVE_FLOAT_FUNCS

View File

@@ -2635,7 +2635,7 @@ fi
dnl Check for functions in one big call, to reduce the size of configure
AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
memset nanosleep opendir putenv qsort readlink select setenv \
memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigvec strcasecmp strerror strftime stricmp strncasecmp \
strnicmp strpbrk strtol tgetent towlower towupper iswupper \

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);
@@ -9920,6 +9928,7 @@ filter_map(argvars, rettv, map)
int todo;
char_u *ermsg = map ? (char_u *)"map()" : (char_u *)"filter()";
int save_did_emsg;
int index = 0;
if (argvars[0].v_type == VAR_LIST)
{
@@ -9953,9 +9962,9 @@ filter_map(argvars, rettv, map)
save_did_emsg = did_emsg;
did_emsg = FALSE;
prepare_vimvar(VV_KEY, &save_key);
if (argvars[0].v_type == VAR_DICT)
{
prepare_vimvar(VV_KEY, &save_key);
vimvars[VV_KEY].vv_type = VAR_STRING;
ht = &d->dv_hashtab;
@@ -9979,24 +9988,27 @@ filter_map(argvars, rettv, map)
}
}
hash_unlock(ht);
restore_vimvar(VV_KEY, &save_key);
}
else
{
vimvars[VV_KEY].vv_type = VAR_NUMBER;
for (li = l->lv_first; li != NULL; li = nli)
{
if (tv_check_lock(li->li_tv.v_lock, ermsg))
break;
nli = li->li_next;
vimvars[VV_KEY].vv_nr = index;
if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL
|| did_emsg)
break;
if (!map && rem)
listitem_remove(l, li);
++index;
}
}
restore_vimvar(VV_KEY, &save_key);
restore_vimvar(VV_VAL, &save_val);
did_emsg |= save_did_emsg;
@@ -11728,6 +11740,9 @@ f_has(argvars, rettv)
#ifdef FEAT_SNIFF
"sniff",
#endif
#ifdef STARTUPTIME
"startuptime",
#endif
#ifdef FEAT_STL_OPT
"statusline",
#endif
@@ -18100,6 +18115,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

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

@@ -146,6 +146,7 @@ static int get_mac_fio_flags __ARGS((char_u *ptr));
# endif
#endif
static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf));
static void vim_settempdir __ARGS((char_u *tempdir));
#ifdef FEAT_AUTOCMD
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
#endif
@@ -6986,6 +6987,33 @@ vim_deltempdir()
}
#endif
/*
* Directory "tempdir" was created. Expand this name to a full path and put
* it in "vim_tempdir". This avoids that using ":cd" would confuse us.
* "tempdir" must be no longer than MAXPATHL.
*/
static void
vim_settempdir(tempdir)
char_u *tempdir;
{
char_u *buf;
buf = alloc((unsigned)MAXPATHL + 2);
if (buf != NULL)
{
if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL)
STRCPY(buf, tempdir);
# ifdef __EMX__
if (vim_strchr(buf, '/') != NULL)
STRCAT(buf, "/");
else
# endif
add_pathsep(buf);
vim_tempdir = vim_strsave(buf);
vim_free(buf);
}
}
/*
* vim_tempname(): Return a unique name that can be used for a temp file.
*
@@ -7007,8 +7035,6 @@ vim_tempname(extra_char)
#ifdef TEMPDIRNAMES
static char *(tempdirs[]) = {TEMPDIRNAMES};
int i;
long nr;
long off;
# ifndef EEXIST
struct stat st;
# endif
@@ -7027,6 +7053,12 @@ vim_tempname(extra_char)
*/
for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i)
{
size_t itmplen;
# ifndef HAVE_MKDTEMP
long nr;
long off;
# endif
/* expand $TMP, leave room for "/v1100000/999999999" */
expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20);
if (mch_isdir(itmp)) /* directory exists */
@@ -7040,7 +7072,14 @@ vim_tempname(extra_char)
else
# endif
add_pathsep(itmp);
itmplen = STRLEN(itmp);
# ifdef HAVE_MKDTEMP
/* Leave room for filename */
STRCAT(itmp, "vXXXXXX");
if (mkdtemp((char *)itmp) != NULL)
vim_settempdir(itmp);
# else
/* Get an arbitrary number of up to 6 digits. When it's
* unlikely that it already exists it will be faster,
* otherwise it doesn't matter. The use of mkdir() avoids any
@@ -7052,59 +7091,41 @@ vim_tempname(extra_char)
for (off = 0; off < 10000L; ++off)
{
int r;
#if defined(UNIX) || defined(VMS)
# if defined(UNIX) || defined(VMS)
mode_t umask_save;
#endif
# endif
sprintf((char *)itmp + STRLEN(itmp), "v%ld", nr + off);
# ifndef EEXIST
sprintf((char *)itmp + itmplen, "v%ld", nr + off);
# ifndef EEXIST
/* If mkdir() does not set errno to EEXIST, check for
* existing file here. There is a race condition then,
* although it's fail-safe. */
if (mch_stat((char *)itmp, &st) >= 0)
continue;
# endif
#if defined(UNIX) || defined(VMS)
# endif
# if defined(UNIX) || defined(VMS)
/* Make sure the umask doesn't remove the executable bit.
* "repl" has been reported to use "177". */
umask_save = umask(077);
#endif
# endif
r = vim_mkdir(itmp, 0700);
#if defined(UNIX) || defined(VMS)
# if defined(UNIX) || defined(VMS)
(void)umask(umask_save);
#endif
# endif
if (r == 0)
{
char_u *buf;
/* Directory was created, use this name.
* Expand to full path; When using the current
* directory a ":cd" would confuse us. */
buf = alloc((unsigned)MAXPATHL + 1);
if (buf != NULL)
{
if (vim_FullName(itmp, buf, MAXPATHL, FALSE)
== FAIL)
STRCPY(buf, itmp);
# ifdef __EMX__
if (vim_strchr(buf, '/') != NULL)
STRCAT(buf, "/");
else
# endif
add_pathsep(buf);
vim_tempdir = vim_strsave(buf);
vim_free(buf);
}
vim_settempdir(itmp);
break;
}
# ifdef EEXIST
# ifdef EEXIST
/* If the mkdir() didn't fail because the file/dir exists,
* we probably can't create any dir here, try another
* place. */
if (errno != EEXIST)
# endif
# endif
break;
}
# endif /* HAVE_MKDTEMP */
if (vim_tempdir != NULL)
break;
}

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

@@ -22,7 +22,7 @@
* These buffers are used for storing:
* - stuffed characters: A command that is translated into another command.
* - redo characters: will redo the last change.
* - recorded chracters: for the "q" command.
* - recorded characters: for the "q" command.
*
* The bytes are stored like in the typeahead buffer:
* - K_SPECIAL introduces a special key (two more bytes follow). A literal
@@ -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
/*
@@ -1283,7 +1283,7 @@ free_typebuf()
EMSG2(_(e_intern2), "Free typebuf 1");
else
vim_free(typebuf.tb_buf);
if (typebuf.tb_buf == noremapbuf_init)
if (typebuf.tb_noremap == noremapbuf_init)
EMSG2(_(e_intern2), "Free typebuf 2");
else
vim_free(typebuf.tb_noremap);
@@ -1516,7 +1516,7 @@ updatescript(c)
* wanted.
* This translates escaped K_SPECIAL and CSI bytes to a K_SPECIAL or CSI byte.
* Collects the bytes of a multibyte character into the whole character.
* Returns the modifers in the global "mod_mask".
* Returns the modifiers in the global "mod_mask".
*/
int
vgetc()
@@ -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
@@ -3320,7 +3320,7 @@ do_map(maptype, arg, mode, abbrev)
retval = 1;
goto theend;
}
/* An abbrevation cannot contain white space. */
/* An abbreviation cannot contain white space. */
for (n = 0; n < len; ++n)
if (vim_iswhite(keys[n]))
{
@@ -4272,7 +4272,7 @@ check_abbr(c, ptr, col, mincol)
/*
* Check for word before the cursor: If it ends in a keyword char all
* chars before it must be al keyword chars or non-keyword chars, but not
* chars before it must be keyword chars or non-keyword chars, but not
* white space. If it ends in a non-keyword char we accept any characters
* before it except white space.
*/
@@ -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

@@ -4376,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.
*/
@@ -5244,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

@@ -720,8 +720,9 @@ ex_perl(eap)
#ifdef HAVE_SANDBOX
if (sandbox)
{
safe = perl_get_sv( "VIM::safe", FALSE );
# ifndef MAKE_TEST /* avoid a warning for unreachable code */
if ((safe = perl_get_sv( "VIM::safe", FALSE )) == NULL || !SvTRUE(safe))
if (safe == NULL || !SvTRUE(safe))
EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module"));
else
# endif

View File

@@ -37,6 +37,12 @@
#ifdef HAVE_STDARG_H
# undef HAVE_STDARG_H /* Python's config.h defines it as well. */
#endif
#ifdef _POSIX_C_SOURCE
# undef _POSIX_C_SOURCE /* pyconfig.h defines it as well. */
#endif
#ifdef _XOPEN_SOURCE
# undef _XOPEN_SOURCE /* pyconfig.h defines it as well. */
#endif
#define PY_SSIZE_T_CLEAN
@@ -2058,6 +2064,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 +2079,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 (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc)
{
time_fd = mch_fopen(argv[i + 1], "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)
@@ -1708,6 +1726,11 @@ command_line_scan(parmp)
want_argument = TRUE;
argv_idx += 3;
}
else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0)
{
want_argument = TRUE;
argv_idx += 11;
}
#ifdef FEAT_CLIENTSERVER
else if (STRNICMP(argv[0] + argv_idx, "serverlist", 10) == 0)
; /* already processed -- no arg */
@@ -2039,7 +2062,7 @@ command_line_scan(parmp)
mainerr(ME_GARBAGE, (char_u *)argv[0]);
--argc;
if (argc < 1 && c != 'S')
if (argc < 1 && c != 'S') /* -S has an optional argument */
mainerr_arg_missing((char_u *)argv[0]);
++argv;
argv_idx = -1;
@@ -2080,11 +2103,16 @@ command_line_scan(parmp)
(char_u *)argv[0];
break;
case '-': /* "--cmd {command}" execute command */
if (parmp->n_pre_commands >= MAX_ARG_CMDS)
mainerr(ME_EXTRA_CMD, NULL);
parmp->pre_commands[parmp->n_pre_commands++] =
case '-':
if (argv[-1][2] == 'c')
{
/* "--cmd {command}" execute command */
if (parmp->n_pre_commands >= MAX_ARG_CMDS)
mainerr(ME_EXTRA_CMD, NULL);
parmp->pre_commands[parmp->n_pre_commands++] =
(char_u *)argv[0];
}
/* "--startuptime <file>" already handled */
break;
/* case 'd': -d {device} is handled in mch_check_win() for the
@@ -3122,6 +3150,9 @@ usage()
main_msg(_("--serverlist\t\tList available Vim server names and exit"));
main_msg(_("--servername <name>\tSend to/become the Vim server <name>"));
#endif
#ifdef STARTUPTIME
main_msg(_("--startuptime <file>\tWrite startup timing messages to <file>"));
#endif
#ifdef FEAT_VIMINFO
main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo"));
#endif
@@ -3211,6 +3242,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 +3344,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

@@ -1026,12 +1026,14 @@ open_line(dir, flags, old_indent)
int c = 0;
int off = 0;
for (p = lead_flags; *p && *p != ':'; ++p)
for (p = lead_flags; *p != NUL && *p != ':'; )
{
if (*p == COM_RIGHT || *p == COM_LEFT)
c = *p;
c = *p++;
else if (VIM_ISDIGIT(*p) || *p == '-')
off = getdigits(&p);
else
++p;
}
if (c == COM_RIGHT) /* right adjusted leader */
{
@@ -2886,6 +2888,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)
@@ -1005,9 +1005,14 @@ free_all_mem()
# ifdef FEAT_MENU
/* Clear menus. */
do_cmdline_cmd((char_u *)"aunmenu *");
# ifdef FEAT_MULTI_LANG
do_cmdline_cmd((char_u *)"menutranslate clear");
# endif
# endif
/* Clear mappings, abbreviations, breakpoints. */
do_cmdline_cmd((char_u *)"lmapclear");
do_cmdline_cmd((char_u *)"xmapclear");
do_cmdline_cmd((char_u *)"mapclear");
do_cmdline_cmd((char_u *)"mapclear!");
do_cmdline_cmd((char_u *)"abclear");
@@ -1282,7 +1287,7 @@ csh_like_shell()
/*
* Escape "string" for use as a shell argument with system().
* This uses single quotes, except when we know we need to use double qoutes
* This uses single quotes, except when we know we need to use double quotes
* (MS-DOS and MS-Windows without 'shellslash' set).
* Escape a newline, depending on the 'shell' option.
* When "do_special" is TRUE also replace "!", "%", "#" and things starting
@@ -1537,7 +1542,7 @@ copy_spaces(ptr, count)
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
/*
* Copy a character a number of times.
* Does not work for multi-byte charactes!
* Does not work for multi-byte characters!
*/
void
copy_chars(ptr, count, c)
@@ -4260,7 +4265,7 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
* or '**76' is transposed to '**N'( 'N' is ASCII value 76).
* For EBCDIC you get different character values.
* If no restrict is given after '**' the default is used.
* Due to this technic the path looks awful if you print it as a
* Due to this technique the path looks awful if you print it as a
* string.
*/
len = 0;
@@ -4649,7 +4654,7 @@ vim_findfile(search_ctx_arg)
&& !mch_isdir(stackp->ffs_filearray[i]))
continue; /* not a directory */
/* prepare the filename to be checked for existance
/* prepare the filename to be checked for existence
* below */
STRCPY(file_path, stackp->ffs_filearray[i]);
add_pathsep(file_path);
@@ -5438,7 +5443,7 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f
#if defined(MSWIN) || defined(MSDOS) || defined(OS2)
/* handle "\tmp" as absolute path */
|| vim_ispathsep(ff_file_to_find[0])
/* handle "c:name" as absulute path */
/* handle "c:name" as absolute path */
|| (ff_file_to_find[0] != NUL && ff_file_to_find[1] == ':')
#endif
#ifdef AMIGA
@@ -5681,7 +5686,7 @@ qsort(base, elm_count, elm_size, cmp)
p2 = (char_u *)base + (j + gap) * elm_size;
if ((*cmp)((void *)p1, (void *)p2) <= 0)
break;
/* Exchange the elemets. */
/* Exchange the elements. */
mch_memmove(buf, p1, elm_size);
mch_memmove(p1, p2, elm_size);
mch_memmove(p2, buf, elm_size);

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

@@ -422,8 +422,9 @@ shift_block(oap, amount)
#ifdef FEAT_MBYTE
if (has_mbyte)
bd.textstart += (*mb_ptr2len)(bd.textstart);
else
#endif
++bd.textstart;
++bd.textstart;
}
for ( ; vim_iswhite(*bd.textstart); )
{
@@ -2020,6 +2021,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 +2037,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 +2696,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 +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

@@ -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)
@@ -6373,7 +6413,8 @@ screen_puts_len(text, len, row, col, attr)
}
else
{
nc = utfc_ptr2char(ptr + mbyte_blen, pcc);
nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc,
(int)((text + len) - ptr - mbyte_blen));
nc1 = pcc[0];
}
pc = prev_c;
@@ -9465,7 +9506,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

@@ -494,6 +494,11 @@ static char *(features[]) =
#else
"-sniff",
#endif
#ifdef STARTUPTIME
"+startuptime",
#else
"-startuptime",
#endif
#ifdef FEAT_STL_OPT
"+statusline",
#else
@@ -676,6 +681,72 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
296,
/**/
295,
/**/
294,
/**/
293,
/**/
292,
/**/
291,
/**/
290,
/**/
289,
/**/
288,
/**/
287,
/**/
286,
/**/
285,
/**/
284,
/**/
283,
/**/
282,
/**/
281,
/**/
280,
/**/
279,
/**/
278,
/**/
277,
/**/
276,
/**/
275,
/**/
274,
/**/
273,
/**/
272,
/**/
271,
/**/
270,
/**/
269,
/**/
268,
/**/
267,
/**/
266,
/**/
265,
/**/
264,
/**/
263,
/**/