From d2bd8040ce05cdbd6147189574ba999e6a7f9b78 Mon Sep 17 00:00:00 2001 From: edyfox Date: Fri, 10 Jul 2009 03:08:02 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1556 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- runtime/doc/if_cscop.txt | 9 +--- runtime/doc/various.txt | 11 +++++ src/edit.c | 9 +++- src/ex_cmds.c | 3 ++ src/ex_cmds.h | 2 + src/ex_docmd.c | 27 +++++++---- src/getchar.c | 13 ++++-- src/if_cscope.c | 116 +++++++++++++++++++++++++---------------------- src/if_cscope.h | 1 - src/if_mzsch.c | 4 +- src/if_perl.xs | 3 +- src/if_python.c | 5 +- src/misc1.c | 16 +++++-- src/structs.h | 2 + src/version.c | 12 +++++ 15 files changed, 145 insertions(+), 88 deletions(-) diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index 94d39782..3d98e4a1 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -355,13 +355,8 @@ cscope version for Win32 see: The DJGPP-built version from http://cscope.sourceforge.net is known to not work with Vim. -There are a couple of hard-coded limitations: - - 1. The maximum number of cscope connections allowed is 8. Do you - really need more? - - 2. Doing a |:tjump| when |:cstag| searches the tag files is not - configurable (e.g., you can't do a tselect instead). +Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files +is not configurable (e.g., you can't do a tselect instead). ============================================================================== 6. Suggested usage *cscope-suggestions* diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index cf4b0c6b..ffb9f268 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -508,6 +508,17 @@ N *+X11* Unix only: can restore window title |X11| messages though. Use ":silent" in the command itself to avoid that: ":silent menu .... :silent command". + *:uns* *:unsilent* +:uns[ilent] {command} Execute {command} not silently. Only makes a + difference when |:silent| was used to get to this + command. + Use this for giving a message even when |:silent| was + used. In this example |:silent| is used to avoid the + message about reading the file and |:unsilent| to be + able to list the first line of each file. > + :silent argdo unsilent echo expand('%') . ": " . getline(1) +< + *:verb* *:verbose* :[count]verb[ose] {command} Execute {command} with 'verbose' set to [count]. If diff --git a/src/edit.c b/src/edit.c index c1935c21..347571f4 100644 --- a/src/edit.c +++ b/src/edit.c @@ -114,6 +114,10 @@ static int compl_restarting = FALSE; /* don't insert match */ * FALSE the word to be completed must be located. */ static int compl_started = FALSE; +/* Set when doing something for completion that may call edit() recursively, + * which is not allowed. */ +static int compl_busy = FALSE; + static int compl_matches = 0; static char_u *compl_pattern = NULL; static int compl_direction = FORWARD; @@ -346,7 +350,7 @@ edit(cmdchar, startln, count) #ifdef FEAT_INS_EXPAND /* Don't allow recursive insert mode when busy with completion. */ - if (compl_started || pum_visible()) + if (compl_started || compl_busy || pum_visible()) { EMSG(_(e_secure)); return FALSE; @@ -1340,8 +1344,10 @@ doESCkey: goto normalchar; docomplete: + compl_busy = TRUE; if (ins_complete(c) == FAIL) compl_cont_status = 0; + compl_busy = FALSE; break; #endif /* FEAT_INS_EXPAND */ @@ -3172,6 +3178,7 @@ ins_compl_free() vim_free(match); } while (compl_curr_match != NULL && compl_curr_match != compl_first_match); compl_first_match = compl_curr_match = NULL; + compl_shown_match = NULL; } static void diff --git a/src/ex_cmds.c b/src/ex_cmds.c index fabb2e76..68627a57 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -4013,6 +4013,9 @@ ex_change(eap) break; ml_delete(eap->line1, FALSE); } + + /* make sure the cursor is not beyond the end of the file now */ + check_cursor_lnum(); deleted_lines_mark(eap->line1, (long)(eap->line2 - lnum)); /* ":append" on the line above the deleted lines. */ diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 49167505..bf66b406 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -991,6 +991,8 @@ EX(CMD_unmap, "unmap", ex_unmap, BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), EX(CMD_unmenu, "unmenu", ex_menu, BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), +EX(CMD_unsilent, "unsilent", ex_wrongmodifier, + NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), EX(CMD_update, "update", ex_update, RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR), EX(CMD_vglobal, "vglobal", ex_global, diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 47c460ce..2bdf0c7f 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1677,8 +1677,8 @@ do_one_cmd(cmdlinep, sourcing, char_u *errormsg = NULL; /* error message */ exarg_T ea; /* Ex command arguments */ long verbose_save = -1; - int save_msg_scroll = 0; - int did_silent = 0; + int save_msg_scroll = msg_scroll; + int save_msg_silent = -1; int did_esilent = 0; #ifdef HAVE_SANDBOX int did_sandbox = FALSE; @@ -1856,9 +1856,9 @@ do_one_cmd(cmdlinep, sourcing, } if (!checkforcmd(&ea.cmd, "silent", 3)) break; - ++did_silent; + if (save_msg_silent == -1) + save_msg_silent = msg_silent; ++msg_silent; - save_msg_scroll = msg_scroll; if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1])) { /* ":silent!", but not "silent !cmd" */ @@ -1886,6 +1886,13 @@ do_one_cmd(cmdlinep, sourcing, #endif continue; + case 'u': if (!checkforcmd(&ea.cmd, "unsilent", 3)) + break; + if (save_msg_silent == -1) + save_msg_silent = msg_silent; + msg_silent = 0; + continue; + case 'v': if (checkforcmd(&ea.cmd, "vertical", 4)) { #ifdef FEAT_VERTSPLIT @@ -2684,13 +2691,12 @@ doend: cmdmod = save_cmdmod; - if (did_silent > 0) + if (save_msg_silent != -1) { /* messages could be enabled for a serious error, need to check if the * counters don't become negative */ - msg_silent -= did_silent; - if (msg_silent < 0) - msg_silent = 0; + if (!did_emsg) + msg_silent = save_msg_silent; emsg_silent -= did_esilent; if (emsg_silent < 0) emsg_silent = 0; @@ -2987,6 +2993,7 @@ static struct cmdmod {"silent", 3, FALSE}, {"tab", 3, TRUE}, {"topleft", 2, FALSE}, + {"unsilent", 3, FALSE}, {"verbose", 4, TRUE}, {"vertical", 4, FALSE}, }; @@ -7838,10 +7845,10 @@ ex_read(eap) if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK) { ml_delete(lnum, FALSE); - deleted_lines_mark(lnum, 1L); if (curwin->w_cursor.lnum > 1 && curwin->w_cursor.lnum >= lnum) --curwin->w_cursor.lnum; + deleted_lines_mark(lnum, 1L); } } redraw_curbuf_later(VALID); @@ -7957,7 +7964,7 @@ ex_cd(eap) shorten_fnames(TRUE); /* Echo the new current directory if the command was typed. */ - if (KeyTyped) + if (KeyTyped || p_verbose >= 5) ex_pwd(eap); } vim_free(tofree); diff --git a/src/getchar.c b/src/getchar.c index 0947f35f..e050601c 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1309,6 +1309,9 @@ save_typebuf() return OK; } +static int old_char = -1; /* character put back by vungetc() */ +static int old_mod_mask; /* mod_mask for ungotten character */ + #if defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) || defined(PROTO) /* @@ -1323,6 +1326,10 @@ save_typeahead(tp) if (!tp->typebuf_valid) typebuf = tp->save_typebuf; + tp->old_char = old_char; + tp->old_mod_mask = old_mod_mask; + old_char = -1; + tp->save_stuffbuff = stuffbuff; stuffbuff.bh_first.b_next = NULL; # ifdef USE_INPUT_BUF @@ -1344,6 +1351,9 @@ restore_typeahead(tp) typebuf = tp->save_typebuf; } + old_char = tp->old_char; + old_mod_mask = tp->old_mod_mask; + free_buff(&stuffbuff); stuffbuff = tp->save_stuffbuff; # ifdef USE_INPUT_BUF @@ -1499,9 +1509,6 @@ updatescript(c) #define KL_PART_KEY -1 /* keylen value for incomplete key-code */ #define KL_PART_MAP -2 /* keylen value for incomplete mapping */ -static int old_char = -1; /* character put back by vungetc() */ -static int old_mod_mask; /* mod_mask for ungotten character */ - /* * Get the next input character. * Can return a special key or a multi-byte character. diff --git a/src/if_cscope.c b/src/if_cscope.c index c11fc2ac..bd90eca8 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -46,7 +46,6 @@ static void cs_fill_results __ARGS((char *, int , int *, char ***, static int cs_find __ARGS((exarg_T *eap)); static int cs_find_common __ARGS((char *opt, char *pat, int, int, int)); static int cs_help __ARGS((exarg_T *eap)); -static void cs_init __ARGS((void)); static void clear_csinfo __ARGS((int i)); static int cs_insert_filelist __ARGS((char *, char *, char *, struct stat *)); @@ -66,7 +65,10 @@ static char * cs_resolve_file __ARGS((int, char *)); static int cs_show __ARGS((exarg_T *eap)); -static csinfo_T csinfo[CSCOPE_MAX_CONNECTIONS]; +static csinfo_T * csinfo = NULL; +static int csinfo_size = 0; /* number of items allocated in + csinfo[] */ + static int eap_arg_len; /* length of eap->arg, set in cs_lookup_cmd() */ static cscmd_T cs_cmds[] = @@ -144,23 +146,20 @@ get_cscope_name(xp, idx) } case EXP_CSCOPE_KILL: { - static char_u connection[2]; + static char connection[5]; /* ":cscope kill" accepts connection numbers or partial names of * the pathname of the cscope database as argument. Only complete * with connection numbers. -1 can also be used to kill all * connections. */ - for (i = 0, current_idx = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0, current_idx = 0; i < csinfo_size; i++) { if (csinfo[i].fname == NULL) continue; if (current_idx++ == idx) { - /* Connection number fits in one character since - * CSCOPE_MAX_CONNECTIONS is < 10 */ - connection[0] = i + '0'; - connection[1] = NUL; - return connection; + vim_snprintf(connection, sizeof(connection), "%d", i); + return (char_u *)connection; } } return (current_idx == idx && idx > 0) ? (char_u *)"-1" : NULL; @@ -223,7 +222,6 @@ do_cscope_general(eap, make_split) { cscmd_T *cmdp; - cs_init(); if ((cmdp = cs_lookup_cmd(eap)) == NULL) { cs_help(eap); @@ -284,8 +282,6 @@ do_cstag(eap) { int ret = FALSE; - cs_init(); - if (*eap->arg == NUL) { (void)EMSG(_("E562: Usage: cstag ")); @@ -441,7 +437,7 @@ cs_connection(num, dbpath, ppath) if (num < 0 || num > 4 || (num > 0 && !dbpath)) return FALSE; - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (!csinfo[i].fname) continue; @@ -684,7 +680,7 @@ cs_cnt_connections() short i; short cnt = 0; - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (csinfo[i].fname != NULL) cnt++; @@ -1112,7 +1108,8 @@ cs_find_common(opt, pat, forceit, verbose, use_ll) { int i; char *cmd; - int nummatches[CSCOPE_MAX_CONNECTIONS], totmatches; + int *nummatches; + int totmatches; #ifdef FEAT_QUICKFIX char cmdletter; char *qfpos; @@ -1123,13 +1120,17 @@ cs_find_common(opt, pat, forceit, verbose, use_ll) if (cmd == NULL) return FALSE; + nummatches = (int *)alloc(sizeof(int)*csinfo_size); + if (nummatches == NULL) + return FALSE; + /* send query to all open connections, then count the total number * of matches so we can alloc matchesp all in one swell foop */ - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) nummatches[i] = 0; totmatches = 0; - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (csinfo[i].fname == NULL || csinfo[i].to_fp == NULL) continue; @@ -1154,7 +1155,10 @@ cs_find_common(opt, pat, forceit, verbose, use_ll) char *buf; if (!verbose) + { + vim_free(nummatches); return FALSE; + } buf = (char *)alloc((unsigned)(strlen(opt) + strlen(pat) + strlen(nf))); if (buf == NULL) @@ -1165,6 +1169,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll) (void)EMSG(buf); vim_free(buf); } + vim_free(nummatches); return FALSE; } @@ -1217,6 +1222,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll) (void)EMSG(buf); vim_free(buf); } + vim_free(nummatches); return FALSE; } } @@ -1264,6 +1270,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll) } mch_remove(tmp); vim_free(tmp); + vim_free(nummatches); return TRUE; } else @@ -1275,6 +1282,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll) /* read output */ cs_fill_results((char *)pat, totmatches, nummatches, &matches, &contexts, &matched); + vim_free(nummatches); if (matches == NULL) return FALSE; @@ -1328,26 +1336,6 @@ cs_help(eap) } /* cs_help */ -/* - * PRIVATE: cs_init - * - * initialize cscope structure if not already - */ - static void -cs_init() -{ - short i; - static int init_already = FALSE; - - if (init_already) - return; - - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) - clear_csinfo(i); - - init_already = TRUE; -} /* cs_init */ - static void clear_csinfo(i) int i; @@ -1444,7 +1432,7 @@ cs_insert_filelist(fname, ppath, flags, sb) #endif i = -1; /* can be set to the index of an empty item in csinfo */ - for (j = 0; j < CSCOPE_MAX_CONNECTIONS; j++) + for (j = 0; j < csinfo_size; j++) { if (csinfo[j].fname != NULL #if defined(UNIX) @@ -1471,9 +1459,25 @@ cs_insert_filelist(fname, ppath, flags, sb) if (i == -1) { - if (p_csverbose) - (void)EMSG(_("E569: maximum number of cscope connections reached")); - return -1; + i = csinfo_size; + if (csinfo_size == 0) + { + /* First time allocation: allocate only 1 connection. It should + * be enough for most users. If more is needed, csinfo will be + * reallocated. */ + csinfo_size = 1; + csinfo = (csinfo_T *)alloc_clear(sizeof(csinfo_T)); + } + else + { + /* Reallocate space for more connections. */ + csinfo_size *= 2; + csinfo = vim_realloc(csinfo, sizeof(csinfo_T)*csinfo_size); + } + if (csinfo == NULL) + return -1; + for (j = csinfo_size/2; j < csinfo_size; j++) + clear_csinfo(j); } if ((csinfo[i].fname = (char *)alloc((unsigned)strlen(fname)+1)) == NULL) @@ -1580,15 +1584,14 @@ cs_kill(eap) /* It must be part of a name. We will try to find a match * within all the names in the csinfo data structure */ - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (csinfo[i].fname != NULL && strstr(csinfo[i].fname, stok)) break; } } - if ((i >= CSCOPE_MAX_CONNECTIONS || i < -1 || csinfo[i].fname == NULL) - && i != -1) + if ((i != -1) && (i >= csinfo_size || i < -1 || csinfo[i].fname == NULL)) { if (p_csverbose) (void)EMSG2(_("E261: cscope connection %s not found"), stok); @@ -1597,7 +1600,7 @@ cs_kill(eap) { if (i == -1) { - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (csinfo[i].fname) cs_kill_execute(i, csinfo[i].fname); @@ -1857,7 +1860,7 @@ cs_file_results(f, nummatches_a) if (buf == NULL) return; - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (nummatches_a[i] < 1) continue; @@ -1929,7 +1932,7 @@ cs_fill_results(tagstr, totmatches, nummatches_a, matches_p, cntxts_p, matched) if ((cntxts = (char **)alloc(sizeof(char *) * totmatches)) == NULL) goto parse_out; - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (nummatches_a[i] < 1) continue; @@ -2383,10 +2386,13 @@ cs_reset(eap) int i; char buf[20]; /* for sprintf " (#%d)" */ + if (csinfo_size == 0) + return CSCOPE_SUCCESS; + /* malloc our db and ppath list */ - dblist = (char **)alloc(CSCOPE_MAX_CONNECTIONS * sizeof(char *)); - pplist = (char **)alloc(CSCOPE_MAX_CONNECTIONS * sizeof(char *)); - fllist = (char **)alloc(CSCOPE_MAX_CONNECTIONS * sizeof(char *)); + dblist = (char **)alloc(csinfo_size * sizeof(char *)); + pplist = (char **)alloc(csinfo_size * sizeof(char *)); + fllist = (char **)alloc(csinfo_size * sizeof(char *)); if (dblist == NULL || pplist == NULL || fllist == NULL) { vim_free(dblist); @@ -2395,7 +2401,7 @@ cs_reset(eap) return CSCOPE_FAILURE; } - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { dblist[i] = csinfo[i].fname; pplist[i] = csinfo[i].ppath; @@ -2405,7 +2411,7 @@ cs_reset(eap) } /* rebuild the cscope connection list */ - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (dblist[i] != NULL) { @@ -2502,7 +2508,7 @@ cs_show(eap) MSG_PUTS_ATTR( _(" # pid database name prepend path\n"), hl_attr(HLF_T)); - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) { if (csinfo[i].fname == NULL) continue; @@ -2531,8 +2537,10 @@ cs_end() { int i; - for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++) + for (i = 0; i < csinfo_size; i++) cs_release_csp(i, TRUE); + vim_free(csinfo); + csinfo_size = 0; } #endif /* FEAT_CSCOPE */ diff --git a/src/if_cscope.h b/src/if_cscope.h index 89b69f7c..5620eb3a 100644 --- a/src/if_cscope.h +++ b/src/if_cscope.h @@ -25,7 +25,6 @@ #define CSCOPE_SUCCESS 0 #define CSCOPE_FAILURE -1 -#define CSCOPE_MAX_CONNECTIONS 8 /* you actually need more? */ #define CSCOPE_DBFILE "cscope.out" #define CSCOPE_PROMPT ">> " diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 1658fe43..bc3dd6bf 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -2169,9 +2169,9 @@ set_buffer_line(void *data, int argc, Scheme_Object **argv) curbuf = savebuf; raise_vim_exn(_("cannot delete line")); } - deleted_lines_mark((linenr_T)n, 1L); if (buf->buf == curwin->w_buffer) mz_fix_cursor(n, n + 1, -1); + deleted_lines_mark((linenr_T)n, 1L); curbuf = savebuf; @@ -2299,9 +2299,9 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) curbuf = savebuf; raise_vim_exn(_("cannot delete line")); } - deleted_lines_mark((linenr_T)lo, (long)old_len); if (buf->buf == curwin->w_buffer) mz_fix_cursor(lo, hi, -old_len); + deleted_lines_mark((linenr_T)lo, (long)old_len); } curbuf = savebuf; diff --git a/src/if_perl.xs b/src/if_perl.xs index d3449382..a589f8fd 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -1233,9 +1233,8 @@ Delete(vimbuf, ...) if (u_savedel(lnum, 1) == OK) { ml_delete(lnum, 0); + check_cursor(); deleted_lines_mark(lnum, 1L); - if (aco.save_curbuf == curbuf) - check_cursor(); } /* restore curwin/curbuf and a few other things */ diff --git a/src/if_python.c b/src/if_python.c index ce9bb3ee..e483bfc8 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -2497,9 +2497,9 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) PyErr_SetVim(_("cannot delete line")); else { - deleted_lines_mark((linenr_T)n, 1L); if (buf == curwin->w_buffer) py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1); + deleted_lines_mark((linenr_T)n, 1L); } curbuf = savebuf; @@ -2596,10 +2596,9 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha break; } } - deleted_lines_mark((linenr_T)lo, (long)i); - if (buf == curwin->w_buffer) py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n); + deleted_lines_mark((linenr_T)lo, (long)i); } curbuf = savebuf; diff --git a/src/misc1.c b/src/misc1.c index 03b638da..39669b4c 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -2345,12 +2345,13 @@ del_lines(nlines, undo) int undo; /* if TRUE, prepare for undo */ { long n; + linenr_T first = curwin->w_cursor.lnum; if (nlines <= 0) return; /* save the deleted lines for undo */ - if (undo && u_savedel(curwin->w_cursor.lnum, nlines) == FAIL) + if (undo && u_savedel(first, nlines) == FAIL) return; for (n = 0; n < nlines; ) @@ -2358,18 +2359,21 @@ del_lines(nlines, undo) if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */ break; - ml_delete(curwin->w_cursor.lnum, TRUE); + ml_delete(first, TRUE); ++n; /* If we delete the last line in the file, stop */ - if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) + if (first > curbuf->b_ml.ml_line_count) break; } - /* adjust marks, mark the buffer as changed and prepare for displaying */ - deleted_lines_mark(curwin->w_cursor.lnum, n); + /* Correct the cursor position before calling deleted_lines_mark(), it may + * trigger a callback to display the cursor. */ curwin->w_cursor.col = 0; check_cursor_lnum(); + + /* adjust marks, mark the buffer as changed and prepare for displaying */ + deleted_lines_mark(first, n); } int @@ -2621,6 +2625,8 @@ deleted_lines(lnum, count) /* * Like deleted_lines(), but adjust marks first. + * Make sure the cursor is on a valid line before calling, a GUI callback may + * be triggered to display the cursor. */ void deleted_lines_mark(lnum, count) diff --git a/src/structs.h b/src/structs.h index 6d6c1d83..658e098e 100644 --- a/src/structs.h +++ b/src/structs.h @@ -882,6 +882,8 @@ typedef struct { typebuf_T save_typebuf; int typebuf_valid; /* TRUE when save_typebuf valid */ + int old_char; + int old_mod_mask; struct buffheader save_stuffbuff; #ifdef USE_INPUT_BUF char_u *save_inputbuf; diff --git a/src/version.c b/src/version.c index 3a952425..250bf2d8 100644 --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,18 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 228, +/**/ + 227, +/**/ + 226, +/**/ + 225, +/**/ + 224, +/**/ + 223, +/**/ 222, /**/ 221, -- 2.11.4.GIT