diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-10-31 03:50:19 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-11-08 21:20:08 +0100 |
commit | c04ffe866d276d6a6bd9e9c6a8b0dbb71504db7c (patch) | |
tree | 0fca258fbfb83cb871a493916d9dd6e0ef1195c3 /src/nvim/ex_getln.c | |
parent | e8c0f909626094350be7ee7b524697804da38dc1 (diff) | |
download | rneovim-c04ffe866d276d6a6bd9e9c6a8b0dbb71504db7c.tar.gz rneovim-c04ffe866d276d6a6bd9e9c6a8b0dbb71504db7c.tar.bz2 rneovim-c04ffe866d276d6a6bd9e9c6a8b0dbb71504db7c.zip |
'inccommand': rework
- Eliminate/isolate static/global variables
- Remove special-case parameter from buflist_new()
- Remove special-case ECMD_RESERVED_BUFNR
- To determine when u_undo_and_forget() should be done, check
b_changedtick instead of a heuristic.
- use mb_string2cells() instead of strlen() to measure the :sub patterns
- call ml_close() before buf_clear_file(). Avoids leaks caught by ASan.
Original patch by:
Robin Elrharbi-Fleury (Robinhola)
Audrey Rayé (Adrey06)
Philémon Hullot (DesbyP)
Aymeric Collange (aym7)
Clément Guyomard (Clement0)
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index d1a2ab8bcf..dba7a107e2 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1591,9 +1591,12 @@ static int command_line_changed(CommandLineState *s) msg_starthere(); redrawcmdline(); s->did_incsearch = true; - } else if (*p_ics != NUL && s->firstc == ':' && is_live(ccline.cmdbuff)) { - // compute a live action - do_cmdline(ccline.cmdbuff, NULL, NULL, DOCMD_KEEPLINE|DOCMD_LIVE_PREVIEW); + } else if (s->firstc == ':' + && *p_ics != NUL // 'incsubstitute' is set + && cmdline_star == 0 // not typing a password + && cmd_is_live(ccline.cmdbuff)) { + // process a "live" command + do_cmdline(ccline.cmdbuff, NULL, NULL, DOCMD_KEEPLINE|DOCMD_LIVE); redrawcmdline(); } @@ -5141,16 +5144,12 @@ static int ex_window(void) } cmdwin_type = get_cmdline_type(); - /* Create the command-line buffer empty. */ - (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL); - (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE); - set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL); - set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); - curbuf->b_p_ma = TRUE; - curwin->w_p_fen = FALSE; + // Create empty command-line buffer. + buf_open_special(0, "[Command Line]", "nofile"); curwin->w_p_rl = cmdmsg_rl; - cmdmsg_rl = FALSE; - RESET_BINDING(curwin); + cmdmsg_rl = false; + curbuf->b_p_ma = true; + curwin->w_p_fen = false; /* Do execute autocommands for setting the filetype (load syntax). */ unblock_autocmds(); |