0
0
mirror of https://github.com/vim/vim.git synced 2025-08-27 20:13:38 -04:00

patch 9.0.1158: 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 #11787)
This commit is contained in:
Yegappan Lakshmanan 2023-01-08 13:44:24 +00:00 committed by Bram Moolenaar
parent df8f947359
commit 7f8b2559a3
14 changed files with 1274 additions and 1266 deletions

View File

@ -1426,11 +1426,11 @@ ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr)
{
// check for NULL pointer, not to return an error to the user, but
// to prevent a crash
if (stack_ptr != NULL)
{
if (stack_ptr == NULL)
return;
stack_ptr->ffs_prev = search_ctx->ffsc_stack_ptr;
search_ctx->ffsc_stack_ptr = stack_ptr;
}
}
/*

View File

@ -513,13 +513,14 @@ newFoldLevelWin(win_T *wp)
void
foldCheckClose(void)
{
if (*p_fcl != NUL) // can only be "all" right now
{
if (*p_fcl == NUL)
return;
// can only be "all" right now
checkupdate(curwin);
if (checkCloseRec(&curwin->w_folds, curwin->w_cursor.lnum,
(int)curwin->w_p_fdl))
changed_window_setting();
}
}
// checkCloseRec() {{{2
@ -1077,8 +1078,10 @@ foldAdjustVisual(void)
}
if (hasFolding(start->lnum, &start->lnum, NULL))
start->col = 0;
if (hasFolding(end->lnum, NULL, &end->lnum))
{
if (!hasFolding(end->lnum, NULL, &end->lnum))
return;
ptr = ml_get(end->lnum);
end->col = (colnr_T)STRLEN(ptr);
if (end->col > 0 && *p_sel == 'o')
@ -1086,7 +1089,6 @@ foldAdjustVisual(void)
// prevent cursor from moving on the trail byte
if (has_mbyte)
mb_adjust_cursor();
}
}
// cursor_foldstart() {{{2
@ -1215,11 +1217,11 @@ foldLevelWin(win_T *wp, linenr_T lnum)
static void
checkupdate(win_T *wp)
{
if (wp->w_foldinvalid)
{
if (!wp->w_foldinvalid)
return;
foldUpdate(wp, (linenr_T)1, (linenr_T)MAXLNUM); // will update all
wp->w_foldinvalid = FALSE;
}
}
// setFoldRepeat() {{{2

View File

@ -259,11 +259,11 @@ delete_buff_tail(buffheader_T *buf, int slen)
if (buf->bh_curr == NULL)
return; // nothing to delete
len = (int)STRLEN(buf->bh_curr->b_str);
if (len >= slen)
{
if (len < slen)
return;
buf->bh_curr->b_str[len - slen] = NUL;
buf->bh_space += slen;
}
}
/*
@ -478,12 +478,12 @@ flush_buffers(flush_buffers_T flush_typeahead)
void
ResetRedobuff(void)
{
if (!block_redo)
{
if (block_redo)
return;
free_buff(&old_redobuff);
old_redobuff = redobuff;
redobuff.bh_first.b_next = NULL;
}
}
/*
@ -493,15 +493,15 @@ ResetRedobuff(void)
void
CancelRedo(void)
{
if (!block_redo)
{
if (block_redo)
return;
free_buff(&redobuff);
redobuff = old_redobuff;
old_redobuff.bh_first.b_next = NULL;
start_stuff();
while (read_readbuffers(TRUE) != NUL)
;
}
}
/*
@ -520,11 +520,11 @@ saveRedobuff(save_redo_T *save_redo)
// Make a copy, so that ":normal ." in a function works.
s = get_buffcont(&save_redo->sr_redobuff, FALSE);
if (s != NULL)
{
if (s == NULL)
return;
add_buff(&redobuff, s, -1L);
vim_free(s);
}
}
/*
@ -944,15 +944,15 @@ stop_redo_ins(void)
static void
init_typebuf(void)
{
if (typebuf.tb_buf == NULL)
{
if (typebuf.tb_buf != NULL)
return;
typebuf.tb_buf = typebuf_init;
typebuf.tb_noremap = noremapbuf_init;
typebuf.tb_buflen = TYPELEN_INIT;
typebuf.tb_len = 0;
typebuf.tb_off = MAXMAPLEN + 4;
typebuf.tb_change_cnt = 1;
}
}
/*
@ -1324,11 +1324,11 @@ gotchars(char_u *chars, int len)
void
ungetchars(int len)
{
if (reg_recording != 0)
{
if (reg_recording == 0)
return;
delete_buff_tail(&recordbuff, len);
last_recorded_len -= len;
}
}
/*
@ -2230,8 +2230,9 @@ f_getcharstr(typval_T *argvars, typval_T *rettv)
{
getchar_common(argvars, rettv);
if (rettv->v_type == VAR_NUMBER)
{
if (rettv->v_type != VAR_NUMBER)
return;
char_u temp[7]; // mbyte-char: 6, NUL: 1
varnumber_T n = rettv->vval.v_number;
int i = 0;
@ -2246,7 +2247,6 @@ f_getcharstr(typval_T *argvars, typval_T *rettv)
temp[i++] = NUL;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(temp);
}
}
/*
@ -4031,10 +4031,10 @@ do_cmdkey_command(int key UNUSED, int flags)
void
reset_last_used_map(mapblock_T *mp)
{
if (last_used_map == mp)
{
if (last_used_map != mp)
return;
last_used_map = NULL;
last_used_sid = -1;
}
}
#endif

View File

@ -1171,9 +1171,11 @@ gui_update_cursor(
return;
gui_check_pos();
if (!gui.cursor_is_valid || force
|| gui.row != gui.cursor_row || gui.col != gui.cursor_col)
{
if (gui.cursor_is_valid && !force
&& gui.row == gui.cursor_row && gui.col == gui.cursor_col)
return;
gui_undraw_cursor();
// If a cursor-less sleep is ongoing, leave the cursor invisible
@ -1392,7 +1394,6 @@ gui_update_cursor(
#endif
}
gui.highlight_mask = old_hl_mask;
}
}
#if defined(FEAT_MENU) || defined(PROTO)
@ -2054,13 +2055,13 @@ gui_write(
void
gui_dont_update_cursor(int undraw)
{
if (gui.in_use)
{
if (!gui.in_use)
return;
// Undraw the cursor now, we probably can't do it after the change.
if (undraw)
gui_undraw_cursor();
can_update_cursor = FALSE;
}
}
void
@ -2679,8 +2680,9 @@ gui_outstr_nowrap(
void
gui_undraw_cursor(void)
{
if (gui.cursor_is_valid)
{
if (!gui.cursor_is_valid)
return;
// Always redraw the character just before if there is one, because
// with some fonts and characters there can be a one pixel overlap.
int startcol = gui.cursor_col > 0 ? gui.cursor_col - 1 : gui.cursor_col;
@ -2695,7 +2697,6 @@ gui_undraw_cursor(void)
// Cursor_is_valid is reset when the cursor is undrawn, also reset it
// here in case it wasn't needed to undraw it.
gui.cursor_is_valid = FALSE;
}
}
void
@ -3559,8 +3560,9 @@ gui_init_which_components(char_u *oldval UNUSED)
break;
}
if (gui.in_use)
{
if (!gui.in_use)
return;
need_set_size = 0;
fix_size = FALSE;
@ -3689,7 +3691,6 @@ gui_init_which_components(char_u *oldval UNUSED)
// change.
if (firstwin->w_winrow != tabline_height())
shell_new_rows(); // recompute window positions and heights
}
}
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
@ -4768,7 +4769,7 @@ gui_mouse_focus(int x, int y)
return;
/*
* format a mouse click on status line input
* Format a mouse click on status line input,
* ala gui_send_mouse_event(0, x, y, 0, 0);
* Trick: Use a column number -1, so that get_pseudo_mouse_code() will
* generate a K_LEFTMOUSE_NM key code.
@ -4852,13 +4853,14 @@ gui_mouse_correct(void)
need_mouse_correct = FALSE;
wp = gui_mouse_window(IGNORE_POPUP);
if (wp != curwin && wp != NULL) // If in other than current window
{
if (wp == curwin || wp == NULL)
return;
// If in other than current window
validate_cline_row();
gui_mch_setmouse((int)W_ENDCOL(curwin) * gui.char_width - 3,
(W_WINROW(curwin) + curwin->w_wrow) * gui.char_height
+ (gui.char_height) / 2);
}
}
/*
@ -5014,9 +5016,14 @@ display_errors(void)
char_u *p;
if (isatty(2))
fflush(stderr);
else if (error_ga.ga_data != NULL)
{
fflush(stderr);
return;
}
if (error_ga.ga_data == NULL)
return;
// avoid putting up a message box with blanks only
for (p = (char_u *)error_ga.ga_data; *p != NUL; ++p)
if (!isspace(*p))
@ -5029,7 +5036,6 @@ display_errors(void)
break;
}
ga_clear(&error_ga);
}
}
#endif
@ -5339,12 +5345,12 @@ gui_wingoto_xy(int x, int y)
int col = X_2_COL(x);
win_T *wp;
if (row >= 0 && col >= 0)
{
if (row < 0 || col < 0)
return;
wp = mouse_find_win(&row, &col, FAIL_POPUP);
if (wp != NULL && wp != curwin)
win_goto(wp);
}
}
/*

View File

@ -373,8 +373,9 @@ pointer_event(BalloonEval *beval, int x, int y, unsigned state)
distance = ABS(x - beval->x) + ABS(y - beval->y);
if (distance > 4)
{
if (distance <= 4)
return;
/*
* Moved out of the balloon location: cancel it.
* Remember button state
@ -407,7 +408,6 @@ pointer_event(BalloonEval *beval, int x, int y, unsigned state)
&timeout_cb, beval);
}
}
}
}
static void
@ -698,8 +698,9 @@ timerRoutine(XtPointer dx, XtIntervalId *id UNUSED)
static void
requestBalloon(BalloonEval *beval)
{
if (beval->showState != ShS_PENDING)
{
if (beval->showState == ShS_PENDING)
return;
// Determine the beval to display
if (beval->msgCB != NULL)
{
@ -708,7 +709,6 @@ requestBalloon(BalloonEval *beval)
}
else if (beval->msg != NULL)
drawBalloon(beval);
}
}
#ifdef FEAT_GUI_GTK
@ -900,8 +900,9 @@ set_printable_label_text(GtkLabel *label, char_u *text)
static void
drawBalloon(BalloonEval *beval)
{
if (beval->msg != NULL)
{
if (beval->msg == NULL)
return;
GtkRequisition requisition;
int screen_w;
int screen_h;
@ -978,7 +979,6 @@ drawBalloon(BalloonEval *beval)
beval->showState = ShS_SHOWING;
gui_mch_update();
}
}
/*
@ -1060,8 +1060,9 @@ drawBalloon(BalloonEval *beval)
Position tx;
Position ty;
if (beval->msg != NULL)
{
if (beval->msg == NULL)
return;
XmString s;
// Show the Balloon
@ -1118,7 +1119,6 @@ drawBalloon(BalloonEval *beval)
beval->showState = ShS_SHOWING;
current_beval = beval;
}
}
/*
@ -1161,7 +1161,6 @@ createBalloonEvalWindow(BalloonEval *beval)
beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval",
overrideShellWidgetClass, gui.dpy, args, n);
{
XmFontList fl;
n = 0;
@ -1172,7 +1171,6 @@ createBalloonEvalWindow(BalloonEval *beval)
XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
beval->balloonLabel = XtCreateManagedWidget("balloonLabel",
xmLabelWidgetClass, beval->balloonShell, args, n);
}
}
#endif // !FEAT_GUI_GTK

View File

@ -924,8 +924,9 @@ get_menu_position(vimmenu_T *menu)
void
gui_mch_menu_set_tip(vimmenu_T *menu)
{
if (menu->id != NULL && menu->parent != NULL && gui.toolbar != NULL)
{
if (menu->id == NULL || menu->parent == NULL || gui.toolbar == NULL)
return;
char_u *tooltip;
tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]);
@ -939,7 +940,6 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
menu->id, (const char *)tooltip, NULL);
# endif
CONVERT_TO_UTF8_FREE(tooltip);
}
}
#endif // FEAT_TOOLBAR
@ -1007,8 +1007,9 @@ gui_mch_destroy_menu(vimmenu_T *menu)
void
gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)
{
if (sb->id != NULL)
{
if (sb->id == NULL)
return;
GtkAdjustment *adjustment;
// ignore events triggered by moving the thumb (happens in GTK 3)
@ -1034,7 +1035,6 @@ gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)
g_signal_handler_unblock(G_OBJECT(adjustment),
(gulong)sb->handler_id);
}
}
void
@ -1157,8 +1157,9 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
sb->id = gtk_vscrollbar_new(NULL);
#endif
if (sb->id != NULL)
{
if (sb->id == NULL)
return;
GtkAdjustment *adjustment;
gtk_widget_set_can_focus(sb->id, FALSE);
@ -1171,7 +1172,6 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
G_CALLBACK(adjustment_value_changed),
GINT_TO_POINTER(sb->ident));
gui_mch_update();
}
}
void
@ -1994,9 +1994,9 @@ gui_make_popup(char_u *path_name, int mouse_pos)
popup_mouse_pos = mouse_pos;
menu = gui_find_menu(path_name);
if (menu == NULL || menu->submenu_id == NULL)
return;
if (menu != NULL && menu->submenu_id != NULL)
{
# if GTK_CHECK_VERSION(3,22,2)
GdkWindow * const win = gtk_widget_get_window(gui.drawarea);
GdkEventButton trigger;
@ -2046,7 +2046,6 @@ gui_make_popup(char_u *path_name, int mouse_pos)
&popup_menu_position_func, NULL,
0U, (guint32)GDK_CURRENT_TIME);
# endif
}
}
#endif // FEAT_MENU

View File

@ -188,14 +188,14 @@ gui_gtk_form_thaw(GtkForm *form)
{
g_return_if_fail(GTK_IS_FORM(form));
if (form->freeze_count)
{
if (!form->freeze_count)
return;
if (!(--form->freeze_count))
{
form_position_children(form);
gtk_widget_queue_draw(GTK_WIDGET(form));
}
}
}
// Basic Object handling procedures
@ -610,8 +610,9 @@ form_remove(GtkContainer *container, GtkWidget *widget)
tmp_list = tmp_list->next;
}
if (tmp_list)
{
if (tmp_list == NULL)
return;
#if GTK_CHECK_VERSION(3,0,0)
const gboolean was_visible = gtk_widget_get_visible(widget);
#endif
@ -635,7 +636,6 @@ form_remove(GtkContainer *container, GtkWidget *widget)
form->children = g_list_remove_link(form->children, tmp_list);
g_list_free_1(tmp_list);
g_free(child);
}
}
static void

View File

@ -2435,16 +2435,15 @@ setup_save_yourself(void)
GnomeClient *client;
client = gnome_master_client();
if (client == NULL)
return;
if (client != NULL)
{
// Must use the deprecated gtk_signal_connect() for compatibility
// with GNOME 1. Arrgh, zombies!
gtk_signal_connect(GTK_OBJECT(client), "save_yourself",
GTK_SIGNAL_FUNC(&sm_client_save_yourself), NULL);
gtk_signal_connect(GTK_OBJECT(client), "die",
GTK_SIGNAL_FUNC(&sm_client_die), NULL);
}
}
#else // !USE_GNOME_SESSION
@ -3379,13 +3378,13 @@ on_tab_reordered(
gint idx,
gpointer data UNUSED)
{
if (!ignore_tabline_evt)
{
if (ignore_tabline_evt)
return;
if ((tabpage_index(curtab) - 1) < idx)
tabpage_move(idx + 1);
else
tabpage_move(idx);
}
}
# endif
@ -4069,15 +4068,15 @@ gui_mch_init(void)
void
gui_mch_forked(void)
{
if (using_gnome)
{
if (!using_gnome)
return;
GnomeClient *client;
client = gnome_master_client();
if (client != NULL)
gnome_client_set_process_id(client, getpid());
}
}
#endif // USE_GNOME_SESSION
@ -6860,11 +6859,11 @@ clip_mch_request_selection(Clipboard_T *cbd)
void
clip_mch_lose_selection(Clipboard_T *cbd UNUSED)
{
if (!in_selection_clear_event)
{
if (in_selection_clear_event)
return;
gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time);
gui_mch_update();
}
}
/*
@ -7029,8 +7028,9 @@ static int last_shape = 0;
void
gui_mch_mousehide(int hide)
{
if (gui.pointer_hidden != hide)
{
if (gui.pointer_hidden == hide)
return;
gui.pointer_hidden = hide;
if (gtk_widget_get_window(gui.drawarea) && gui.blank_pointer != NULL)
{
@ -7044,7 +7044,6 @@ gui_mch_mousehide(int hide)
gdk_window_set_cursor(gtk_widget_get_window(gui.drawarea), NULL);
#endif
}
}
}
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
@ -7132,9 +7131,10 @@ gui_mch_drawsign(int row, int col, int typenr)
sign = (GdkPixbuf *)sign_get_image(typenr);
if (sign != NULL && gui.drawarea != NULL
&& gtk_widget_get_window(gui.drawarea) != NULL)
{
if (sign == NULL || gui.drawarea == NULL
|| gtk_widget_get_window(gui.drawarea) == NULL)
return;
int width;
int height;
int xoffset;
@ -7266,7 +7266,6 @@ gui_mch_drawsign(int row, int col, int typenr)
# endif // !GTK_CHECK_VERSION(3,0,0)
if (need_scale)
g_object_unref(sign);
}
}
void *

View File

@ -979,14 +979,14 @@ gui_motif_add_actext(vimmenu_T *menu)
XmString label;
// Add accelerator text, if there is one
if (menu->actext != NULL && menu->id != (Widget)0)
{
if (menu->actext == NULL || menu->id == (Widget)0)
return;
label = XmStringCreate((char *)menu->actext, STRING_TAG);
if (label == NULL)
return;
XtVaSetValues(menu->id, XmNacceleratorText, label, NULL);
XmStringFree(label);
}
}
void
@ -1573,8 +1573,9 @@ gui_mch_destroy_menu(vimmenu_T *menu)
menu->submenu_id = (Widget)0;
}
if (menu->id != (Widget)0)
{
if (menu->id == (Widget)0)
return;
Widget parent;
parent = XtParent(menu->id);
@ -1610,7 +1611,6 @@ gui_mch_destroy_menu(vimmenu_T *menu)
gui.toolbar_height = gui_mch_compute_toolbar_height();
}
#endif
}
}
void
@ -1630,8 +1630,9 @@ gui_mch_show_popupmenu(vimmenu_T *menu UNUSED)
void
gui_mch_def_colors(void)
{
if (gui.in_use)
{
if (!gui.in_use)
return;
gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name);
gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name);
gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name);
@ -1642,7 +1643,6 @@ gui_mch_def_colors(void)
gui.tooltip_bg_pixel =
gui_get_color((char_u *)gui.rsrc_tooltip_bg_name);
#endif
}
}
@ -1674,8 +1674,9 @@ gui_mch_set_scrollbar_pos(
int w,
int h)
{
if (sb->id != (Widget)0)
{
if (sb->id == (Widget)0)
return;
if (sb->type == SBAR_LEFT || sb->type == SBAR_RIGHT)
{
if (y == 0)
@ -1697,7 +1698,6 @@ gui_mch_set_scrollbar_pos(
XmNheight, h,
NULL);
XtManageChild(sb->id);
}
}
int
@ -1732,8 +1732,9 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
Arg args[16];
int n;
if (sb->id != (Widget)0)
{
if (sb->id == (Widget)0)
return;
n = 0;
if (flag)
{
@ -1778,7 +1779,6 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
}
XtUnmanageChild(sb->id);
}
}
}
void
@ -1817,9 +1817,9 @@ gui_mch_create_scrollbar(
sb->id = XtCreateWidget("scrollBar",
xmScrollBarWidgetClass, textAreaForm, args, n);
if (sb->id == (Widget)0)
return;
if (sb->id != (Widget)0)
{
gui_mch_set_scrollbar_colors(sb);
XtAddCallback(sb->id, XmNvalueChangedCallback,
scroll_cb, (XtPointer)sb->ident);
@ -1827,7 +1827,6 @@ gui_mch_create_scrollbar(
scroll_cb, (XtPointer)sb->ident);
XtAddEventHandler(sb->id, KeyPressMask, FALSE, gui_x11_key_hit_cb,
(XtPointer)0);
}
}
void

View File

@ -992,8 +992,9 @@ gui_ph_pg_add_buffer(char *name)
char **new_titles = NULL;
new_titles = ALLOC_MULT(char *, (num_panels + 1));
if (new_titles != NULL)
{
if (new_titles == NULL)
return;
if (num_panels > 0)
memcpy(new_titles, panel_titles, num_panels * sizeof(char **));
@ -1004,7 +1005,6 @@ gui_ph_pg_add_buffer(char *name)
vim_free(panel_titles);
panel_titles = new_titles;
}
}
static void
@ -1901,8 +1901,9 @@ mch_set_mouse_shape(int shape)
void
gui_mch_mousehide(int hide)
{
if (gui.pointer_hidden != hide)
{
if (gui.pointer_hidden == hide)
return;
gui.pointer_hidden = hide;
#ifdef FEAT_MOUSESHAPE
if (hide)
@ -1915,7 +1916,6 @@ gui_mch_mousehide(int hide)
(hide == MOUSE_SHOW) ? GUI_PH_MOUSE_TYPE : Ph_CURSOR_NONE,
0);
#endif
}
}
void

View File

@ -434,12 +434,12 @@ directx_enabled(void)
static void
directx_binddc(void)
{
if (s_textArea != NULL)
{
if (s_textArea == NULL)
return;
RECT rect;
GetClientRect(s_textArea, &rect);
DWriteContext_BindDC(s_dwc, s_hdc, &rect);
}
}
#endif
@ -663,14 +663,14 @@ gui_mswin_rm_blink_timer(void)
{
MSG msg;
if (blink_timer != 0)
{
if (blink_timer == 0)
return;
KillTimer(NULL, blink_timer);
// Eat spurious WM_TIMER messages
while (PeekMessageW(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
blink_timer = 0;
}
}
/*
@ -1034,8 +1034,10 @@ _OnMouseButtonDown(
else
button = MOUSE_LEFT;
}
if (button >= 0)
{
if (button < 0)
return;
repeated_click = ((int)(currentTime - s_prevTime) < p_mouset);
/*
@ -1090,7 +1092,6 @@ _OnMouseButtonDown(
}
s_prevTime = currentTime;
}
}
static void
@ -1233,8 +1234,9 @@ _OnFindRepl(void)
flags = FRD_REPLACEALL;
}
if (flags != 0)
{
if (flags == 0)
return;
char_u *p, *q;
// Call the generic GUI function to do the actual work.
@ -1249,7 +1251,6 @@ _OnFindRepl(void)
gui_do_findrepl(flags, p, q, down);
vim_free(p);
vim_free(q);
}
}
#endif
@ -2932,11 +2933,11 @@ gui_mch_replace_dialog(exarg_T *eap)
void
gui_mch_mousehide(int hide)
{
if (hide != gui.pointer_hidden)
{
if (hide == gui.pointer_hidden)
return;
ShowCursor(!hide);
gui.pointer_hidden = hide;
}
}
#ifdef FEAT_MENU
@ -2993,8 +2994,9 @@ _OnDestroy(HWND hwnd)
_OnPaint(
HWND hwnd)
{
if (!IsMinimized(hwnd))
{
if (IsMinimized(hwnd))
return;
PAINTSTRUCT ps;
out_flush(); // make sure all output has been processed
@ -3019,7 +3021,6 @@ _OnPaint(
}
EndPaint(hwnd, &ps);
}
}
static void
@ -3904,8 +3905,9 @@ _OnDropFiles(
DragFinish(hDrop);
if (fnames != NULL)
{
if (fnames == NULL)
return;
int kbd_modifiers = get_active_modifiers();
if ((kbd_modifiers & MOD_MASK_SHIFT) != 0)
@ -3918,7 +3920,6 @@ _OnDropFiles(
gui_handle_drop(pt.x, pt.y, modifiers, fnames, cFiles);
s_need_activate = TRUE;
}
}
static int
@ -4461,11 +4462,11 @@ show_sizing_tip(int cols, int rows)
static void
destroy_sizing_tip(void)
{
if (hwndTip != NULL)
{
if (hwndTip == NULL)
return;
DestroyWindow(hwndTip);
hwndTip = NULL;
}
}
static int
@ -5844,8 +5845,9 @@ im_set_active(int active)
}
# endif
if (pImmGetContext) // if NULL imm32.dll wasn't loaded (yet)
{
if (!pImmGetContext) // if NULL imm32.dll wasn't loaded (yet)
return;
if (p_imdisable)
{
if (hImcOld == (HIMC)0)
@ -5863,8 +5865,9 @@ im_set_active(int active)
}
hImc = pImmGetContext(s_hwnd);
if (hImc)
{
if (!hImc)
return;
/*
* for Korean ime
*/
@ -5900,8 +5903,6 @@ im_set_active(int active)
pImmSetOpenStatus(hImc, active);
pImmReleaseContext(s_hwnd, hImc);
}
}
}
/*
@ -6459,8 +6460,9 @@ gui_make_popup(char_u *path_name, int mouse_pos)
{
vimmenu_T *menu = gui_find_menu(path_name);
if (menu != NULL)
{
if (menu == NULL)
return;
POINT p;
// Find the position of the current cursor
@ -6480,7 +6482,6 @@ gui_make_popup(char_u *path_name, int mouse_pos)
}
msg_scroll = FALSE;
gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y);
}
}
# if defined(FEAT_TEAROFF) || defined(PROTO)
@ -8274,7 +8275,9 @@ gui_mch_drawsign(int row, int col, int typenr)
static void
close_signicon_image(signicon_t *sign)
{
if (sign)
if (sign == NULL)
return;
switch (sign->uType)
{
case IMAGE_BITMAP:
@ -8347,11 +8350,11 @@ gui_mch_register_sign(char_u *signfile)
void
gui_mch_destroy_sign(void *sign)
{
if (sign)
{
if (sign == NULL)
return;
close_signicon_image((signicon_t *)sign);
vim_free(sign);
}
}
#endif
@ -8561,8 +8564,9 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
if (pnmh->idFrom != ID_BEVAL_TOOLTIP) // it is not our tooltip
return;
if (cur_beval != NULL)
{
if (cur_beval == NULL)
return;
switch (pnmh->code)
{
case TTN_SHOW:
@ -8590,7 +8594,6 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
}
break;
}
}
}
static void

View File

@ -2194,11 +2194,11 @@ gui_mch_get_rgb_color(int r, int g, int b)
void
gui_mch_set_fg_color(guicolor_T color)
{
if (color != prev_fg_color)
{
if (color == prev_fg_color)
return;
XSetForeground(gui.dpy, gui.text_gc, (Pixel)color);
prev_fg_color = color;
}
}
/*
@ -2207,11 +2207,11 @@ gui_mch_set_fg_color(guicolor_T color)
void
gui_mch_set_bg_color(guicolor_T color)
{
if (color != prev_bg_color)
{
if (color == prev_bg_color)
return;
XSetBackground(gui.dpy, gui.text_gc, (Pixel)color);
prev_bg_color = color;
}
}
/*
@ -2814,8 +2814,9 @@ clip_mch_set_selection(
void
gui_mch_menu_grey(vimmenu_T *menu, int grey)
{
if (menu->id != (Widget)0)
{
if (menu->id == (Widget)0)
return;
gui_mch_menu_hidden(menu, False);
if (grey
#ifdef FEAT_GUI_MOTIF
@ -2825,7 +2826,6 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
XtSetSensitive(menu->id, False);
else
XtSetSensitive(menu->id, True);
}
}
/*
@ -2834,13 +2834,13 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
void
gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
{
if (menu->id != (Widget)0)
{
if (menu->id == (Widget)0)
return;
if (hidden)
XtUnmanageChild(menu->id);
else
XtManageChild(menu->id);
}
}
/*
@ -3130,15 +3130,15 @@ gui_mch_drawsign(int row, int col, int typenr)
{
XImage *sign;
if (gui.in_use && (sign = (XImage *)sign_get_image(typenr)) != NULL)
{
if (!gui.in_use || (sign = (XImage *)sign_get_image(typenr)) == NULL)
return;
XClearArea(gui.dpy, gui.wid, TEXT_X(col), TEXT_Y(row) - sign->height,
SIGN_WIDTH, gui.char_height, FALSE);
XPutImage(gui.dpy, gui.wid, gui.text_gc, sign, 0, 0,
TEXT_X(col) + (SIGN_WIDTH - sign->width) / 2,
TEXT_Y(row) - sign->height,
sign->width, sign->height);
}
}
void *
@ -3202,8 +3202,9 @@ static int last_shape = 0;
gui_mch_mousehide(
int hide) // TRUE = use blank ptr, FALSE = use parent ptr
{
if (gui.pointer_hidden != hide)
{
if (gui.pointer_hidden == hide)
return;
gui.pointer_hidden = hide;
if (hide)
XDefineCursor(gui.dpy, gui.wid, gui.blank_pointer);
@ -3213,7 +3214,6 @@ gui_mch_mousehide(
#else
XUndefineCursor(gui.dpy, gui.wid);
#endif
}
}
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
@ -3280,9 +3280,10 @@ mch_set_mouse_shape(int shape)
void
gui_mch_menu_set_tip(vimmenu_T *menu)
{
if (menu->id != NULL && menu->parent != NULL
&& menu_is_toolbar(menu->parent->name))
{
if (menu->id == NULL || menu->parent == NULL
|| !menu_is_toolbar(menu->parent->name))
return;
// Always destroy and create the balloon, in case the string was
// changed.
if (menu->tip != NULL)
@ -3296,6 +3297,5 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
menu->strings[MENU_INDEX_TIP],
NULL,
NULL);
}
}
#endif

View File

@ -199,20 +199,21 @@ im_set_active(int active)
void
xim_set_focus(int focus)
{
if (xic != NULL)
{
if (xic == NULL)
return;
if (focus)
gtk_im_context_focus_in(xic);
else
gtk_im_context_focus_out(xic);
}
}
void
im_set_position(int row, int col)
{
if (xic != NULL)
{
if (xic == NULL)
return;
GdkRectangle area;
area.x = FILL_X(col);
@ -224,7 +225,6 @@ im_set_position(int row, int col)
if (p_imst == IM_OVER_THE_SPOT)
im_preedit_window_set_position();
}
}
# if 0 || defined(PROTO) // apparently only used in gui_x11.c

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1158,
/**/
1157,
/**/