Compare commits

..

9 Commits

Author SHA1 Message Date
Bram Moolenaar
795ec43112 updated for version 7.3.554
Problem:    Compiler warning for unused argument.
Solution:   Add UNUSED.
2012-06-13 18:15:19 +02:00
Bram Moolenaar
5641f38d41 updated for version 7.3.553
Problem:    With double-width characters and 'listchars' containing "precedes"
            the text is displayed one cell off.
Solution:   Check for double-width character being overwritten by the
            "precedes" character. (Yasuhiro Matsumoto)
2012-06-13 18:06:36 +02:00
Bram Moolenaar
bfe3bf806a updated for version 7.3.552
Problem:    Formatting inside comments does not use the "2" flag in
            'formatoptions'.
Solution:   Support the "2" flag.  (Tor Perkins)
2012-06-13 17:28:55 +02:00
Bram Moolenaar
a8596c4772 updated for version 7.3.551
Problem:    When using :tablose a TabEnter autocommand is triggered too early.
            (Karthick)
Solution:   Don't trigger *Enter autocommands before closing the tab.
            (Christian Brabandt)
2012-06-13 14:28:20 +02:00
Bram Moolenaar
e04a48f204 updated for version 7.3.550
Problem:    With "j" in 'formatoptions' a list leader is not removed. (Gary
            Johnson)
Solution:   Don't ignore the start of a three part comment. (Lech Lorens)
2012-06-13 14:01:41 +02:00
Bram Moolenaar
48d279215f updated for version 7.3.549
Problem:    In 'cinoptions' "0s" is interpreted as one shiftwidth. (David
            Pineau)
Solution:   Use the zero as zero. (Lech Lorens)
2012-06-13 13:40:48 +02:00
Bram Moolenaar
27ba088549 updated for version 7.3.548
Problem:    Compiler warning on 64 bit Windows.
Solution:   Add type cast. (Mike Williams)
2012-06-07 21:09:39 +02:00
Bram Moolenaar
802053f14a updated for version 7.3.547
Problem:    Compiler warning for uninitialized variable.
Solution:   Initialize it.
2012-06-06 23:08:38 +02:00
Bram Moolenaar
3b393a0b53 updated for version 7.3.546
Problem:    Bogus line break.
Solution:   Remove the line break.
2012-06-06 19:05:50 +02:00
18 changed files with 333 additions and 83 deletions

View File

@@ -4470,7 +4470,7 @@ do_arg_all(count, forceit, keep_tabs)
* When the ":tab" modifier was used do this for all tab pages.
*/
if (had_tab > 0)
goto_tabpage_tp(first_tabpage);
goto_tabpage_tp(first_tabpage, TRUE);
for (;;)
{
tpnext = curtab->tp_next;
@@ -4582,7 +4582,7 @@ do_arg_all(count, forceit, keep_tabs)
if (!valid_tabpage(tpnext))
tpnext = first_tabpage; /* start all over...*/
# endif
goto_tabpage_tp(tpnext);
goto_tabpage_tp(tpnext, TRUE);
}
/*
@@ -4686,13 +4686,13 @@ do_arg_all(count, forceit, keep_tabs)
if (last_curtab != new_curtab)
{
if (valid_tabpage(last_curtab))
goto_tabpage_tp(last_curtab);
goto_tabpage_tp(last_curtab, TRUE);
if (win_valid(last_curwin))
win_enter(last_curwin, FALSE);
}
/* to window with first arg */
if (valid_tabpage(new_curtab))
goto_tabpage_tp(new_curtab);
goto_tabpage_tp(new_curtab, TRUE);
if (win_valid(new_curwin))
win_enter(new_curwin, FALSE);
@@ -4744,7 +4744,7 @@ ex_buffer_all(eap)
*/
#ifdef FEAT_WINDOWS
if (had_tab > 0)
goto_tabpage_tp(first_tabpage);
goto_tabpage_tp(first_tabpage, TRUE);
for (;;)
{
#endif
@@ -4784,7 +4784,7 @@ ex_buffer_all(eap)
/* Without the ":tab" modifier only do the current tab page. */
if (had_tab == 0 || tpnext == NULL)
break;
goto_tabpage_tp(tpnext);
goto_tabpage_tp(tpnext, TRUE);
}
#endif

View File

@@ -1463,7 +1463,7 @@ normalchar:
* what check_abbr() expects. */
(has_mbyte && c >= 0x100) ? (c + ABBR_OFF) :
#endif
c) && c != Ctrl_RSB))
c) && c != Ctrl_RSB))
{
insert_special(c, FALSE, FALSE);
#ifdef FEAT_RIGHTLEFT
@@ -5769,6 +5769,16 @@ insert_special(c, allow_modmask, ctrlv)
# define WHITECHAR(cc) vim_iswhite(cc)
#endif
/*
* "flags": INSCHAR_FORMAT - force formatting
* INSCHAR_CTRLV - char typed just after CTRL-V
* INSCHAR_NO_FEX - don't use 'formatexpr'
*
* NOTE: passes the flags value straight through to internal_format() which,
* beside INSCHAR_FORMAT (above), is also looking for these:
* INSCHAR_DO_COM - format comments
* INSCHAR_COM_LIST - format comments with num list or 2nd line indent
*/
void
insertchar(c, flags, second_indent)
int c; /* character to insert or NUL */
@@ -6011,6 +6021,9 @@ insertchar(c, flags, second_indent)
/*
* Format text at the current insert position.
*
* If the INSCHAR_COM_LIST flag is present, then the value of second_indent
* will be the comment leader length sent to open_line().
*/
static void
internal_format(textwidth, second_indent, flags, format_only, c)
@@ -6289,23 +6302,36 @@ internal_format(textwidth, second_indent, flags, format_only, c)
+ (fo_white_par ? OPENLINE_KEEPTRAIL : 0)
#ifdef FEAT_COMMENTS
+ (do_comments ? OPENLINE_DO_COM : 0)
+ ((flags & INSCHAR_COM_LIST) ? OPENLINE_COM_LIST : 0)
#endif
, old_indent);
old_indent = 0;
, ((flags & INSCHAR_COM_LIST) ? second_indent : old_indent));
if (!(flags & INSCHAR_COM_LIST))
old_indent = 0;
replace_offset = 0;
if (first_line)
{
if (second_indent < 0 && has_format_option(FO_Q_NUMBER))
second_indent = get_number_indent(curwin->w_cursor.lnum -1);
if (second_indent >= 0)
if (!(flags & INSCHAR_COM_LIST))
{
/*
* This section is for numeric lists w/o comments. If comment
* indents are needed with numeric lists (formatoptions=nq),
* then the INSCHAR_COM_LIST flag will cause the corresponding
* OPENLINE_COM_LIST flag to be passed through to open_line()
* (as seen above)...
*/
if (second_indent < 0 && has_format_option(FO_Q_NUMBER))
second_indent = get_number_indent(curwin->w_cursor.lnum -1);
if (second_indent >= 0)
{
#ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
change_indent(INDENT_SET, second_indent, FALSE, NUL, TRUE);
else
if (State & VREPLACE_FLAG)
change_indent(INDENT_SET, second_indent,
FALSE, NUL, TRUE);
else
#endif
(void)set_indent(second_indent, SIN_CHANGED);
(void)set_indent(second_indent, SIN_CHANGED);
}
}
first_line = FALSE;
}

View File

@@ -16415,7 +16415,7 @@ f_settabvar(argvars, rettv)
if (tp != NULL && varname != NULL && varp != NULL)
{
save_curtab = curtab;
goto_tabpage_tp(tp);
goto_tabpage_tp(tp, TRUE);
tabvarname = alloc((unsigned)STRLEN(varname) + 3);
if (tabvarname != NULL)
@@ -16428,7 +16428,7 @@ f_settabvar(argvars, rettv)
/* Restore current tabpage */
if (valid_tabpage(save_curtab))
goto_tabpage_tp(save_curtab);
goto_tabpage_tp(save_curtab, TRUE);
}
}
@@ -16492,7 +16492,7 @@ setwinvar(argvars, rettv, off)
/* set curwin to be our win, temporarily */
save_curwin = curwin;
save_curtab = curtab;
goto_tabpage_tp(tp);
goto_tabpage_tp(tp, TRUE);
if (!win_valid(win))
return;
curwin = win;
@@ -16527,7 +16527,7 @@ setwinvar(argvars, rettv, off)
/* Restore current tabpage and window, if still valid (autocomands can
* make them invalid). */
if (valid_tabpage(save_curtab))
goto_tabpage_tp(save_curtab);
goto_tabpage_tp(save_curtab, TRUE);
if (win_valid(save_curwin))
{
curwin = save_curwin;

View File

@@ -2476,7 +2476,7 @@ ex_listdo(eap)
/* go to window "tp" */
if (!valid_tabpage(tp))
break;
goto_tabpage_tp(tp);
goto_tabpage_tp(tp, TRUE);
tp = tp->tp_next;
}
#endif

View File

@@ -8918,7 +8918,7 @@ aucmd_restbuf(aco)
if (wp == aucmd_win)
{
if (tp != curtab)
goto_tabpage_tp(tp);
goto_tabpage_tp(tp, TRUE);
win_goto(aucmd_win);
goto win_found;
}

View File

@@ -423,27 +423,70 @@ get_number_indent(lnum)
{
colnr_T col;
pos_T pos;
regmmatch_T regmatch;
if (lnum > curbuf->b_ml.ml_line_count)
return -1;
pos.lnum = 0;
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL)
#ifdef FEAT_COMMENTS
if (has_format_option(FO_Q_COMS) && has_format_option(FO_Q_NUMBER))
{
regmatch.rmm_ic = FALSE;
regmatch.rmm_maxcol = 0;
if (vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
(colnr_T)0, NULL))
regmatch_T regmatch;
int lead_len; /* length of comment leader */
lead_len = get_leader_len(ml_get(lnum), NULL, FALSE, TRUE);
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL)
{
pos.lnum = regmatch.endpos[0].lnum + lnum;
pos.col = regmatch.endpos[0].col;
regmatch.rm_ic = FALSE;
/* vim_regexec() expects a pointer to a line. This lets us
* start matching for the flp beyond any comment leader... */
if (vim_regexec(&regmatch, ml_get(lnum) + lead_len, (colnr_T)0))
{
pos.lnum = lnum;
pos.col = *regmatch.endp - (ml_get(lnum) + lead_len);
pos.col += lead_len;
#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
pos.coladd = 0;
#endif
}
}
vim_free(regmatch.regprog);
}
else
{
/*
* What follows is the orig code that is not "comment aware"...
*
* I'm not sure if regmmatch_T (multi-match) is needed in this case.
* It may be true that this section would work properly using the
* regmatch_T code above, in which case, these two seperate sections
* should be consolidated w/ FEAT_COMMENTS making lead_len > 0...
*/
#endif
regmmatch_T regmatch;
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL)
{
regmatch.rmm_ic = FALSE;
regmatch.rmm_maxcol = 0;
if (vim_regexec_multi(&regmatch, curwin, curbuf,
lnum, (colnr_T)0, NULL))
{
pos.lnum = regmatch.endpos[0].lnum + lnum;
pos.col = regmatch.endpos[0].col;
#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
#endif
}
vim_free(regmatch.regprog);
}
#ifdef FEAT_COMMENTS
}
#endif
if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL)
return -1;
@@ -502,14 +545,18 @@ cin_is_cinword(line)
* OPENLINE_DO_COM format comments
* OPENLINE_KEEPTRAIL keep trailing spaces
* OPENLINE_MARKFIX adjust mark positions after the line break
* OPENLINE_COM_LIST format comments with list or 2nd line indent
*
* "second_line_indent": indent for after ^^D in Insert mode or if flag
* OPENLINE_COM_LIST
*
* Return TRUE for success, FALSE for failure
*/
int
open_line(dir, flags, old_indent)
open_line(dir, flags, second_line_indent)
int dir; /* FORWARD or BACKWARD */
int flags;
int old_indent; /* indent for after ^^D in Insert mode */
int second_line_indent;
{
char_u *saved_line; /* copy of the original line */
char_u *next_line = NULL; /* copy of the next line */
@@ -650,8 +697,8 @@ open_line(dir, flags, old_indent)
* count white space on current line
*/
newindent = get_indent_str(saved_line, (int)curbuf->b_p_ts);
if (newindent == 0)
newindent = old_indent; /* for ^^D command in insert mode */
if (newindent == 0 && !(flags & OPENLINE_COM_LIST))
newindent = second_line_indent; /* for ^^D command in insert mode */
#ifdef FEAT_SMARTINDENT
/*
@@ -1008,8 +1055,8 @@ open_line(dir, flags, old_indent)
if (lead_len)
{
/* allocate buffer (may concatenate p_exta later) */
leader = alloc(lead_len + lead_repl_len + extra_space +
extra_len + 1);
leader = alloc(lead_len + lead_repl_len + extra_space + extra_len
+ (second_line_indent > 0 ? second_line_indent : 0));
allocated = leader; /* remember to free it later */
if (leader == NULL)
@@ -1304,6 +1351,20 @@ open_line(dir, flags, old_indent)
/* concatenate leader and p_extra, if there is a leader */
if (lead_len)
{
if (flags & OPENLINE_COM_LIST && second_line_indent > 0)
{
int i;
int padding = second_line_indent - (newindent + STRLEN(leader));
/* Here whitespace is inserted after the comment char.
* Below, set_indent(newindent, SIN_INSERT) will insert the
* whitespace needed before the comment char. */
for (i = 0; i < padding; i++)
{
STRCAT(leader, " ");
newcol++;
}
}
STRCAT(leader, p_extra);
p_extra = leader;
did_ai = TRUE; /* So truncating blanks works with comments */
@@ -4966,8 +5027,8 @@ add_pathsep(p)
char_u *
FullName_save(fname, force)
char_u *fname;
int force; /* force expansion, even when it already looks
like a full path name */
int force; /* force expansion, even when it already looks
* like a full path name */
{
char_u *buf;
char_u *new_fname = NULL;
@@ -6635,6 +6696,7 @@ get_c_indent()
int whilelevel;
linenr_T lnum;
char_u *options;
char_u *digits;
int fraction = 0; /* init for GCC */
int divider;
int n;
@@ -6650,6 +6712,7 @@ get_c_indent()
l = options++;
if (*options == '-')
++options;
digits = options; /* remember where the digits start */
n = getdigits(&options);
divider = 0;
if (*options == '.') /* ".5s" means a fraction */
@@ -6666,7 +6729,7 @@ get_c_indent()
}
if (*options == 's') /* "2s" means two times 'shiftwidth' */
{
if (n == 0 && fraction == 0)
if (options == digits)
n = curbuf->b_p_sw; /* just "s" is one 'shiftwidth' */
else
{

View File

@@ -1727,8 +1727,8 @@ op_delete(oap)
* and the delete is within one line. */
if ((
#ifdef FEAT_CLIPBOARD
((clip_unnamed & CLIP_UNNAMED) && oap->regname == '*') ||
((clip_unnamed & CLIP_UNNAMED_PLUS) && oap->regname == '+') ||
((clip_unnamed & CLIP_UNNAMED) && oap->regname == '*') ||
((clip_unnamed & CLIP_UNNAMED_PLUS) && oap->regname == '+') ||
#endif
oap->regname == 0) && oap->motion_type != MLINE
&& oap->line_count == 1)
@@ -4208,10 +4208,10 @@ dis_msg(p, skip_esc)
* "is_comment".
* line - line to be processed,
* process - if FALSE, will only check whether the line ends with an unclosed
* comment,
* comment,
* include_space - whether to also skip space following the comment leader,
* is_comment - will indicate whether the current line ends with an unclosed
* comment.
* comment.
*/
static char_u *
skip_comment(line, process, include_space, is_comment)
@@ -4250,15 +4250,13 @@ skip_comment(line, process, include_space, is_comment)
return line;
/* Find:
* - COM_START,
* - COM_END,
* - colon,
* whichever comes first.
*/
while (*comment_flags)
{
if (*comment_flags == COM_START
|| *comment_flags == COM_END
if (*comment_flags == COM_END
|| *comment_flags == ':')
{
break;
@@ -4267,9 +4265,8 @@ skip_comment(line, process, include_space, is_comment)
}
/* If we found a colon, it means that we are not processing a line
* starting with an opening or a closing part of a three-part
* comment. That's good, because we don't want to remove those as
* this would be annoying.
* starting with a closing part of a three-part comment. That's good,
* because we don't want to remove those as this would be annoying.
*/
if (*comment_flags == ':' || *comment_flags == NUL)
line += lead_len;
@@ -4306,7 +4303,7 @@ do_join(count, insert_space, save_undo, use_formatoptions)
colnr_T col = 0;
int ret = OK;
#if defined(FEAT_COMMENTS) || defined(PROTO)
int *comments;
int *comments = NULL;
int remove_comments = (use_formatoptions == TRUE)
&& has_format_option(FO_REMOVE_COMS);
int prev_was_comment;
@@ -4352,7 +4349,7 @@ do_join(count, insert_space, save_undo, use_formatoptions)
char_u *new_curr = skip_comment(curr, TRUE, insert_space,
&prev_was_comment);
comments[t] = new_curr - curr;
comments[t] = (int)(new_curr - curr);
curr = new_curr;
}
else
@@ -4726,9 +4723,11 @@ format_lines(line_count, avoid_fex)
char_u *leader_flags = NULL; /* flags for leader of current line */
char_u *next_leader_flags; /* flags for leader of next line */
int do_comments; /* format comments */
int do_comments_list = 0; /* format comments with 'n' or '2' */
#endif
int advance = TRUE;
int second_indent = -1;
int second_indent = -1; /* indent for second line (comment
* aware) */
int do_second_indent;
int do_number_indent;
int do_trail_white;
@@ -4831,18 +4830,46 @@ format_lines(line_count, avoid_fex)
if (first_par_line
&& (do_second_indent || do_number_indent)
&& prev_is_end_par
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count
#ifdef FEAT_COMMENTS
&& leader_len == 0
&& next_leader_len == 0
#endif
)
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
{
if (do_second_indent
&& !lineempty(curwin->w_cursor.lnum + 1))
second_indent = get_indent_lnum(curwin->w_cursor.lnum + 1);
if (do_second_indent && !lineempty(curwin->w_cursor.lnum + 1))
{
#ifdef FEAT_COMMENTS
if (leader_len == 0 && next_leader_len == 0)
{
/* no comment found */
#endif
second_indent =
get_indent_lnum(curwin->w_cursor.lnum + 1);
#ifdef FEAT_COMMENTS
}
else
{
second_indent = next_leader_len;
do_comments_list = 1;
}
#endif
}
else if (do_number_indent)
second_indent = get_number_indent(curwin->w_cursor.lnum);
{
#ifdef FEAT_COMMENTS
if (leader_len == 0 && next_leader_len == 0)
{
/* no comment found */
#endif
second_indent =
get_number_indent(curwin->w_cursor.lnum);
#ifdef FEAT_COMMENTS
}
else
{
/* get_number_indent() is now "comment aware"... */
second_indent =
get_number_indent(curwin->w_cursor.lnum);
do_comments_list = 1;
}
#endif
}
}
/*
@@ -4881,6 +4908,8 @@ format_lines(line_count, avoid_fex)
insertchar(NUL, INSCHAR_FORMAT
#ifdef FEAT_COMMENTS
+ (do_comments ? INSCHAR_DO_COM : 0)
+ (do_comments && do_comments_list
? INSCHAR_COM_LIST : 0)
#endif
+ (avoid_fex ? INSCHAR_NO_FEX : 0), second_indent);
State = old_State;

View File

@@ -27,7 +27,7 @@ int valid_tabpage __ARGS((tabpage_T *tpc));
tabpage_T *find_tabpage __ARGS((int n));
int tabpage_index __ARGS((tabpage_T *ftp));
void goto_tabpage __ARGS((int n));
void goto_tabpage_tp __ARGS((tabpage_T *tp));
void goto_tabpage_tp __ARGS((tabpage_T *tp, int trigger_autocmds));
void goto_tabpage_win __ARGS((tabpage_T *tp, win_T *wp));
void tabpage_move __ARGS((int nr));
void win_goto __ARGS((win_T *wp));

View File

@@ -89,6 +89,9 @@
#include "vim.h"
#define MB_FILLER_CHAR '<' /* character used when a double-width character
* doesn't fit. */
/*
* The attributes that are actually active for writing to the screen.
*/
@@ -3228,8 +3231,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
/* no bad word found at line start, don't check until end of a
* word */
spell_hlf = HLF_COUNT;
word_end = (int)(spell_to_word_end(ptr, wp)
- line + 1);
word_end = (int)(spell_to_word_end(ptr, wp) - line + 1);
}
else
{
@@ -4017,7 +4019,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
if (n_skip > 0 && mb_l > 1 && n_extra == 0)
{
n_extra = 1;
c_extra = '<';
c_extra = MB_FILLER_CHAR;
c = ' ';
if (area_attr == 0 && search_attr == 0)
{
@@ -4577,6 +4579,15 @@ win_line(wp, lnum, startrow, endrow, nochange)
c = lcs_prec;
lcs_prec_todo = NUL;
#ifdef FEAT_MBYTE
if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
{
/* Double-width character being overwritten by the "precedes"
* character, need to fill up half the character. */
c_extra = MB_FILLER_CHAR;
n_extra = 1;
n_attr = 2;
extra_attr = hl_attr(HLF_AT);
}
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1)
{

View File

@@ -103,12 +103,15 @@ if (condition) // Remove the next comment leader!
STARTTEST
/^{/+1
:set comments=s1:/*,mb:*,ex:*/,://
:set comments=sO:*\ -,mO:*\ \ ,exO:*/
:set comments+=s1:/*,mb:*,ex:*/,://
:set comments+=s1:>#,mb:#,ex:#<,:<
:set cpoptions-=j joinspaces fo=j
:set backspace=eol,start
:.,+3join
j4J
:.,+8join
j9J
:.,+2join
j3J
:.,+2join
@@ -132,6 +135,24 @@ ENDTEST
/*
* Make sure the previous comment leader is not removed.
*/
/* List:
* - item1
* foo bar baz
* foo bar baz
* - item2
* foo bar baz
* foo bar baz
*/
/* List:
* - item1
* foo bar baz
* foo bar baz
* - item2
* foo bar baz
* foo bar baz
*/
// Should the next comment leader be left alone?
// Yes.

View File

@@ -66,6 +66,8 @@ if (condition) // Remove the next comment leader! OK, I will.
{
/* Make sure the previous comment leader is not removed. */
/* Make sure the previous comment leader is not removed. */
/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */
/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */
// Should the next comment leader be left alone? Yes.
// Should the next comment leader be left alone? Yes.
/* Here the comment leader should be left intact. */ // And so should this one.

View File

@@ -975,6 +975,24 @@ main ( int first_par, /*
}
STARTTEST
:set cin
:set cino=es,n0s
/main
=][
ENDTEST
main(void)
{
/* Make sure that cino=X0s is not parsed like cino=Xs. */
if (cond)
foo();
else
{
bar();
}
}
STARTTEST
:set cin
:set cino=

View File

@@ -940,6 +940,18 @@ main ( int first_par, /*
}
main(void)
{
/* Make sure that cino=X0s is not parsed like cino=Xs. */
if (cond)
foo();
else
{
bar();
}
}
{
do
{

View File

@@ -50,6 +50,27 @@ a b
#a b
}
STARTTEST
/^{/+1
:set tw=5 fo=qn comments=:#
gwap
ENDTEST
{
# 1 a b
}
STARTTEST
/^{/+1
:set tw=5 fo=q2 comments=:#
gwap
ENDTEST
{
# x
# a b
}
STARTTEST
/^{/+2
:set tw& fo=a

View File

@@ -34,5 +34,17 @@ a b
}
{
# 1 a
# b
}
{
# x a
# b
}
{ 1aa ^^2bb }

View File

@@ -714,6 +714,24 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
554,
/**/
553,
/**/
552,
/**/
551,
/**/
550,
/**/
549,
/**/
548,
/**/
547,
/**/
546,
/**/
545,
/**/

View File

@@ -1072,12 +1072,14 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define INSCHAR_DO_COM 2 /* format comments */
#define INSCHAR_CTRLV 4 /* char typed just after CTRL-V */
#define INSCHAR_NO_FEX 8 /* don't use 'formatexpr' */
#define INSCHAR_COM_LIST 16 /* format comments with list/2nd line indent */
/* flags for open_line() */
#define OPENLINE_DELSPACES 1 /* delete spaces after cursor */
#define OPENLINE_DO_COM 2 /* format comments */
#define OPENLINE_KEEPTRAIL 4 /* keep trailing spaces */
#define OPENLINE_MARKFIX 8 /* fix mark positions */
#define OPENLINE_COM_LIST 16 /* format comments with list/2nd line indent */
/*
* There are four history tables:

View File

@@ -45,7 +45,7 @@ static void new_frame __ARGS((win_T *wp));
#if defined(FEAT_WINDOWS) || defined(PROTO)
static tabpage_T *alloc_tabpage __ARGS((void));
static int leave_tabpage __ARGS((buf_T *new_curbuf));
static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf));
static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf, int trigger_autocmds));
static void frame_fix_height __ARGS((win_T *wp));
static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin));
static void win_enter_ext __ARGS((win_T *wp, int undo_sync, int no_curwin));
@@ -355,11 +355,11 @@ newwindow:
&& valid_tabpage(oldtab))
{
newtab = curtab;
goto_tabpage_tp(oldtab);
goto_tabpage_tp(oldtab, TRUE);
if (curwin == wp)
win_close(curwin, FALSE);
if (valid_tabpage(newtab))
goto_tabpage_tp(newtab);
goto_tabpage_tp(newtab, TRUE);
}
}
break;
@@ -2130,8 +2130,10 @@ close_last_window_tabpage(win, free_buf, prev_curtab)
* page and then close the window and the tab page. This avoids that
* curwin and curtab are invalid while we are freeing memory, they may
* be used in GUI events.
* Don't trigger autocommands yet, they may use wrong values, so do
* that below.
*/
goto_tabpage_tp(alt_tabpage());
goto_tabpage_tp(alt_tabpage(), FALSE);
redraw_tabline = TRUE;
/* Safety check: Autocommands may have closed the window when jumping
@@ -2144,6 +2146,12 @@ close_last_window_tabpage(win, free_buf, prev_curtab)
if (h != tabline_height())
shell_new_rows();
}
/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
* that now. */
#ifdef FEAT_AUTOCMD
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
#endif
return TRUE;
}
return FALSE;
@@ -3556,7 +3564,7 @@ win_new_tabpage(after)
}
/* Failed, get back the previous Tab page */
enter_tabpage(curtab, curbuf);
enter_tabpage(curtab, curbuf, TRUE);
return FAIL;
}
@@ -3709,11 +3717,13 @@ leave_tabpage(new_curbuf)
/*
* Start using tab page "tp".
* Only to be used after leave_tabpage() or freeing the current tab page.
* Only trigger *Enter autocommands when trigger_autocmds is TRUE.
*/
static void
enter_tabpage(tp, old_curbuf)
enter_tabpage(tp, old_curbuf, trigger_autocmds)
tabpage_T *tp;
buf_T *old_curbuf UNUSED;
int trigger_autocmds UNUSED;
{
int old_off = tp->tp_firstwin->w_winrow;
win_T *next_prevwin = tp->tp_prevwin;
@@ -3761,9 +3771,12 @@ enter_tabpage(tp, old_curbuf)
#ifdef FEAT_AUTOCMD
/* Apply autocommands after updating the display, when 'rows' and
* 'columns' have been set correctly. */
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
if (old_curbuf != curbuf)
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
if (trigger_autocmds)
{
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
if (old_curbuf != curbuf)
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
}
#endif
redraw_all_later(CLEAR);
@@ -3839,7 +3852,7 @@ goto_tabpage(n)
}
}
goto_tabpage_tp(tp);
goto_tabpage_tp(tp, TRUE);
#ifdef FEAT_GUI_TABLINE
if (gui_use_tabline())
@@ -3849,11 +3862,13 @@ goto_tabpage(n)
/*
* Go to tabpage "tp".
* Only trigger *Enter autocommands when trigger_autocmds is TRUE.
* Note: doesn't update the GUI tab.
*/
void
goto_tabpage_tp(tp)
goto_tabpage_tp(tp, trigger_autocmds)
tabpage_T *tp;
int trigger_autocmds;
{
/* Don't repeat a message in another tab page. */
set_keep_msg(NULL, 0);
@@ -3861,9 +3876,9 @@ goto_tabpage_tp(tp)
if (tp != curtab && leave_tabpage(tp->tp_curwin->w_buffer) == OK)
{
if (valid_tabpage(tp))
enter_tabpage(tp, curbuf);
enter_tabpage(tp, curbuf, trigger_autocmds);
else
enter_tabpage(curtab, curbuf);
enter_tabpage(curtab, curbuf, trigger_autocmds);
}
}
@@ -3876,7 +3891,7 @@ goto_tabpage_win(tp, wp)
tabpage_T *tp;
win_T *wp;
{
goto_tabpage_tp(tp);
goto_tabpage_tp(tp, TRUE);
if (curtab == tp && win_valid(wp))
{
win_enter(wp, TRUE);