diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-26 13:40:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-26 13:40:33 +0800 |
commit | 522b15e2a4d0a0f5a9e5958efa4ffcbb3606f131 (patch) | |
tree | 455961489867e2fa0c489a2bd4ff779a90d792fd /src/nvim/normal.c | |
parent | 357aab4c65c49a924481a67e17a10bd04c334ab9 (diff) | |
parent | 5b89d480e30367259f82680945572b1406219da5 (diff) | |
download | rneovim-522b15e2a4d0a0f5a9e5958efa4ffcbb3606f131.tar.gz rneovim-522b15e2a4d0a0f5a9e5958efa4ffcbb3606f131.tar.bz2 rneovim-522b15e2a4d0a0f5a9e5958efa4ffcbb3606f131.zip |
Merge pull request #21202 from luukvbaal/statusline
feat: add 'showcmdloc' option and statusline item
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index d6fa1f5a16..1f7cc6c4f6 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -68,6 +68,7 @@ #include "nvim/spellfile.h" #include "nvim/spellsuggest.h" #include "nvim/state.h" +#include "nvim/statusline.h" #include "nvim/strings.h" #include "nvim/syntax.h" #include "nvim/tag.h" @@ -1782,8 +1783,6 @@ void may_clear_cmdline(void) } // Routines for displaying a partly typed command -#define SHOWCMD_BUFLEN (SHOWCMD_COLS + 1 + 30) -static char showcmd_buf[SHOWCMD_BUFLEN]; static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; // For push_showcmd() static bool showcmd_is_clear = true; static bool showcmd_visual = false; @@ -1977,14 +1976,20 @@ void pop_showcmd(void) static void display_showcmd(void) { - if (p_ch == 0 && !ui_has(kUIMessages)) { - // TODO(bfredl): would be nice to show in global statusline, perhaps + int len = (int)strlen(showcmd_buf); + showcmd_is_clear = (len == 0); + + if (*p_sloc == 's') { + win_redr_status(curwin); + setcursor(); // put cursor back where it belongs return; } - - int len; - len = (int)strlen(showcmd_buf); - showcmd_is_clear = (len == 0); + if (*p_sloc == 't') { + draw_tabline(); + setcursor(); // put cursor back where it belongs + return; + } + // 'showcmdloc' is "last" or empty if (ui_has(kUIMessages)) { MAXSIZE_TEMP_ARRAY(content, 1); |