| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
Nvim now relies much less on setting terminal mode to cooked mode, remove most
calls to settmode, except for those that happen on startup or when suspending.
Eventually even those will be handled by the UI layer.
|
|
|
|
| |
This is not being used and should not be part of the core anyway.
|
|
|
|
|
| |
These functions only used to call another os_* function, so remove them and
replace all occurences in the project.
|
|
|
|
|
|
|
| |
Two new functions, `event_enable_deferred()`/`event_disable_deferred()` have to
be called by code that is capable of handling asynchronicity. User-dialog states
like "press ENTER to continue" or the swap file confirmation no longer will
generate K_EVENT.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem : Double free @ 4249.
Diagnostic : False positive.
Rationale : Codepath leading to error contains two consecutive
iterations in which `if (--j < 0)` is true.
That executes `free` two consecutive times with the same
value (hislen - 1) for j, with leads to double free.
Now, that can only happen with j == 0 && hislen == 1.
And that would imply j == hisidx[type] too, which would
take the following break.
So, the error codepath cannot really happen, but the
compiler cannot deduce the last implication.
Resolution : We have two possible solutions for this:
1.- Comparing value of j before and after updating it,
and breaking out of iteration if equal.
That changes nothing in functionality, but teaches the
compiler his proposed error codepath is impossible.
2.- Nullify pointer after freeing.
This way, the compiler still thinks his error codepath
is possible, but it's not an error anymore, as
free(NULL) is a no-op.
We opt for solution 2, as solution 1 requires adding
logic that adds nothing (and having to explain that clearly
in aside comments) just for the purpose of silencing
warning. On the other hand, solution 2 improves the code,
adding something considered good practice in any case,
and therefore doesn't require further explanation.
|
|
|
|
|
|
|
|
| |
Problem: Fold does not open after search when there is a CmdwinLeave
autocommand.
Solution: Restore KeyTyped. (Jacob Niehus)
https://code.google.com/p/vim/source/detail?r=v7-4-410
|
|
|
|
|
|
|
|
| |
Problem: When there is an error preparing to edit the command line, the
command won't be executed. (Hirohito Higashi)
Solution: Reset did_emsg before editing.
https://code.google.com/p/vim/source/detail?r=v7-4-337
|
|
|
|
|
| |
This option makes nvim run in "embedded mode", which creates an API channel via
stdin/stdout and disables all terminal-related code
|
| |
|
|
|
|
|
|
|
|
| |
Problem: globpath() returns a string, making it difficult to get a
list of matches. (Greg Novack)
Solution: Add an optional argument like with glob(). (Adnan Zafar)
https://code.google.com/p/vim/source/detail?r=8e9db1f27a0063df023cc05a760fce73255dad24
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Remove all *_set_defer methods and the 'defer' flag from rstream/jobs
- Added {signal,rstream,job}_event_source functions. Each return a pointer that
represent the event source for the object in question(For signals, a static
pointer is returned)
- Added a 'source' field to the Event struct, which is set to the appropriate
value by the code that created the event.
- Added a 'sources' parameter to `event_poll`. It should point to a
NULL-terminated array of event sources that will be used to decide which
events should be processed immediately
- Added a 'source_override' parameter to `rstream_new`. This was required to use
jobs as event sources of RStream instances(When "focusing" on a job, for
example).
- Extracted `process_from` static function from `event_process`.
- Remove 'defer' parameter from `event_process`, which now operates only on
deferred events.
- Refactor `channel_send_call` to use the new lock mechanism
What changed in a single sentence: Code that calls `event_poll` have to specify
which event sources should NOT be deferred. This change was necessary for a
number of reasons:
- To fix a bug where due to race conditions, a client request
could end in the deferred queue in the middle of a `channel_send_call`
invocation, resulting in a deadlock since the client process would never
receive a response, and channel_send_call would never return because
the client would still be waiting for the response.
- To handle "event locking" correctly in recursive `channel_send_call`
invocations when the frames are waiting for responses from different
clients. Not much of an issue now since there's only a python client, but
could break things later.
- To simplify the process of implementing synchronous functions that depend on
asynchronous events.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Should be better than gettimeofday() since libuv uses higher resolution
clocks on most UNIX platforms. Libuv also tries to use monotonic clocks,
kernel bugs notwithstanding, which is another win over gettimeofday().
Necessary for Windows, which doesn't have gettimeofday(). In vanilla vim,
Windows uses QueryPerformanceCounter, which is the correct primitive for
this sort of things, but that was removed when slimming up the codebase.
Libuv uses QueryPerformanceCounter to implement uv_hrtime() on Windows so
the behaviour of vim profiling on Windows should now be the same.
The behaviour on Linux should be different (better) though, libuv uses more
accurate primitives than gettimeofday().
Other misc. changes:
- Added function attributes where relevant (const, pure, ...)
- Convert functions to receive scalars: Now that proftime_T is always a
(uint64_t) scalar (and not a struct), it's clearer to convert the
functions to receive it as such instead of a pointer to a scalar.
- Extract profiling funcs to profile.c: make everything clearer and reduces
the size of the "catch-all" ex_cmds2.c
- Add profile.{c,h} to clint and -Wconv:
- Don't use sprintf, use snprintf
- Don't use long, use int16_t/int32_t/...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`-Wstrict-prototypes` warn if a function is declared or defined without
specifying the argument types.
This warning disallow function prototypes with empty parameter list.
In C, a function declared with an empty parameter list accepts an
arbitrary number of arguments when being called. This is for historic
reasons; originally, C functions didn't have prototypes, as C evolved
from B, a typeless language. When prototypes were added, the original
typeless declarations were left in the language for backwards
compatibility.
Instead we should provide `void` in argument list to state
that function doesn't have arguments.
Also this warning disallow declaring type of the parameters after the
parentheses because Neovim header generator produce no declarations for
old-stlyle prototypes: it expects to find `{` after prototype.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
buffer.h:
buflist_getfile() flags
buflist_new() flags
buf_freeall() flags
do_buffer() flags
charset.h:
chartab[] flags
edit.h:
in_cinkeys() flags
change_indent() flags
beginline() flags
insertchar() flags
nv_mousescroll() flags
eval.c
AUTOLOAD_CHAR
eval.h:
enum for vimvars[]
ex_cmds.h:
do_ecmd
read_viminfo flags
ex_cmds2.h:
check_changed() flags
do_source() flags
ex_cmds_defs.h:
BAD_* flags
ex_docmd.h:
VALID_PATH VALID_HEAD
EXMODE_*
do_cmdline() flags
added include
ex_getln.c
*_ESC_CHARS definitions
ex_getln.h:
history table flags - used by add_to_history()
fileio.h:
readfile() flags
event_T definition
getchar.h:
ins_typebuf() flags
KEYLEN_*
globals.h:
NO_SCREEN
NO_BUFFERS
SEA_* defines
current_SID flags
hlf_T enum
HL_FLAGS
do_profiling() flags
schar_T
sattr_T
indent.h:
set_indent() flags
macros.h:
BINARY_FILE_IO flags
mbyte.h:
MB_BYTE2LEN*
ENC_*
memfile.h:
mf_sync() flags
misc1.h:
open_line() flags
message.h:
do_dialog() flags
vim_dialogyesno() flags
DLG_BUTTON_*
normal.h:
find_ident_under_cursor() flags
ops.h:
do_put() flags
operator ID's
option.h:
buf_copy_options() flags
OPT_* flags
os_unix.h:
mch_nodetype() flags
quickfix.h:
skip_vimgrep_pat() flags
regexp.h:
vim_regcomp() flags
values for reg_do_extmatch
search.h:
do_search() flags
search_regcomp() flags
findmatchlimit() flags
syntax.h:
HL_* flags
HL_FOLD is used in buffer_defs.h but nvim
compiles just fine with the defines in
syntax.h
tag.h:
do_tag() flags
find_tags() flags
term.h:
TBUFSZ flags
MOUSE flags
ui.h:
jump_to_mouse() flags
window.h:
file_name_in_line() flags
win_split() flags
MIN_LINES
MIN_COLUMNS
Remove VimClipboard which should have been removed with PR #921.
|
|
|
|
|
|
|
| |
Done by manual inspection of the output of this script:
grep -r -l -w "bool\|true\|false" * | grep 'c$\|h$' > has_bool
grep -r -l "stdbool.h" * | grep 'c$\|h$' > has_include
grep -F -x -v -f has_include has_bool
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This macro is used to append an element to a growable array. It replaces this
common idiom:
ga_grow(&ga, 1);
((item_type *)ga.ga_data)[ga.ga_len] = item;
++ga.ga_len;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To make it possible reuse `event_poll` recursively and in other blocking
function calls, this changes how deferred/immediate events are processed:
- There are two queues in event.c, one for immediate events and another for
deferred events. The queue used when pushing/processing events is determined
with boolean arguments passed to `event_push`/`event_process` respectively.
- Events pushed to the immediate queue are processed inside `event_poll` but
after the `uv_run` call. This is required because libuv event loop does not
support recursion, and processing events may result in other `event_poll`
calls.
- Events pushed to the deferred queue are processed later by calling
`event_process(true)`. This is required to "trick" vim into treating all
asynchronous events as special keypresses, which is the least obtrusive
way of introducing asynchronicity into the editor.
- RStream instances will now forward the `defer` flag to the `event_push` call.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
move W_ENDCOL to screen.c
remove the rest of the W_* macros
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- The 'stripdecls.py' script replaces declarations in all headers by includes to
generated headers.
`ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'`
was used for this.
- Add and integrate gendeclarations.lua into the build system to generate the
required includes.
- Add -Wno-unused-function
- Made a bunch of old-style definitions ANSI
This adds a requirement: all type and structure definitions must be present
before INCLUDE_GENERATED_DECLARATIONS-protected include.
Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is
the only exception.
|
|
|
|
|
| |
s/ml_get_curline/get_cursor_line_ptr
s/ml_get_cursor/get_cursor_pos_ptr
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Replace a vim_strsave/free pair with xrealloc
- Use xmallocz() in some places
- Use xrealloc() and forget about the NULL pointer case
- Remove invalid comment
- Remove unnecessary checks
- Replace a complicated xmalloc/STRCPY/free code chunk code with xrealloc()
- Replace a vim_strsave/free code chunk with xrealloc()
|
| |
|
|
|
|
|
| |
put_on_cmdline() doesn't FAIL anymore but its return value was
never checked.
|
| |
|