| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Problem: Can't specify when not to ring the bell.
Solution: Add the 'belloff' option. (Christian Brabandt)
https://github.com/vim/vim/commit/165bc69d1b7f70ca9d5b657f35d0584ecb7b5183
|
| |
|
| |
|
|
|
|
|
| |
Otherwise QuickBuild shows a warning that control may reach end of non-void
function.
|
| |
|
|
|
|
| |
Currently only merges history when reading ShaDa file. No tests yet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
| |
- Declare poll timer in Loop structure instead of a loop_poll_events local
variable.
- Move deferred event management to input.c
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
|\
| |
| |
| | |
Reviewed-by: Eliseo Martínez <eliseomarmol@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|\
| |
| |
| |
| |
| | |
Reviewed-by: Scott Prager <splinterofchaos@gmail.com>
Reviewed-by: Michael Reed <m.reed@mykolab.com>
Reviewed-by: Eliseo Martínez <eliseomarmol@gmail.com>
|
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
|/
|
|
|
|
|
| |
This fixes missing clipboard support for `:redir`
Helped-By: Michael Reed <m.reed@mykolab.com>
Helped-By: Scott Prager <splinterofchaos@gmail.com>
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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`)
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|