Mercurial > vim
diff src/ex_getln.c @ 31565:7d40c8c10a12 v9.0.1115
patch 9.0.1115: code is indented more than needed
Commit: https://github.com/vim/vim/commit/ed0c1d5d4b30d03b26ff08841f6da2ddf44025a7
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Fri Dec 30 18:07:46 2022 +0000
patch 9.0.1115: code is indented more than needed
Problem: Code is indented more than needed.
Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan,
closes #11758)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 30 Dec 2022 19:15:04 +0100 |
parents | ca083d0199c6 |
children | f1d5ad2b978e |
line wrap: on
line diff
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -368,36 +368,36 @@ finish_incsearch_highlighting( incsearch_state_T *is_state, int call_update_screen) { - if (is_state->did_incsearch) + if (!is_state->did_incsearch) + return; + + is_state->did_incsearch = FALSE; + if (gotesc) + curwin->w_cursor = is_state->save_cursor; + else { - is_state->did_incsearch = FALSE; - if (gotesc) - curwin->w_cursor = is_state->save_cursor; - else + if (!EQUAL_POS(is_state->save_cursor, is_state->search_start)) { - if (!EQUAL_POS(is_state->save_cursor, is_state->search_start)) - { - // put the '" mark at the original position - curwin->w_cursor = is_state->save_cursor; - setpcmark(); - } - curwin->w_cursor = is_state->search_start; + // put the '" mark at the original position + curwin->w_cursor = is_state->save_cursor; + setpcmark(); } - restore_viewstate(&is_state->old_viewstate); - highlight_match = FALSE; - - // by default search all lines - search_first_line = 0; - search_last_line = MAXLNUM; - - magic_overruled = is_state->magic_overruled_save; - - validate_cursor(); // needed for TAB - status_redraw_all(); - redraw_all_later(UPD_SOME_VALID); - if (call_update_screen) - update_screen(UPD_SOME_VALID); + curwin->w_cursor = is_state->search_start; } + restore_viewstate(&is_state->old_viewstate); + highlight_match = FALSE; + + // by default search all lines + search_first_line = 0; + search_last_line = MAXLNUM; + + magic_overruled = is_state->magic_overruled_save; + + validate_cursor(); // needed for TAB + status_redraw_all(); + redraw_all_later(UPD_SOME_VALID); + if (call_update_screen) + update_screen(UPD_SOME_VALID); } /* @@ -4032,13 +4032,13 @@ escape_fname(char_u **pp) char_u *p; p = alloc(STRLEN(*pp) + 2); - if (p != NULL) - { - p[0] = '\\'; - STRCPY(p + 1, *pp); - vim_free(*pp); - *pp = p; - } + if (p == NULL) + return; + + p[0] = '\\'; + STRCPY(p + 1, *pp); + vim_free(*pp); + *pp = p; } /*