aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
Commit message (Collapse)AuthorAge
...
* lintJames McCoy2017-03-11
|
* vim-patch:7.4.2101James McCoy2017-03-11
| | | | | | | Problem: Looping over windows, buffers and tab pages is inconsistant. Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
* Merge #6112 from ZyX-I/split-eval'/buf_get_changedtickJustin M. Keyes2017-02-27
|\ | | | | Better b:changedtick support
| * buffer: Bind b:changedtick to b:['changedtick'], remove special casesZyX2017-02-23
| |
* | Merge #6111 from ZyX-I/split-eval'/os-fileioJustin M. Keyes2017-02-27
|\ \ | |/ |/| Refactor writefile() and create more tests for it
| * eval: writefile: Give more adequate IO errors and do not call putc()ZyX2017-02-14
| |
* | *: Partial string handling refactoringZyX2017-02-15
|/ | | | | | | | Main points: - Replace `char_u` with `char` in some cases. - Remove `str[len] = NUL` hack in some cases when `str` may be considered `const`.
* vim-patch:7.4.2106lonerover2017-02-07
| | | | | | | Problem: Clang warns about missing field in initializer. Solution: Define COMMA and use it. (Kazunobu Kuriyama) https://github.com/vim/vim/commit/ac77aec4daea8d73468fcf4690cb4ccab1d807ed
* vim-patch:7.4.2024Marco Hinz2017-02-04
| | | | | | | | | | Problem: More buf_valid() calls can be optimized. Solution: Use bufref_valid() instead. NOTE: Some changes related to channels and the Python and Netbeans interfaces were obviously left out. https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
* vim-patch:7.4.2021Marco Hinz2017-02-04
| | | | | | | Problem: Still too many buf_valid() calls. Solution: Make au_new_curbuf a bufref. Use bufref_valid() in more places. https://github.com/vim/vim/commit/19ff9bf454b7492be64dd87aaf0830fa7961871e
* refactor: Remove strncpy/STRNCPY. (#6008)Justin M. Keyes2017-01-26
| | | | | | | | | | | | | | | Closes #731 References #851 Note: This does not remove some intentional legacy usages of strncpy. - memcpy isn't equivalent because it doesn't check the string length of `src`, and doesn't zero-out the remainder of `dst`. - xstrlcpy isn't equivalent because it doesn't zero-out the remainder of `dst`. Some Vim logic depends on that (e.g. ex_append which calls vim_strnsave). Helped-by: Douglas Schneider <ds3@ualberta.ca> Helped-by: oni-link <knil.ino@gmail.com> Helped-by: James McCoy <jamessan@jamessan.com>
* coverity/155512: Pass correct length to strncat()Justin M. Keyes2017-01-23
| | | | References 8bc2bffda94bf2de4e8adae57b4b5597ed4e8247
* errors: Introduce "E856: Filename too long"Justin M. Keyes2017-01-23
|
* 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