aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
Commit message (Collapse)AuthorAge
...
* ex_getln: Extract local variables from getcmdline() and fix code styleThiago de Arruda2015-10-26
| | | | | | | | Begin refactoring getcmdline() into a state that can be managed by the `state_enter()`: - Move local variables into a local CommandLineState structure - Fix code style in the entire function.
* main: Extract `normal_check` from `main_loop`Thiago de Arruda2015-10-26
| | | | | | The new function contains logic that must be executed after handling input in normal mode and also before the first main loop iteration. Also rename `main_loop` to `normal_enter` and move it to normal.c
* vim-patch:7.4.793Johan Klokkhammer Helsing2015-10-18
| | | | | | | Problem: Can't specify when not to ring the bell. Solution: Add the 'belloff' option. (Christian Brabandt) https://github.com/vim/vim/commit/165bc69d1b7f70ca9d5b657f35d0584ecb7b5183
* ex_getln: Fix memory leak when overwriting history itemZyX2015-10-08
|
* *: Fix lint errors found in new code in previously ignored filesZyX2015-10-08
|
* ex_getln: Return something from hist_type2char without assertsZyX2015-10-08
| | | | | Otherwise QuickBuild shows a warning that control may reach end of non-void function.
* *: Make ShaDa code use VimL values for additional_\* dataZyX2015-10-08
|
* shada: Initial support for merging historyZyX2015-10-08
| | | | Currently only merges history when reading ShaDa file. No tests yet.
* viminfo: First version of ShaDa file dumpingZyX2015-10-08
| | | | | | | | | | | | | | | | | | | | What works: 1. ShaDa file dumping: header, registers, jump list, history, search patterns, substitute strings, variables. 2. ShaDa file reading: registers, global marks, variables. Most was not tested. TODO: 1. Merging. 2. Reading history, local marks, jump and buffer lists. 3. Documentation update. 4. Converting some data from &encoding. 5. Safer variant of dumping viminfo (dump to temporary file then rename). 6. Removing old viminfo code (currently masked with `#if 0` in a ShaDa file for reference).
* tui: Don't use 'pastetoggle' for automatic pastingThiago de Arruda2015-10-01
| | | | | | | Add a new special key that can be used by UIs to toggle the 'paste' option and use it in the TUI instead of the user's 'pastetoggle' value. Close #2843 #2092
* path.c: Fix memory leak in expand_wildcards().oni-link2015-09-09
| | | | | | A file that matches with one of the patterns in 'wildignore' is ignored when using expand_wildcards(). After removing ignored files, the array of (file name) matches can be empty. But an empty array is never freed.
* event: Refactor async event processingThiago de Arruda2015-08-13
| | | | | | | | | | - Improve the implementation of deferred/immediate events. - Use the new queue module to change how/when events are queued/processed by giving a private queue to each emitter. - Immediate events(which only exist to break uv_run recursion) are now represented in the `loop->fast_events` queue. - Events pushed to child queues are propagated to the event loop main queue and processed as K_EVENT keys.
* loop: Simplify loop.c and move some code to input.cThiago de Arruda2015-08-13
| | | | | | - Declare poll timer in Loop structure instead of a loop_poll_events local variable. - Move deferred event management to input.c
* event loop: New abstraction layer with refactored time/signal APIThiago de Arruda2015-07-17
| | | | | | | | | | - Add event loop abstraction module under src/nvim/event. The src/nvim/event/loop module replaces src/nvim/os/event - Remove direct dependency on libuv signal/timer API and use the new abstraction instead. - Replace all references to uv_default_loop() by &loop.uv, a new global variable that wraps libuv main event loop but allows the event loop functions to be reused in other contexts.
* Remove char_u: add_pathsep()Mark Bainter2015-05-06
|
* vim-patch:7.4.542Felipe Morales2015-04-28
| | | | | | | | | | Problem: Using a range for window and buffer commands has a few problems. Cannot specify the type of range for a user command. Solution: Add the -addr argument for user commands. Fix problems. (Marcin Szamotulski https://code.google.com/p/vim/source/detail?name=v7-4-542
* Fix warnings: ex_getln.c: getexmodeline(): HI.Eliseo Martínez2015-04-27
| | | | | | | | | Problem : Dead increment @ 1795. Diagnostic : Harmless issue. Rationale : Line was necessary before (indent was used by the following while loop), but now that loop is removed, assignment is indeed dead. Resolution : Remove line.
* Fix warnings: ex_getln.c: init_history(): Nonnull attr passed null: HI.Eliseo Martínez2015-04-27
| | | | | | | | | | | Problem : Argument with 'nonnull' attribute passed null @ 4227. Diagnostic : Harmless issue. Rationale : It's true we're calling memset with NULL pointer, but it's also true we're doing it with zero size. We just thought that would work and do nothing (it was a way of avoiding to add a guard). It doesn't work, though, as memset requires nonnull arguments. Resolution : Add guard to avoid null argument.
* ex_getln: Fixes for some problems with getexmodeline()oni-link2015-04-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problems with line-input editing commands in Ex mode ('nvim -e' or 'Q' in normal mode): CTRL_U: Only after the next keystroke the complete line change is shown if the indentation was not 0. : asdfCTRL_U CTRL_T: Memory reallocation with ga_grows() before a memmove(), but pointers into the memory are not updated. :set sw=40 :CTRL_T ... Should complain about a memory error. CTRL_D: Trying to reduce an indentation of 0. :set sw=1 :CTRL_D Segfault Helped-by: Scott Prager <splinterofchaos@gmail.com>
* Replace vim_isspace() with ascii_isspace() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* Merge #2491: Fix xfree of static value from vim_getenv() refactor.Eliseo Martínez2015-04-23
|\ | | | | | | Reviewed-by: Eliseo Martínez <eliseomarmol@gmail.com>
| * Fix xfree of static value in expand_shellcmd()Mark Bainter2015-04-23
| | | | | | | | | | | | | | | | The refactoring of vim_getenv() to remove the mustfree arg included reworking calling functions. expand_shellcmd was also using that to track its usage of the variable within the function, resulting in #2487. This change addresses that scenario and cleans up some of the function for style.
* | Fix warnings: ex_getln.c: init_history(): NP dereference: FP.Eliseo Martínez2015-04-23
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem : Dereference of null pointer @ 4199. Diagnostic : False positive. Rationale : Suggested error path implies that newlen == 0 and newlen > hislen, which implies hislen < 0, which is impossible (hislen is always between 0 and 10000). Resolution : Refactor code. Asserting oldlen >= 0 should have sufficed, but for some reason analyzer doesn't follow implications in that case. Asserting newlen != 0 || newlen <= hislen works. But the chance has been taken to do extensive refactoring of this function, as it was difficult to understand as it was. As a result of refactoring, assert is not needed anymore, as we don't call clear_hist_entry() in refactored version. Refactor : - Rework algorithm: * Drop guard for OOM case, which can't happen now. * Drop empty/growing/shrinking cases. Simplify to always doing the same. * Perform circular array reordering in all cases (before, it only did when shrinking). * Work in batches through memcpy/memset, instead of one entry at a time, as it did before. - Inline variable declarations. - Replace `ssize_t` by `int`. - Introduce oldlen as entry value of hislen. - Add a lot of comments. Helped-by: Scott Prager <splinterofchaos@gmail.com> Helped-by: oni-link <knil.ino@gmail.com>
* Merge #2418: Remove char_u (4)Eliseo Martínez2015-04-19
|\ | | | | | | | | | | Reviewed-by: Scott Prager <splinterofchaos@gmail.com> Reviewed-by: Michael Reed <m.reed@mykolab.com> Reviewed-by: Eliseo Martínez <eliseomarmol@gmail.com>
| * Refactor get_env() to respect const qualifierMark Bainter2015-04-18
| | | | | | | | | | | | Without the casts*, the compiler rightly warns about the os_getenv losing the qualifier. This refactor adds a variable to manage this properly, and renames the original variables to increase clarity.
| * Remove char_u: vim_getenv()Mark Bainter2015-04-17
| |
* | clipboard: cleanup `valid_yank_reg` and use it for `:redir`Björn Linse2015-04-17
|/ | | | | | | This fixes missing clipboard support for `:redir` Helped-By: Michael Reed <m.reed@mykolab.com> Helped-By: Scott Prager <splinterofchaos@gmail.com>
* memory: Add `free` wrapper and refactor project to use itThiago de Arruda2015-04-13
| | | | | | We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
* Enable -Wconversion: fold.c.Eliseo Martínez2015-04-07
| | | | | | | | | | | | Refactor summary: - foldinfo_T.fi_lnum: int --> linenr_T Reorder field for optimal packing. - foldAddMarker(..., markerlen): int --> size_t * foldstartmarkerlen: int --> size_t - foldDelMarker(..., markerlen): int --> size_t * foldendmarkerlen: int --> size_t Helped-by: oni-link <knil.ino@gmail.com>
* Fix problem with coverity/105568 fix.oni-link2015-04-05
| | | | | | | | | | | | | | | The original fix 3db0a40d691c103a26ef3df74528f12d89b0fa61 does not work for more than one loop iteration, because memory allocated in the previous iteration could be reused in the current iteration. Because expand_wildcards() never reads the variables *num_file and *file before the first assignment to them, the initial values for these variables can be anything. So instead of calling expand_shellcmd() with *file = "" we set *file = NULL. That should help coverity see, that not a array-typed value is freed. Helped-by: Eliseo Martínez <eliseomarmol@gmail.com>
* Update comments for expand_wildcards functions.oni-link2015-04-05
| | | | | | | | | | | | | | | | | Be more specific in the description of mch_expand_wildcards(): This function will never free memory pointed to by its arguments. If OK is returned, *file will always point to allocated memory. *num_file is set to the number of pointers in *file. If FAIL is returned *file is set to NULL and *num_file to 0. If gen_expand_wildcards() returns FAIL, no memory allocation in this function needs to be undone. If expand_wildcards() returns FAIL, no memory allocation in this function needs to be undone. Helped-by: Eliseo Martínez <eliseomarmol@gmail.com> Helped-by: Michael Reed <m.reed@mykolab.com>
* vim-patch:7.4.324David Bürgin2015-03-30
| | | | | | | Problem: In Ex mode, cyrillic characters are not handled. (Stas Malavin) Solution: Support multi-byte characters in Ex mode. (Yukihiro Nakadaira) https://github.com/vim/vim/releases/tag/v7-4-324
* refactor: split some more functions from misc1.cbobtwinkles2015-03-24
| | | | | | | | | | | This commit pulls the some environment-variable handling functions out of misc1.c and in to os/env.c. Previously submited as #1231, this is the start of a patch series that does that work based on a more up-to-date master branch. Major tasks accomplished: - move functions and fix includes - fix clint/clang analysis warnings - correct documentation comments
* coverity/105568: Free of array-typed value: FP.Eliseo Martínez2015-03-22
| | | | | | | | | | | | | | Problem : Free of array-typed value @ 3628. Diagnostic : False positive. Rationale : expand_shell_cmd() is called with a mock value for file (*file = (char_u **)""). That means we want file to be filled with a new value. We can't use *file = NULL because that means we don't want file to be filled. Now, coverity incorrectly thinks that sentinel value is the one we are freeing up at some other later point, which is not the case. Resolution : Assert that, when we are freeing *file, its value is different than the sentinel one.
* ui: Refactor so that busy state won't be the defaultThiago de Arruda2015-03-18
| | | | | | | | | | | Even though assuming nvim is busy most times is simpler, it has a problem: A lot of unnecessary busy_start/busy_stop notifications are sent to the UI. That's because in the majority of scenarios almost no time is spent between `event_poll` calls. This restores the normal behavior which is to call busy_start only when nvim is going to perform some task that can take a significant amount of time. Also improve the usage of buffering in the TUI when changing the cursor state.
* ui: Replace cursor_{on,off} by busy_{stop,start}Thiago de Arruda2015-03-15
| | | | | | | | | | | | | | | | | | | | | | | | Switching cursor off is only necessary in two occasions: - When redrawing to avoid terminal flickering - When the editor is busy The first can now be handled by the TUI, so most calls to ui_cursor_off can be removed from the core. So, before this commit it was only necessary to switch the cursor off to notify the user that nvim was running some long operation. Now the cursor_{on,off} functions have been replaced by busy_{stop,start} which can be handled in a UI-specific way(turning the cursor off or showing a busy indicator, for example). To make things even more simpler, nvim is always busy except when waiting for user input or other asynchronous events: It automatically switches to a non-busy state when the event loop is about to be entered for more than 100 milliseconds. `ui_busy_start` can be called when its not desired to change the busy state in the event loop (As its now done by functions that perform blocking shell invocations).
* Macro cleanup: USE_ON_FLY_SCROLLMichael Reed2015-03-05
|
* refactor: Remove term modules and termcap optionsThiago de Arruda2015-02-21
| | | | | | | | | | | | | | | - Removed term.c, term.h and term_defs.h - Tests for T_* values were removed. screen.c was simplified as a consequence(the best strategy for drawing is implemented in the UI layer) - Redraw functions now call ui.c functions directly. Updates are flushed with `ui_flush()` - Removed all termcap options(they now return empty strings for compatibility) - &term/&ttybuiltin options return a constant value(nvim) - &t_Co is still available, but it mirrors t_colors directly - Remove cursor tracking from screen.c and the `screen_start` function. Now the UI is expected to maintain cursor state across any call, and reset it when resized. - Remove unused code
* ui: Remove/adapt some old code for a big UI refactorThiago de Arruda2015-02-16
| | | | | | | | | | | | | - Remove abstract_ui global, now it is always active - Remove some terminal handling code - Remove unused functions - Remove HAVE_TGETENT/TERMINFO/TERMIOS/IOCTL #ifdefs - Remove tgetent/terminfo from version.c - Remove curses/terminfo dependencies - Only start/stop termcap when starting/exiting the program - msg_use_printf will return true if there are no attached UIs( messages will be written to stdout) - Remove `ex_winpos`(implement `:winpos` with `ex_ni`)
* FEAT_SIGNS: restore :signs wildmenu, and add test.Justin M. Keyes2015-02-15
|
* Remove nonnullret deadcode: home_replace_save.Eliseo Martínez2015-01-27
|
* Remove nonnullret deadcode: addstar.Eliseo Martínez2015-01-27
|
* Remove nonnullret deadcode: Mark new nonnullret functions.Eliseo Martínez2015-01-27
|
* Macro cleanup: PROTOMichael Reed2015-01-14
| | | | | | Regarding dict_lookup() in eval.c: both definitions are the same, the only difference being the spacing between the indirection operator and the indentation level.
* vim-patch:7.4.441Florian Walch2014-12-23
| | | | | | | | Problem: Endless loop and other problems when 'cedit' is set to CTRL-C. Solution: Do not call ex_window() when ex_normal_busy or got_int was set. (Yasuhiro Matsumoto) https://code.google.com/p/vim/source/detail?r=v7-4-441
* Define and use the ARRAY_SIZE macroFelipe Oliveira Carvalho2014-12-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A similar macro is defined in the Linux kernel [1]. To refactor the code I used a slightly modified Coccinelle script I found in [2]. ```diff // Use the macro ARRAY_SIZE when possible // // Confidence: High // Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2. // URL: http://www.emn.fr/x-info/coccinelle/rules/array.html // Options: -I ... -all_includes can give more complete results @@ type T; T[] E; @@ - (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(E[...])) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) @n@ identifier AS,E; @@ - #define AS(E) ARRAY_SIZE(E) @@ expression E; identifier n.AS; @@ - AS(E) + ARRAY_SIZE(E) ``` `spatch --in-place --sp-file array_size.cocci -I src/ -I build/include/ -I build/src/nvim/auto/ src/nvim/*.c` [1] http://lxr.free-electrons.com/source/include/linux/kernel.h#L54 [2] http://www.emn.fr/z-info/coccinelle/rules/#macros
* strings.c: replace copy_spaces, copy_chars with equivalent memset.Daniel Fairhead2014-12-12
|
* ui: Add abstract_ui termcap and split UI layerThiago de Arruda2014-12-08
| | | | | | | | | | | | | | | | | | This is how Nvim behaves when the "abstract_ui" termcap is activated: - No data is written/read to stdout/stdin by default. - Instead of sending data to stdout, ui_write will parse the termcap codes and invoke dispatch functions in the ui.c module. - The dispatch functions will forward the calls to all attached UI instances(each UI instance is an implementation of the UI layer and is registered with ui_attach). - Like with the "builtin_gui" termcap, "abstract_ui" does not contain any key sequences. Instead, vim key strings(<cr>, <esc>, etc) are parsed directly by input_enqueue and the translated strings are pushed to the input buffer. With this new input model, its not possible to send mouse events yet. Thats because mouse sequence parsing happens in term.c/check_termcodes which must return early when "abstract_ui" is activated.
* term: Move more mouse functions to mouse.cThiago de Arruda2014-12-02
|