diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-03-15 10:21:05 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-03-15 10:30:59 -0300 |
commit | c546875daf36936b9a6c0886a71c9edd1fdae6db (patch) | |
tree | b20e159ef39a89e67c0a7738d96ef1f4afccd284 /src/nvim/msgpack_rpc/remote_ui.c | |
parent | dbe719317cf71dd1951d8d478256b8735db12db0 (diff) | |
download | rneovim-c546875daf36936b9a6c0886a71c9edd1fdae6db.tar.gz rneovim-c546875daf36936b9a6c0886a71c9edd1fdae6db.tar.bz2 rneovim-c546875daf36936b9a6c0886a71c9edd1fdae6db.zip |
ui: Replace cursor_{on,off} by busy_{stop,start}
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).
Diffstat (limited to 'src/nvim/msgpack_rpc/remote_ui.c')
-rw-r--r-- | src/nvim/msgpack_rpc/remote_ui.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/msgpack_rpc/remote_ui.c b/src/nvim/msgpack_rpc/remote_ui.c index 45b3dee0fd..b554d76bed 100644 --- a/src/nvim/msgpack_rpc/remote_ui.c +++ b/src/nvim/msgpack_rpc/remote_ui.c @@ -82,8 +82,8 @@ static Object remote_ui_attach(uint64_t channel_id, uint64_t request_id, ui->clear = remote_ui_clear; ui->eol_clear = remote_ui_eol_clear; ui->cursor_goto = remote_ui_cursor_goto; - ui->cursor_on = remote_ui_cursor_on; - ui->cursor_off = remote_ui_cursor_off; + ui->busy_start = remote_ui_busy_start; + ui->busy_stop = remote_ui_busy_stop; ui->mouse_on = remote_ui_mouse_on; ui->mouse_off = remote_ui_mouse_off; ui->insert_mode = remote_ui_insert_mode; @@ -190,16 +190,16 @@ static void remote_ui_cursor_goto(UI *ui, int row, int col) push_call(ui, "cursor_goto", args); } -static void remote_ui_cursor_on(UI *ui) +static void remote_ui_busy_start(UI *ui) { Array args = ARRAY_DICT_INIT; - push_call(ui, "cursor_on", args); + push_call(ui, "busy_start", args); } -static void remote_ui_cursor_off(UI *ui) +static void remote_ui_busy_stop(UI *ui) { Array args = ARRAY_DICT_INIT; - push_call(ui, "cursor_off", args); + push_call(ui, "busy_stop", args); } static void remote_ui_mouse_on(UI *ui) |