diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-05 22:10:14 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-09-05 22:36:09 +0800 |
commit | f6a8d395a72da61c9305cd242f38bd8137c4f5b0 (patch) | |
tree | 30ff58ac402c6a636731bf181b78eef1ec6aea91 | |
parent | fc7a64291a5ed074eafff47b21b411bfe9d4a19e (diff) | |
download | rneovim-f6a8d395a72da61c9305cd242f38bd8137c4f5b0.tar.gz rneovim-f6a8d395a72da61c9305cd242f38bd8137c4f5b0.tar.bz2 rneovim-f6a8d395a72da61c9305cd242f38bd8137c4f5b0.zip |
refactor(ex_cd): add an early return to fix clint warning
The popupmenu.c change is unrelated.
-rw-r--r-- | src/nvim/ex_docmd.c | 39 | ||||
-rw-r--r-- | src/nvim/popupmenu.c | 6 |
2 files changed, 22 insertions, 23 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6517ebd081..8fb166d2c9 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5544,27 +5544,26 @@ void ex_cd(exarg_T *eap) // for non-UNIX ":cd" means: print current directory unless 'cdhome' is set if (*new_dir == NUL && !p_cdh) { ex_pwd(NULL); - } else + return; + } #endif - { - CdScope scope = kCdScopeGlobal; - switch (eap->cmdidx) { - case CMD_tcd: - case CMD_tchdir: - scope = kCdScopeTabpage; - break; - case CMD_lcd: - case CMD_lchdir: - scope = kCdScopeWindow; - break; - default: - break; - } - if (changedir_func(new_dir, scope)) { - // Echo the new current directory if the command was typed. - if (KeyTyped || p_verbose >= 5) { - ex_pwd(eap); - } + CdScope scope = kCdScopeGlobal; + switch (eap->cmdidx) { + case CMD_tcd: + case CMD_tchdir: + scope = kCdScopeTabpage; + break; + case CMD_lcd: + case CMD_lchdir: + scope = kCdScopeWindow; + break; + default: + break; + } + if (changedir_func(new_dir, scope)) { + // Echo the new current directory if the command was typed. + if (KeyTyped || p_verbose >= 5) { + ex_pwd(eap); } } } diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index 2265334a45..4de3713f4f 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -1042,14 +1042,14 @@ void pum_show_popupmenu(vimmenu_T *menu) pum_scrollbar = 0; pum_height = pum_size; pum_position_at_mouse(20); + + pum_selected = -1; + pum_first = 0; if (!p_mousemev) { // Pretend 'mousemoveevent' is set. ui_call_option_set(STATIC_CSTR_AS_STRING("mousemoveevent"), BOOLEAN_OBJ(true)); } - pum_selected = -1; - pum_first = 0; - for (;;) { pum_is_visible = true; pum_is_drawn = true; |