Mercurial > vim
diff src/misc1.c @ 31728:238ca27dbfd2 v9.0.1196
patch 9.0.1196: code is indented more than necessary
Commit: https://github.com/vim/vim/commit/e8575988969579f9e1439181ae338b2ff74054a8
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Jan 14 12:32:28 2023 +0000
patch 9.0.1196: code is indented more than necessary
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11813)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 14 Jan 2023 13:45:04 +0100 |
parents | 11115c806541 |
children | 9f1504e36ae9 |
line wrap: on
line diff
--- a/src/misc1.c +++ b/src/misc1.c @@ -1119,59 +1119,59 @@ vim_beep(unsigned val) called_vim_beep = TRUE; #endif - if (emsg_silent == 0 && !in_assert_fails) + if (emsg_silent != 0 || in_assert_fails) + return; + + if (!((bo_flags & val) || (bo_flags & BO_ALL))) { - if (!((bo_flags & val) || (bo_flags & BO_ALL))) - { #ifdef ELAPSED_FUNC - static int did_init = FALSE; - static elapsed_T start_tv; + static int did_init = FALSE; + static elapsed_T start_tv; - // Only beep once per half a second, otherwise a sequence of beeps - // would freeze Vim. - if (!did_init || ELAPSED_FUNC(start_tv) > 500) + // Only beep once per half a second, otherwise a sequence of beeps + // would freeze Vim. + if (!did_init || ELAPSED_FUNC(start_tv) > 500) + { + did_init = TRUE; + ELAPSED_INIT(start_tv); +#endif + if (p_vb +#ifdef FEAT_GUI + // While the GUI is starting up the termcap is set for + // the GUI but the output still goes to a terminal. + && !(gui.in_use && gui.starting) +#endif + ) { - did_init = TRUE; - ELAPSED_INIT(start_tv); -#endif - if (p_vb -#ifdef FEAT_GUI - // While the GUI is starting up the termcap is set for - // the GUI but the output still goes to a terminal. - && !(gui.in_use && gui.starting) -#endif - ) - { - out_str_cf(T_VB); + out_str_cf(T_VB); #ifdef FEAT_VTP - // No restore color information, refresh the screen. - if (has_vtp_working() != 0 + // No restore color information, refresh the screen. + if (has_vtp_working() != 0 # ifdef FEAT_TERMGUICOLORS - && (p_tgc || (!p_tgc && t_colors >= 256)) + && (p_tgc || (!p_tgc && t_colors >= 256)) # endif - ) - { - redraw_later(UPD_CLEAR); - update_screen(0); - redrawcmd(); - } -#endif + ) + { + redraw_later(UPD_CLEAR); + update_screen(0); + redrawcmd(); } - else - out_char(BELL); +#endif + } + else + out_char(BELL); #ifdef ELAPSED_FUNC - } + } #endif - } + } - // When 'debug' contains "beep" produce a message. If we are sourcing - // a script or executing a function give the user a hint where the beep - // comes from. - if (vim_strchr(p_debug, 'e') != NULL) - { - msg_source(HL_ATTR(HLF_W)); - msg_attr(_("Beep!"), HL_ATTR(HLF_W)); - } + // When 'debug' contains "beep" produce a message. If we are sourcing + // a script or executing a function give the user a hint where the beep + // comes from. + if (vim_strchr(p_debug, 'e') != NULL) + { + msg_source(HL_ATTR(HLF_W)); + msg_attr(_("Beep!"), HL_ATTR(HLF_W)); } }