From 1cfb14aa972ccf3235ac67f07b7db1175b7c5384 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Mon, 9 Jan 2023 19:04:23 +0000 Subject: patch 9.0.1166: 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 #11792) --- src/ex_cmds.c | 96 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/ex_cmds.c') diff --git a/src/ex_cmds.c b/src/ex_cmds.c index faff4aadaf..32c72879cc 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5279,67 +5279,67 @@ prepare_tagpreview( need_mouse_correct = TRUE; # endif + if (curwin->w_p_pvw) + return FALSE; + /* * If there is already a preview window open, use that one. */ - if (!curwin->w_p_pvw) - { # ifdef FEAT_PROP_POPUP - if (use_previewpopup && *p_pvp != NUL) - { - wp = popup_find_preview_window(); - if (wp != NULL) - popup_set_wantpos_cursor(wp, wp->w_minwidth, NULL); - } - else if (use_popup != USEPOPUP_NONE) + if (use_previewpopup && *p_pvp != NUL) + { + wp = popup_find_preview_window(); + if (wp != NULL) + popup_set_wantpos_cursor(wp, wp->w_minwidth, NULL); + } + else if (use_popup != USEPOPUP_NONE) + { + wp = popup_find_info_window(); + if (wp != NULL) { - wp = popup_find_info_window(); - if (wp != NULL) - { - if (use_popup == USEPOPUP_NORMAL) - popup_show(wp); - else - popup_hide(wp); - // When the popup moves or resizes it may reveal part of - // another window. TODO: can this be done more efficiently? - redraw_all_later(UPD_NOT_VALID); - } + if (use_popup == USEPOPUP_NORMAL) + popup_show(wp); + else + popup_hide(wp); + // When the popup moves or resizes it may reveal part of + // another window. TODO: can this be done more efficiently? + redraw_all_later(UPD_NOT_VALID); } - else + } + else # endif - { - FOR_ALL_WINDOWS(wp) - if (wp->w_p_pvw) - break; - } - if (wp != NULL) - win_enter(wp, undo_sync); - else - { - /* - * There is no preview window open yet. Create one. - */ + { + FOR_ALL_WINDOWS(wp) + if (wp->w_p_pvw) + break; + } + if (wp != NULL) + { + win_enter(wp, undo_sync); + return FALSE; + } + + /* + * There is no preview window open yet. Create one. + */ # ifdef FEAT_PROP_POPUP - if ((use_previewpopup && *p_pvp != NUL) - || use_popup != USEPOPUP_NONE) - return popup_create_preview_window(use_popup != USEPOPUP_NONE); + if ((use_previewpopup && *p_pvp != NUL) + || use_popup != USEPOPUP_NONE) + return popup_create_preview_window(use_popup != USEPOPUP_NONE); # endif - if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0) == FAIL) - return FALSE; - curwin->w_p_pvw = TRUE; - curwin->w_p_wfh = TRUE; - RESET_BINDING(curwin); // don't take over 'scrollbind' - // and 'cursorbind' + if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0) == FAIL) + return FALSE; + curwin->w_p_pvw = TRUE; + curwin->w_p_wfh = TRUE; + RESET_BINDING(curwin); // don't take over 'scrollbind' + // and 'cursorbind' # ifdef FEAT_DIFF - curwin->w_p_diff = FALSE; // no 'diff' + curwin->w_p_diff = FALSE; // no 'diff' # endif # ifdef FEAT_FOLDING - curwin->w_p_fdc = 0; // no 'foldcolumn' + curwin->w_p_fdc = 0; // no 'foldcolumn' # endif - return TRUE; - } - } - return FALSE; + return TRUE; } #endif -- cgit v1.2.3