From 600e7e3b32345d71842b6b167359f4f72093e9b0 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sat, 8 Jan 2022 02:13:11 +0000 Subject: fix: make mode() return correct value in ex mode When the user is in ex mode, a call to mode(1) is documented to return "cv". However, it does not currently do so, because the check which checks for ex mode is nested inside a conditional which is never reached in ex mode. Vim uses an explicit check for exmode_active, so let's do the same thing here. Add some tests for this case both with a TTY and in silent mode. --- src/nvim/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/state.c b/src/nvim/state.c index 68bc76660d..1fe8bb671d 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -180,7 +180,7 @@ char *get_mode(void) buf[1] = 'x'; } } - } else if (State & CMDLINE) { + } else if ((State & CMDLINE) || exmode_active) { buf[0] = 'c'; if (exmode_active) { buf[1] = 'v'; -- cgit