diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2015-07-26 23:50:55 -0400 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2015-07-26 23:50:55 -0400 |
| commit | ccebc1f8d3b30536bbaab532cc5acc7ba7ec3d4b (patch) | |
| tree | a24026900b0cc1b5cef58892a89532816f97e002 /src/nvim/ui.c | |
| parent | 61e4a320658ffd64103795cf9aeb9a53c1ac2032 (diff) | |
| parent | f79025b9dea8e46afa0f10884a1759744ada5940 (diff) | |
| download | rneovim-ccebc1f8d3b30536bbaab532cc5acc7ba7ec3d4b.tar.gz rneovim-ccebc1f8d3b30536bbaab532cc5acc7ba7ec3d4b.tar.bz2 rneovim-ccebc1f8d3b30536bbaab532cc5acc7ba7ec3d4b.zip | |
Merge #2660 'generalize mode-change API and support replace-mode cursor'
Diffstat (limited to 'src/nvim/ui.c')
| -rw-r--r-- | src/nvim/ui.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/nvim/ui.c b/src/nvim/ui.c index dc2bc0898c..7e155f9b4f 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -121,7 +121,7 @@ void ui_update_encoding(void) // May update the shape of the cursor. void ui_cursor_shape(void) { - ui_change_mode(); + ui_mode_change(); } void ui_refresh(void) @@ -469,25 +469,20 @@ static void flush_cursor_update(void) // Notify that the current mode has changed. Can be used to change cursor // shape, for example. -static void ui_change_mode(void) +static void ui_mode_change(void) { - static int showing_insert_mode = MAYBE; - + int mode; if (!full_screen) { return; } - - if (State & INSERT) { - if (showing_insert_mode != TRUE) { - UI_CALL(insert_mode); - } - showing_insert_mode = TRUE; - } else { - if (showing_insert_mode != FALSE) { - UI_CALL(normal_mode); - } - showing_insert_mode = FALSE; - } + /* Get a simple UI mode out of State. */ + if ((State & REPLACE) == REPLACE) + mode = REPLACE; + else if (State & INSERT) + mode = INSERT; + else + mode = NORMAL; + UI_CALL(mode_change, mode); conceal_check_cursur_line(); } |