diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-31 06:41:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-31 06:41:23 +0800 |
commit | 99cf111289bfcd14981255e805da43bac5139141 (patch) | |
tree | 54e0f84d10b39603e20c841174585af69cb8f54c /src/nvim/ex_getln.c | |
parent | 6a45360de99b1a7d0d3d9ca1060d5212717c7578 (diff) | |
download | rneovim-99cf111289bfcd14981255e805da43bac5139141.tar.gz rneovim-99cf111289bfcd14981255e805da43bac5139141.tar.bz2 rneovim-99cf111289bfcd14981255e805da43bac5139141.zip |
vim-patch:9.0.1115: code is indented more than needed (#21598)
Problem: Code is indented more than needed.
Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan,
closes vim/vim#11758)
https://github.com/vim/vim/commit/ed0c1d5d4b30d03b26ff08841f6da2ddf44025a7
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 97f4c6261b..be6253d1c9 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -575,32 +575,34 @@ static int may_add_char_to_search(int firstc, int *c, incsearch_state_T *s) static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool call_update_screen) { - if (s->did_incsearch) { - s->did_incsearch = false; - if (gotesc) { + if (!s->did_incsearch) { + return; + } + + s->did_incsearch = false; + if (gotesc) { + curwin->w_cursor = s->save_cursor; + } else { + if (!equalpos(s->save_cursor, s->search_start)) { + // put the '" mark at the original position curwin->w_cursor = s->save_cursor; - } else { - if (!equalpos(s->save_cursor, s->search_start)) { - // put the '" mark at the original position - curwin->w_cursor = s->save_cursor; - setpcmark(); - } - curwin->w_cursor = s->search_start; // -V519 + setpcmark(); } - restore_viewstate(curwin, &s->old_viewstate); - highlight_match = false; + curwin->w_cursor = s->search_start; // -V519 + } + restore_viewstate(curwin, &s->old_viewstate); + highlight_match = false; - // by default search all lines - search_first_line = 0; - search_last_line = MAXLNUM; + // by default search all lines + search_first_line = 0; + search_last_line = MAXLNUM; - magic_overruled = s->magic_overruled_save; + magic_overruled = s->magic_overruled_save; - validate_cursor(); // needed for TAB - redraw_all_later(UPD_SOME_VALID); - if (call_update_screen) { - update_screen(); - } + validate_cursor(); // needed for TAB + redraw_all_later(UPD_SOME_VALID); + if (call_update_screen) { + update_screen(); } } |