aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
Commit message (Collapse)AuthorAge
...
* add_pathsep(): Return false if filename is too long.cztchoice2017-01-23
| | | | References #3042
* refactor: strlcat instead of str{n}cat.cztchoice2017-01-23
| | | | | | | | | | Add xstrlcat function. Closes #3042 References #988 References #1069 coverity: 71530, 71531, 71532
* ex_cmds: Also pass correct length in windows codeZyX2017-01-23
|
* coverity/155511: Pass correct length argument to strncat()ZyX2017-01-23
|
* open_buffer(): Do `BufEnter` for directories.Justin M. Keyes2017-01-12
| | | | | | | | | | | | | | | | | | | Abuse NOTDONE to give some nuance to the return value of readfile(), so that open_buffer() can distinguish between "failed, lol" and "failed because the path is a directory". Before this change, Vim *already* creates a new buffer when a directory is edited. So there is no reason it should not raise BufEnter, that was an implementation detail of ye olde readfile(). Most of the changes in this commit merely preserve the old semantics. The "implicit" change that we actually are interested in, is this line in `open_buffer()`, where `retval` being non-FAIL allows EVENT_BUFENTER to be applied: apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval); References https://github.com/vim/vim/issues/1353
* inccommand: Suppress error reporting when previewing commandsJames McCoy2017-01-11
| | | | Closes #5912
* vim-patch:7.4.2015Shougo Matsushita2017-01-02
| | | | | | | | | | Problem: When a file gets a name when writing it 'acd' is not effective. (Dan Church) Solution: Invoke DO_AUTOCHDIR after writing the file. (Allen Haim, closes vim/vim#777, closes vim/vim#803) Add test_autochdir() to enable 'acd' before "starting" is reset. https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
* Merge pull request #5613 from jamessan/vim-7.4.2183James McCoy2017-01-01
|\ | | | | vim-patch:7.4.2183,7.4.2194,7.4.2201,7.4.2204,0952131,7.4.2215,7.4.2225,7.4.2226,7.4.2272,7.4.2273,7.4.2277,7.4.2294
| * lintJames McCoy2016-12-28
| |
| * vim-patch:7.4.2225James McCoy2016-12-28
| | | | | | | | | | | | | | Problem: Crash when placing a sign in a deleted buffer. Solution: Check for missing buffer name. (Dominique Pelle). Add a test. https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
* | vim-patch:7.4.1970 (#5850)lonerover2016-12-31
|/ | | | | | | | Problem: Using ":insert" in an empty buffer sets the jump mark. (Ingo Karkat) Solution: Don't adjust marks when replacing the empty line in an empty buffer. (closes vim/vim#892) https://github.com/vim/vim/commit/70e136e1d86ea1d795774824c7b712245912946d
* 'inccommand': Introduce CMDPREVIEW state.Justin M. Keyes2016-11-15
| | | | | | | Command "live preview" is fundamentally a non-recursive concept ("preview of a preview" is not useful). Maintaining this as a global is less awkward and closer to what we actually want to express, vs adorning exarg_T, CommandLineState, etc.
* inccommand=nosplit: Jump to first match.Justin M. Keyes2016-11-15
| | | | | | Call update_topline() to adjust the current viewport. Closes #5597
* 'inccommand': Detect "non-interactive", "too slow".Justin M. Keyes2016-11-15
| | | | | | | | | | | | | | | | | | | | | command_line_changed: - Check (current_SID == 0) instead of KeyTyped - We want to update during mappings (KeyTyped is false then). - Check vpeekc_any() - Avoids unnecessary work. - Avoids triggering live preview during macros. - Caveat: This makes the redraw "stutter" if user spams (holds a key) in the replace pattern. But that scenario is not important. - Update screen if the command is changed to a non-live command. (`s->live` goes from true => false) => clears the preview command_line_execute: - Let CTRL-C cancel live preview do_sub: - Enforce a time limit ('redrawtime'). - Unset 'inccommand' if time limit is reached. Closes #5602 Closes #5585
* 'inccommand': Simplify cursor placement logic.Justin M. Keyes2016-11-11
| | | | | Remove the inner for-loop; just use the column of the first in-line match.
* 'inccommand': buftype=nofile, restore cursor/viewJustin M. Keyes2016-11-10
| | | | | | | - Use a standard scratch buffer instead of a new 'buftype', functions like curbufIsChanged() already have special handling for scratch bufs. - Cleanup some stuff from the previous merge. - Add support for :smagic, :snomagic. Closes #5578
* Merge #5561 'inccommand'Justin M. Keyes2016-11-09
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Initial work by: Robin Elrharbi-Fleury (Robinhola) Audrey Rayé (Adrey06) Philémon Hullot (DesbyP) Aymeric Collange (aym7) Clément Guyomard (Clement0) Major revisions by: KillTheMule Björn Linse <bjorn.linse@gmail.com> Justin M. Keyes <justinkz@gmail.com>
| * 'inccommand': Preserve curbuf->b_u_newhead.Justin M. Keyes2016-11-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add tests for undotree(). Helped-by: Björn Linse <bjorn.linse@gmail.com> When "curhead" points to a valid head, the value of "newhead" is meaningless (and really should be set to null). The undo state for a buffer is _logically_ the enum: enum UndoState { CurrentHead(head), NewHead(head), EmptyTree } nvim _represents_ this as: whenever `curbuf->b_u_curhead` is nonnull it should be used as the current head, and `curbuf->b_u_newhead` is ignored. If the there is a current head, then this will be redoed on the next redo, and its parent will be undone on next undo. Only if `b_u_curhead` is NULL, `b_u_newhead` will be used as the head to undo (and it is not possible to redo). Also both can be NULL, to indicate an empty undotree. (To be fair, this only strictly true when calling undo.c from the outside, in some places _within_ a function in undo.c both values might be meaningful) Apparently `undotree()` breaks this non-abstraction, this _cosmetic_ issue can easily be fixed by `ex_substitute` also saving and restoring `b_u_newhead`, but is doesn't reflect any error really how `u_undo_and_forget` manipulates the _actual_ state of the undo tree.
| * perf: do_sub(): avoid work, avoid screen updatesJustin M. Keyes2016-11-08
| | | | | | | | | | - Don't fill matched_lines if not showing a preview (!eap->is_live). - Encapsulate: Move cursor placement logic to show_sub().
| * 'inccommand': preserve 'modified'Justin M. Keyes2016-11-08
| | | | | | | | | | During the live preview, the buffer-local 'modified' flag should not be changed.
| * 'inccommand': rename 'incsubstitute'Justin M. Keyes2016-11-08
| | | | | | | | | | | | | | | | | | 'inccommand' allows us to expand the feature to other commands, such as: :cdo :cfdo :global Also rename "IncSubstitute" highlight group to "Substitute".
| * 'inccommand': format line numbers as "|123| "Justin M. Keyes2016-11-08
| | | | | | | | This matches what Quickfix traditionally does.
| * 'inccommand': set buffer name to [Preview]Justin M. Keyes2016-11-08
| | | | | | | | | | | | [inc_sub] is less obvious for users. Also, in the future we may want to generalize the idea of a "preview buffer", or "incremental commands" besides :substitute.
| * 'inccommand': disable 'cursorline', 'spell' in previewJustin M. Keyes2016-11-08
| |
| * 'inccommand': preserve b:changedtickJustin M. Keyes2016-11-08
| |
| * lintJustin M. Keyes2016-11-08
| |
| * 'inccommand': reworkJustin M. Keyes2016-11-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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)
| * LintedKillTheMule2016-10-30
| |
| * Incsubsitution featureKillTheMule2016-10-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally implemented by * Clement0 * DesbyP * aym7 * Adrey06 * Robinhola in #4811. Major reworkings and bug fixes by * bfredl Most tests suggested by ZyX-l, suggestions for improvements by oni-link.
* | lintJustin M. Keyes2016-10-30
| |
* | ex_global: Catch CTRL-C even if it is mapped.Justin M. Keyes2016-10-30
|/ | | | | Problem: If CTRL-C is mapped, it does not interrupt :global output. Solution: clear `mapped_ctrl_c` during :global.
* Merge #5500Justin M. Keyes2016-10-26
|\ | | | | | | Closes #5246
| * Fix lint errors.Grzegorz Milka2016-10-23
| |
| * vim-patch:7.4.2312Grzegorz Milka2016-10-23
| | | | | | | | | | | | | | | | Problem: Crash when autocommand moves to another tab. (Dominique Pelle) Solution: When navigating to another window halfway the :edit command go back to the right window. https://github.com/vim/vim/commit/5a49789a9b1f6447aeafbbbdd5b235dd10c471d5
* | vim-patch:7.4.2128 (#5517)Michael Ennen2016-10-26
|/ | | | | | Problem: Memory leak when saving for undo fails. Solution: Free allocated memory. (Hirohito Higashi) https://github.com/vim/vim/commit/1e2258297bb31720bfbeb234f2dae4d1b3b04fbd
* main.c: "BufReadCmd term://": Skip existing terminal.Justin M. Keyes2016-10-12
| | | | | | | | | Check `exists('b:term_title')` to avoid the BufReadCmd for already-initialized :terminal buffers. Move the test for `:argadd`. Add a test for `:edit<CR>`. Tweak comments and code style.
* terminal: Move re-edit detection to do_ecmd(). #5445Harm te Hennepe2016-10-12
| | | | Closes #4784
* doc: minor comment tweaksJustin M. Keyes2016-09-28
|
* vim-patch 7.4.1266Michael Ennen2016-09-18
| | | | | | | | Problem: A BufAdd autocommand may cause an ml_get error (Christian Brabandt) Solution: Increment RedrawingDisabled earlier. https://github.com/vim/vim/commit/ab9fc7e0cf22bcee119b62d3433cac60f405e645
* vim-patch:7.4.1913 (#5260)Jurica Bradarić2016-09-04
| | | | | | | Problem: When ":doautocmd" is used modelines are used even when no autocommands were executed. (Daniel Hahler) Solution: Skip processing modelines. (closes vim/vim#854) https://github.com/vim/vim/commit/1610d052413e0ed664498853a47acc2d677a22d1
* vim-patch:7.4.1900 (#5259)Jurica Bradarić2016-09-04
| | | | | | Problem: Using CTRL-] in the help on "{address}." doesn't work. Solution: Recognize an item in {}. (Hirohito Higashi, closes vim/vim#814) https://github.com/vim/vim/commit/28b942a064dd486cc241894b625ab72f5a5c6d1b
* perf: Disable clipboard in do_cmdline().Justin M. Keyes2016-08-25
| | | | | | | | | | | For any script--not just `:global` commands--there is no reason to update the system clipboard until the script is finished, so disable it during do_cmdline(). Before this change, 'clipboard=unnamedplus' causes scripted editing to be extremely slow (e.g. `:normal` in a while-loop). Closes #3534
* ops.c: Rename start_global_changes().Justin M. Keyes2016-08-25
|
* ex_cmds: Factor pieces of functionality out of do_subJames McCoy2016-08-20
| | | | | | | | | * sub_joining_lines: Optimization for :%s/\n// * sub_grow_buf: Allocation of buffer to contain replacement text * sub_parse_flags: Parse {flags} from :s command into subflags_T Although this doesn't reduce do_sub's size enough to satisfy lint, it covers the more straightforward pieces.
* lintJames McCoy2016-08-20
|
* vim-patch:7.4.2219James McCoy2016-08-20
| | | | | | | | | | | Problem: Recursive call to substitute gets stuck in sandbox. (Nikolai Pavlov) Solution: Handle the recursive call. (Christian Brabandt, closes vim/vim#950) Add a test. https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa Closes #5118
* coverity/150263: s/STRCPY/STRLCPY/, bounds check (#5036)J Phani Mahesh2016-07-20
|
* lintJames McCoy2016-07-08
|
* vim-patch:7.4.1551James McCoy2016-07-08
| | | | | | | Problem: Cannot generate help tags in all doc directories. Solution: Make ":helptags ALL" work. https://github.com/vim/vim/commit/6bef5306e4f2cacb3a93667992c2312d4b293c9d
* os/fs: Rename os_file_exists to os_path_exists (#4973)Daniel Xu2016-07-06
| | | | Because the old name did not indicate that the function would return true on directories as well.