diff options
-rw-r--r-- | src/nvim/terminal.c | 2 | ||||
-rw-r--r-- | test/functional/terminal/cursor_spec.lua | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 959126dd24..61b55f71de 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -693,7 +693,6 @@ bool terminal_enter(void) refresh_cursor(s->term); adjust_topline(s->term, buf, 0); // scroll to end - showmode(); curwin->w_redr_status = true; // For mode() in statusline. #8323 redraw_custom_title_later(); if (!s->term->cursor.visible) { @@ -701,6 +700,7 @@ bool terminal_enter(void) ui_busy_start(); } ui_cursor_shape(); + showmode(); apply_autocmds(EVENT_TERMENTER, NULL, NULL, false, curbuf); may_trigger_modechanged(); diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 83408e41b3..a824893ce3 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -357,6 +357,32 @@ describe(':terminal cursor', function() eq(error_hl_id, screen._mode_info[terminal_mode_idx].hl_id) end) + + it('restores visibility on TermLeave #32456', function() + skip(is_os('win'), '#31587') + feed([[<C-\><C-N>]]) -- Exit terminal mode + screen:expect([[ + tty ready | + ^ | + |*5 + ]]) + + tt.hide_cursor() + -- :startinsert repros the issue more reliably than feed('i') + command('mode | startinsert') + screen:expect([[ + tty ready | + |*5 + {3:-- TERMINAL --} | + ]]) + + feed([[<C-\><C-N>]]) -- Exit terminal mode + screen:expect([[ + tty ready | + ^ | + |*5 + ]]) + end) end) describe('buffer cursor position is correct in terminal without number column', function() |