From 8f700f8f5f69a2e4cc445ad9c9d3eab597804978 Mon Sep 17 00:00:00 2001 From: edyfox Date: Wed, 22 Aug 2007 01:02:46 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@480 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- src/ex_cmds.c | 19 +++++++++++++++---- src/if_cscope.c | 22 ++++++++++------------ src/syntax.c | 30 ++++++++++++++++++++++++++---- src/version.c | 8 ++++++++ 4 files changed, 59 insertions(+), 20 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 46671dca..958f3abd 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2974,7 +2974,7 @@ check_readonly(forceit, buf) * 'fnum' is the number of the file, if zero use ffname/sfname. * * Return 1 for "normal" error, 2 for "not written" error, 0 for success - * -1 for succesfully opening another file. + * -1 for successfully opening another file. * 'lnum' is the line number for the cursor in the new file (if non-zero). */ int @@ -3584,9 +3584,20 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags) curwin_init(); #ifdef FEAT_FOLDING - /* It's like all lines in the buffer changed. Need to update - * automatic folding. */ + /* It's possible that all lines in the buffer changed. Need to update + * automatic folding for all windows where it's used. */ +# ifdef FEAT_WINDOWS + { + win_T *win; + tabpage_T *tp; + + FOR_ALL_TAB_WINDOWS(tp, win) + if (win->w_buffer == curbuf) + foldUpdateAll(win); + } +# else foldUpdateAll(curwin); +# endif #endif /* Change directories when the 'acd' option is set. */ @@ -3776,7 +3787,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags) workshop_file_opened((char *)curbuf->b_ffname, curbuf->b_p_ro); # endif # ifdef FEAT_NETBEANS_INTG - if (usingNetbeans & ((flags & ECMD_SET_HELP) != ECMD_SET_HELP)) + if (usingNetbeans && ((flags & ECMD_SET_HELP) != ECMD_SET_HELP)) netbeans_file_opened(curbuf); # endif } diff --git a/src/if_cscope.c b/src/if_cscope.c index 3e430168..445494bc 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -73,6 +73,8 @@ static int cs_show __ARGS((exarg_T *eap)); static csinfo_T csinfo[CSCOPE_MAX_CONNECTIONS]; +static int eap_arg_len; /* length of eap->arg, set in + cs_lookup_cmd() */ static cscmd_T cs_cmds[] = { { "add", cs_add, @@ -260,14 +262,7 @@ cs_fgets(buf, size) if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL) return TRUE; - - if ((int)strlen(p) > size) - { - strncpy((char *)buf, p, size - 1); - buf[size] = '\0'; - } - else - (void)strcpy((char *)buf, p); + vim_strncpy(buf, (char_u *)p, size - 1); return FALSE; } /* cs_fgets */ @@ -386,7 +381,7 @@ cs_connection(num, dbpath, ppath) * PRIVATE: cs_add * * add cscope database or a directory name (to look for cscope.out) - * the the cscope connection list + * to the cscope connection list * * MAXPATHL 256 */ @@ -966,7 +961,7 @@ cs_find(eap) } pat = opt + strlen(opt) + 1; - if (pat == NULL || (pat != NULL && pat[0] == '\0')) + if (pat >= (char *)eap->arg + eap_arg_len) { cs_usage_msg(Find); return FALSE; @@ -1317,7 +1312,7 @@ cs_insert_filelist(fname, ppath, flags, sb) #else /* compare pathnames first */ && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME) - /* if not Windows 9x, test index file atributes too */ + /* if not Windows 9x, test index file attributes too */ || (!mch_windows95() && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh @@ -1401,6 +1396,9 @@ cs_lookup_cmd(eap) if (eap->arg == NULL) return NULL; + /* Store length of eap->arg before it gets modified by strtok(). */ + eap_arg_len = STRLEN(eap->arg); + if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL) return NULL; @@ -2195,7 +2193,7 @@ cs_reset(eap) cs_add_common(dblist[i], pplist[i], fllist[i]); if (p_csverbose) { - /* dont' use smsg_attr because want to display + /* don't use smsg_attr() because we want to display the * connection number in the same line as * "Added cscope database..." */ diff --git a/src/syntax.c b/src/syntax.c index 2cef9782..290b6be4 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -279,7 +279,8 @@ static int keepend_level = -1; */ typedef struct state_item { - int si_idx; /* index of syntax pattern */ + int si_idx; /* index of syntax pattern or + KEYWORD_IDX */ int si_id; /* highlight group ID for keywords */ int si_trans_id; /* idem, transparancy removed */ int si_m_lnum; /* lnum of the match */ @@ -837,9 +838,18 @@ syn_sync(wp, start_lnum, last_valid) current_lnum = end_lnum; break; } - spp = &(SYN_ITEMS(syn_buf)[cur_si->si_idx]); - found_flags = spp->sp_flags; - found_match_idx = spp->sp_sync_idx; + if (cur_si->si_idx < 0) + { + /* Cannot happen? */ + found_flags = 0; + found_match_idx = KEYWORD_IDX; + } + else + { + spp = &(SYN_ITEMS(syn_buf)[cur_si->si_idx]); + found_flags = spp->sp_flags; + found_match_idx = spp->sp_sync_idx; + } found_current_lnum = current_lnum; found_current_col = current_col; found_m_endpos = cur_si->si_m_endpos; @@ -2533,6 +2543,10 @@ update_si_attr(idx) stateitem_T *sip = &CUR_STATE(idx); synpat_T *spp; + /* This should not happen... */ + if (sip->si_idx < 0) + return; + spp = &(SYN_ITEMS(syn_buf)[sip->si_idx]); if (sip->si_flags & HL_MATCH) sip->si_id = spp->sp_syn_match_id; @@ -2648,6 +2662,10 @@ update_si_end(sip, startcol, force) lpos_T end_endpos; int end_idx; + /* return quickly for a keyword */ + if (sip->si_idx < 0) + return; + /* Don't update when it's already done. Can be a match of an end pattern * that started in a previous line. Watch out: can also be a "keepend" * from a containing item. */ @@ -2760,6 +2778,10 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, char_u *line; int had_match = FALSE; + /* just in case we are invoked for a keyword */ + if (idx < 0) + return; + /* * Check for being called with a START pattern. * Can happen with a match that continues to the next line, because it diff --git a/src/version.c b/src/version.c index 152c4444..100913e3 100644 --- a/src/version.c +++ b/src/version.c @@ -667,6 +667,14 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 87, +/**/ + 86, +/**/ + 85, +/**/ + 84, +/**/ 83, /**/ 82, -- 2.11.4.GIT