mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -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:
committed by
Bram Moolenaar
parent
df8f947359
commit
7f8b2559a3
624
src/gui.c
624
src/gui.c
@@ -1171,71 +1171,73 @@ gui_update_cursor(
|
||||
return;
|
||||
|
||||
gui_check_pos();
|
||||
if (!gui.cursor_is_valid || force
|
||||
|| gui.row != gui.cursor_row || gui.col != gui.cursor_col)
|
||||
{
|
||||
gui_undraw_cursor();
|
||||
|
||||
// If a cursor-less sleep is ongoing, leave the cursor invisible
|
||||
if (cursor_is_sleeping())
|
||||
return;
|
||||
if (gui.cursor_is_valid && !force
|
||||
&& gui.row == gui.cursor_row && gui.col == gui.cursor_col)
|
||||
return;
|
||||
|
||||
if (gui.row < 0)
|
||||
return;
|
||||
gui_undraw_cursor();
|
||||
|
||||
// If a cursor-less sleep is ongoing, leave the cursor invisible
|
||||
if (cursor_is_sleeping())
|
||||
return;
|
||||
|
||||
if (gui.row < 0)
|
||||
return;
|
||||
#ifdef HAVE_INPUT_METHOD
|
||||
if (gui.row != gui.cursor_row || gui.col != gui.cursor_col)
|
||||
im_set_position(gui.row, gui.col);
|
||||
if (gui.row != gui.cursor_row || gui.col != gui.cursor_col)
|
||||
im_set_position(gui.row, gui.col);
|
||||
#endif
|
||||
gui.cursor_row = gui.row;
|
||||
gui.cursor_col = gui.col;
|
||||
gui.cursor_row = gui.row;
|
||||
gui.cursor_col = gui.col;
|
||||
|
||||
// Only write to the screen after ScreenLines[] has been initialized
|
||||
if (!screen_cleared || ScreenLines == NULL)
|
||||
return;
|
||||
// Only write to the screen after ScreenLines[] has been initialized
|
||||
if (!screen_cleared || ScreenLines == NULL)
|
||||
return;
|
||||
|
||||
// Clear the selection if we are about to write over it
|
||||
if (clear_selection)
|
||||
clip_may_clear_selection(gui.row, gui.row);
|
||||
// Check that the cursor is inside the shell (resizing may have made
|
||||
// it invalid)
|
||||
if (gui.row >= screen_Rows || gui.col >= screen_Columns)
|
||||
return;
|
||||
// Clear the selection if we are about to write over it
|
||||
if (clear_selection)
|
||||
clip_may_clear_selection(gui.row, gui.row);
|
||||
// Check that the cursor is inside the shell (resizing may have made
|
||||
// it invalid)
|
||||
if (gui.row >= screen_Rows || gui.col >= screen_Columns)
|
||||
return;
|
||||
|
||||
gui.cursor_is_valid = TRUE;
|
||||
gui.cursor_is_valid = TRUE;
|
||||
|
||||
/*
|
||||
* How the cursor is drawn depends on the current mode.
|
||||
* When in a terminal window use the shape/color specified there.
|
||||
*/
|
||||
/*
|
||||
* How the cursor is drawn depends on the current mode.
|
||||
* When in a terminal window use the shape/color specified there.
|
||||
*/
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (terminal_is_active())
|
||||
shape = term_get_cursor_shape(&shape_fg, &shape_bg);
|
||||
else
|
||||
if (terminal_is_active())
|
||||
shape = term_get_cursor_shape(&shape_fg, &shape_bg);
|
||||
else
|
||||
#endif
|
||||
shape = &shape_table[get_shape_idx(FALSE)];
|
||||
if (State & MODE_LANGMAP)
|
||||
id = shape->id_lm;
|
||||
else
|
||||
id = shape->id;
|
||||
shape = &shape_table[get_shape_idx(FALSE)];
|
||||
if (State & MODE_LANGMAP)
|
||||
id = shape->id_lm;
|
||||
else
|
||||
id = shape->id;
|
||||
|
||||
// get the colors and attributes for the cursor. Default is inverted
|
||||
cfg = INVALCOLOR;
|
||||
cbg = INVALCOLOR;
|
||||
cattr = HL_INVERSE;
|
||||
gui_mch_set_blinking(shape->blinkwait,
|
||||
shape->blinkon,
|
||||
shape->blinkoff);
|
||||
if (shape->blinkwait == 0 || shape->blinkon == 0
|
||||
|| shape->blinkoff == 0)
|
||||
gui_mch_stop_blink(FALSE);
|
||||
// get the colors and attributes for the cursor. Default is inverted
|
||||
cfg = INVALCOLOR;
|
||||
cbg = INVALCOLOR;
|
||||
cattr = HL_INVERSE;
|
||||
gui_mch_set_blinking(shape->blinkwait,
|
||||
shape->blinkon,
|
||||
shape->blinkoff);
|
||||
if (shape->blinkwait == 0 || shape->blinkon == 0
|
||||
|| shape->blinkoff == 0)
|
||||
gui_mch_stop_blink(FALSE);
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (shape_bg != INVALCOLOR)
|
||||
{
|
||||
cattr = 0;
|
||||
cfg = shape_fg;
|
||||
cbg = shape_bg;
|
||||
}
|
||||
else
|
||||
if (shape_bg != INVALCOLOR)
|
||||
{
|
||||
cattr = 0;
|
||||
cfg = shape_fg;
|
||||
cbg = shape_bg;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (id > 0)
|
||||
{
|
||||
@@ -1251,7 +1253,7 @@ gui_update_cursor(
|
||||
# else
|
||||
im_get_status()
|
||||
# endif
|
||||
)
|
||||
)
|
||||
{
|
||||
iid = syn_name2id((char_u *)"CursorIM");
|
||||
if (iid > 0)
|
||||
@@ -1267,132 +1269,131 @@ gui_update_cursor(
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the attributes for the character under the cursor.
|
||||
* When no cursor color was given, use the character color.
|
||||
*/
|
||||
attr = ScreenAttrs[LineOffset[gui.row] + gui.col];
|
||||
if (attr > HL_ALL)
|
||||
aep = syn_gui_attr2entry(attr);
|
||||
if (aep != NULL)
|
||||
{
|
||||
attr = aep->ae_attr;
|
||||
if (cfg == INVALCOLOR)
|
||||
cfg = ((attr & HL_INVERSE) ? aep->ae_u.gui.bg_color
|
||||
: aep->ae_u.gui.fg_color);
|
||||
if (cbg == INVALCOLOR)
|
||||
cbg = ((attr & HL_INVERSE) ? aep->ae_u.gui.fg_color
|
||||
: aep->ae_u.gui.bg_color);
|
||||
}
|
||||
/*
|
||||
* Get the attributes for the character under the cursor.
|
||||
* When no cursor color was given, use the character color.
|
||||
*/
|
||||
attr = ScreenAttrs[LineOffset[gui.row] + gui.col];
|
||||
if (attr > HL_ALL)
|
||||
aep = syn_gui_attr2entry(attr);
|
||||
if (aep != NULL)
|
||||
{
|
||||
attr = aep->ae_attr;
|
||||
if (cfg == INVALCOLOR)
|
||||
cfg = (attr & HL_INVERSE) ? gui.back_pixel : gui.norm_pixel;
|
||||
cfg = ((attr & HL_INVERSE) ? aep->ae_u.gui.bg_color
|
||||
: aep->ae_u.gui.fg_color);
|
||||
if (cbg == INVALCOLOR)
|
||||
cbg = (attr & HL_INVERSE) ? gui.norm_pixel : gui.back_pixel;
|
||||
cbg = ((attr & HL_INVERSE) ? aep->ae_u.gui.fg_color
|
||||
: aep->ae_u.gui.bg_color);
|
||||
}
|
||||
if (cfg == INVALCOLOR)
|
||||
cfg = (attr & HL_INVERSE) ? gui.back_pixel : gui.norm_pixel;
|
||||
if (cbg == INVALCOLOR)
|
||||
cbg = (attr & HL_INVERSE) ? gui.norm_pixel : gui.back_pixel;
|
||||
|
||||
#ifdef FEAT_XIM
|
||||
if (aep != NULL)
|
||||
{
|
||||
xim_bg_color = ((attr & HL_INVERSE) ? aep->ae_u.gui.fg_color
|
||||
: aep->ae_u.gui.bg_color);
|
||||
xim_fg_color = ((attr & HL_INVERSE) ? aep->ae_u.gui.bg_color
|
||||
: aep->ae_u.gui.fg_color);
|
||||
if (xim_bg_color == INVALCOLOR)
|
||||
xim_bg_color = (attr & HL_INVERSE) ? gui.norm_pixel
|
||||
: gui.back_pixel;
|
||||
if (xim_fg_color == INVALCOLOR)
|
||||
xim_fg_color = (attr & HL_INVERSE) ? gui.back_pixel
|
||||
: gui.norm_pixel;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aep != NULL)
|
||||
{
|
||||
xim_bg_color = ((attr & HL_INVERSE) ? aep->ae_u.gui.fg_color
|
||||
: aep->ae_u.gui.bg_color);
|
||||
xim_fg_color = ((attr & HL_INVERSE) ? aep->ae_u.gui.bg_color
|
||||
: aep->ae_u.gui.fg_color);
|
||||
if (xim_bg_color == INVALCOLOR)
|
||||
xim_bg_color = (attr & HL_INVERSE) ? gui.norm_pixel
|
||||
: gui.back_pixel;
|
||||
: gui.back_pixel;
|
||||
if (xim_fg_color == INVALCOLOR)
|
||||
xim_fg_color = (attr & HL_INVERSE) ? gui.back_pixel
|
||||
: gui.norm_pixel;
|
||||
}
|
||||
: gui.norm_pixel;
|
||||
}
|
||||
else
|
||||
{
|
||||
xim_bg_color = (attr & HL_INVERSE) ? gui.norm_pixel
|
||||
: gui.back_pixel;
|
||||
xim_fg_color = (attr & HL_INVERSE) ? gui.back_pixel
|
||||
: gui.norm_pixel;
|
||||
}
|
||||
#endif
|
||||
|
||||
attr &= ~HL_INVERSE;
|
||||
if (cattr & HL_INVERSE)
|
||||
{
|
||||
cc = cbg;
|
||||
cbg = cfg;
|
||||
cfg = cc;
|
||||
}
|
||||
cattr &= ~HL_INVERSE;
|
||||
attr &= ~HL_INVERSE;
|
||||
if (cattr & HL_INVERSE)
|
||||
{
|
||||
cc = cbg;
|
||||
cbg = cfg;
|
||||
cfg = cc;
|
||||
}
|
||||
cattr &= ~HL_INVERSE;
|
||||
|
||||
/*
|
||||
* When we don't have window focus, draw a hollow cursor.
|
||||
*/
|
||||
if (!gui.in_focus)
|
||||
{
|
||||
gui_mch_draw_hollow_cursor(cbg);
|
||||
return;
|
||||
}
|
||||
|
||||
old_hl_mask = gui.highlight_mask;
|
||||
if (shape->shape == SHAPE_BLOCK)
|
||||
{
|
||||
/*
|
||||
* When we don't have window focus, draw a hollow cursor.
|
||||
* Draw the text character with the cursor colors. Use the
|
||||
* character attributes plus the cursor attributes.
|
||||
*/
|
||||
if (!gui.in_focus)
|
||||
gui.highlight_mask = (cattr | attr);
|
||||
(void)gui_screenchar(LineOffset[gui.row] + gui.col,
|
||||
GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR, cfg, cbg, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(FEAT_RIGHTLEFT)
|
||||
int col_off = FALSE;
|
||||
#endif
|
||||
/*
|
||||
* First draw the partial cursor, then overwrite with the text
|
||||
* character, using a transparent background.
|
||||
*/
|
||||
if (shape->shape == SHAPE_VER)
|
||||
{
|
||||
gui_mch_draw_hollow_cursor(cbg);
|
||||
return;
|
||||
}
|
||||
|
||||
old_hl_mask = gui.highlight_mask;
|
||||
if (shape->shape == SHAPE_BLOCK)
|
||||
{
|
||||
/*
|
||||
* Draw the text character with the cursor colors. Use the
|
||||
* character attributes plus the cursor attributes.
|
||||
*/
|
||||
gui.highlight_mask = (cattr | attr);
|
||||
(void)gui_screenchar(LineOffset[gui.row] + gui.col,
|
||||
GUI_MON_IS_CURSOR | GUI_MON_NOCLEAR, cfg, cbg, 0);
|
||||
cur_height = gui.char_height;
|
||||
cur_width = (gui.char_width * shape->percentage + 99) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(FEAT_RIGHTLEFT)
|
||||
int col_off = FALSE;
|
||||
#endif
|
||||
/*
|
||||
* First draw the partial cursor, then overwrite with the text
|
||||
* character, using a transparent background.
|
||||
*/
|
||||
if (shape->shape == SHAPE_VER)
|
||||
{
|
||||
cur_height = gui.char_height;
|
||||
cur_width = (gui.char_width * shape->percentage + 99) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_height = (gui.char_height * shape->percentage + 99) / 100;
|
||||
cur_width = gui.char_width;
|
||||
}
|
||||
if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col,
|
||||
LineOffset[gui.row] + screen_Columns) > 1)
|
||||
{
|
||||
// Double wide character.
|
||||
if (shape->shape != SHAPE_VER)
|
||||
cur_width += gui.char_width;
|
||||
cur_height = (gui.char_height * shape->percentage + 99) / 100;
|
||||
cur_width = gui.char_width;
|
||||
}
|
||||
if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col,
|
||||
LineOffset[gui.row] + screen_Columns) > 1)
|
||||
{
|
||||
// Double wide character.
|
||||
if (shape->shape != SHAPE_VER)
|
||||
cur_width += gui.char_width;
|
||||
#ifdef FEAT_RIGHTLEFT
|
||||
if (CURSOR_BAR_RIGHT)
|
||||
{
|
||||
// gui.col points to the left half of the character but
|
||||
// the vertical line needs to be on the right half.
|
||||
// A double-wide horizontal line is also drawn from the
|
||||
// right half in gui_mch_draw_part_cursor().
|
||||
col_off = TRUE;
|
||||
++gui.col;
|
||||
}
|
||||
#endif
|
||||
if (CURSOR_BAR_RIGHT)
|
||||
{
|
||||
// gui.col points to the left half of the character but
|
||||
// the vertical line needs to be on the right half.
|
||||
// A double-wide horizontal line is also drawn from the
|
||||
// right half in gui_mch_draw_part_cursor().
|
||||
col_off = TRUE;
|
||||
++gui.col;
|
||||
}
|
||||
gui_mch_draw_part_cursor(cur_width, cur_height, cbg);
|
||||
#endif
|
||||
}
|
||||
gui_mch_draw_part_cursor(cur_width, cur_height, cbg);
|
||||
#if defined(FEAT_RIGHTLEFT)
|
||||
if (col_off)
|
||||
--gui.col;
|
||||
if (col_off)
|
||||
--gui.col;
|
||||
#endif
|
||||
|
||||
#ifndef FEAT_GUI_MSWIN // doesn't seem to work for MSWindows
|
||||
gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col];
|
||||
(void)gui_screenchar(LineOffset[gui.row] + gui.col,
|
||||
GUI_MON_TRS_CURSOR | GUI_MON_NOCLEAR,
|
||||
(guicolor_T)0, (guicolor_T)0, 0);
|
||||
gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col];
|
||||
(void)gui_screenchar(LineOffset[gui.row] + gui.col,
|
||||
GUI_MON_TRS_CURSOR | GUI_MON_NOCLEAR,
|
||||
(guicolor_T)0, (guicolor_T)0, 0);
|
||||
#endif
|
||||
}
|
||||
gui.highlight_mask = old_hl_mask;
|
||||
}
|
||||
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)
|
||||
{
|
||||
// Undraw the cursor now, we probably can't do it after the change.
|
||||
if (undraw)
|
||||
gui_undraw_cursor();
|
||||
can_update_cursor = FALSE;
|
||||
}
|
||||
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,23 +2680,23 @@ gui_outstr_nowrap(
|
||||
void
|
||||
gui_undraw_cursor(void)
|
||||
{
|
||||
if (gui.cursor_is_valid)
|
||||
{
|
||||
// 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;
|
||||
int endcol = gui.cursor_col;
|
||||
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;
|
||||
int endcol = gui.cursor_col;
|
||||
|
||||
#ifdef FEAT_GUI_GTK
|
||||
gui_adjust_undraw_cursor_for_ligatures(&startcol, &endcol);
|
||||
gui_adjust_undraw_cursor_for_ligatures(&startcol, &endcol);
|
||||
#endif
|
||||
gui_redraw_block(gui.cursor_row, startcol,
|
||||
gui.cursor_row, endcol, GUI_MON_NOCLEAR);
|
||||
gui_redraw_block(gui.cursor_row, startcol,
|
||||
gui.cursor_row, endcol, GUI_MON_NOCLEAR);
|
||||
|
||||
// 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;
|
||||
}
|
||||
// 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,137 +3560,137 @@ gui_init_which_components(char_u *oldval UNUSED)
|
||||
break;
|
||||
}
|
||||
|
||||
if (gui.in_use)
|
||||
{
|
||||
need_set_size = 0;
|
||||
fix_size = FALSE;
|
||||
if (!gui.in_use)
|
||||
return;
|
||||
|
||||
need_set_size = 0;
|
||||
fix_size = FALSE;
|
||||
|
||||
#ifdef FEAT_GUI_DARKTHEME
|
||||
if (using_dark_theme != prev_dark_theme)
|
||||
{
|
||||
gui_mch_set_dark_theme(using_dark_theme);
|
||||
prev_dark_theme = using_dark_theme;
|
||||
}
|
||||
if (using_dark_theme != prev_dark_theme)
|
||||
{
|
||||
gui_mch_set_dark_theme(using_dark_theme);
|
||||
prev_dark_theme = using_dark_theme;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_GUI_TABLINE
|
||||
// Update the GUI tab line, it may appear or disappear. This may
|
||||
// cause the non-GUI tab line to disappear or appear.
|
||||
using_tabline = gui_has_tabline();
|
||||
if (!gui_mch_showing_tabline() != !using_tabline)
|
||||
{
|
||||
// We don't want a resize event change "Rows" here, save and
|
||||
// restore it. Resizing is handled below.
|
||||
i = Rows;
|
||||
gui_update_tabline();
|
||||
Rows = i;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (using_tabline)
|
||||
fix_size = TRUE;
|
||||
if (!gui_use_tabline())
|
||||
redraw_tabline = TRUE; // may draw non-GUI tab line
|
||||
}
|
||||
// Update the GUI tab line, it may appear or disappear. This may
|
||||
// cause the non-GUI tab line to disappear or appear.
|
||||
using_tabline = gui_has_tabline();
|
||||
if (!gui_mch_showing_tabline() != !using_tabline)
|
||||
{
|
||||
// We don't want a resize event change "Rows" here, save and
|
||||
// restore it. Resizing is handled below.
|
||||
i = Rows;
|
||||
gui_update_tabline();
|
||||
Rows = i;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (using_tabline)
|
||||
fix_size = TRUE;
|
||||
if (!gui_use_tabline())
|
||||
redraw_tabline = TRUE; // may draw non-GUI tab line
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
// The scrollbar needs to be updated when it is shown/unshown and
|
||||
// when switching tab pages. But the size only changes when it's
|
||||
// shown/unshown. Thus we need two places to remember whether a
|
||||
// scrollbar is there or not.
|
||||
if (gui.which_scrollbars[i] != prev_which_scrollbars[i]
|
||||
|| gui.which_scrollbars[i]
|
||||
!= curtab->tp_prev_which_scrollbars[i])
|
||||
{
|
||||
// The scrollbar needs to be updated when it is shown/unshown and
|
||||
// when switching tab pages. But the size only changes when it's
|
||||
// shown/unshown. Thus we need two places to remember whether a
|
||||
// scrollbar is there or not.
|
||||
if (gui.which_scrollbars[i] != prev_which_scrollbars[i]
|
||||
|| gui.which_scrollbars[i]
|
||||
!= curtab->tp_prev_which_scrollbars[i])
|
||||
if (i == SBAR_BOTTOM)
|
||||
gui_mch_enable_scrollbar(&gui.bottom_sbar,
|
||||
gui.which_scrollbars[i]);
|
||||
else
|
||||
{
|
||||
FOR_ALL_WINDOWS(wp)
|
||||
gui_do_scrollbar(wp, i, gui.which_scrollbars[i]);
|
||||
}
|
||||
if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
|
||||
{
|
||||
if (i == SBAR_BOTTOM)
|
||||
gui_mch_enable_scrollbar(&gui.bottom_sbar,
|
||||
gui.which_scrollbars[i]);
|
||||
need_set_size |= RESIZE_VERT;
|
||||
else
|
||||
{
|
||||
FOR_ALL_WINDOWS(wp)
|
||||
gui_do_scrollbar(wp, i, gui.which_scrollbars[i]);
|
||||
}
|
||||
if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
|
||||
{
|
||||
if (i == SBAR_BOTTOM)
|
||||
need_set_size |= RESIZE_VERT;
|
||||
else
|
||||
need_set_size |= RESIZE_HOR;
|
||||
if (gui.which_scrollbars[i])
|
||||
fix_size = TRUE;
|
||||
}
|
||||
need_set_size |= RESIZE_HOR;
|
||||
if (gui.which_scrollbars[i])
|
||||
fix_size = TRUE;
|
||||
}
|
||||
curtab->tp_prev_which_scrollbars[i] = gui.which_scrollbars[i];
|
||||
prev_which_scrollbars[i] = gui.which_scrollbars[i];
|
||||
}
|
||||
curtab->tp_prev_which_scrollbars[i] = gui.which_scrollbars[i];
|
||||
prev_which_scrollbars[i] = gui.which_scrollbars[i];
|
||||
}
|
||||
|
||||
#ifdef FEAT_MENU
|
||||
if (gui.menu_is_active != prev_menu_is_active)
|
||||
{
|
||||
// We don't want a resize event change "Rows" here, save and
|
||||
// restore it. Resizing is handled below.
|
||||
i = Rows;
|
||||
gui_mch_enable_menu(gui.menu_is_active);
|
||||
Rows = i;
|
||||
prev_menu_is_active = gui.menu_is_active;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (gui.menu_is_active)
|
||||
fix_size = TRUE;
|
||||
}
|
||||
if (gui.menu_is_active != prev_menu_is_active)
|
||||
{
|
||||
// We don't want a resize event change "Rows" here, save and
|
||||
// restore it. Resizing is handled below.
|
||||
i = Rows;
|
||||
gui_mch_enable_menu(gui.menu_is_active);
|
||||
Rows = i;
|
||||
prev_menu_is_active = gui.menu_is_active;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (gui.menu_is_active)
|
||||
fix_size = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_TOOLBAR
|
||||
if (using_toolbar != prev_toolbar)
|
||||
{
|
||||
gui_mch_show_toolbar(using_toolbar);
|
||||
prev_toolbar = using_toolbar;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (using_toolbar)
|
||||
fix_size = TRUE;
|
||||
}
|
||||
if (using_toolbar != prev_toolbar)
|
||||
{
|
||||
gui_mch_show_toolbar(using_toolbar);
|
||||
prev_toolbar = using_toolbar;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (using_toolbar)
|
||||
fix_size = TRUE;
|
||||
}
|
||||
#endif
|
||||
#if defined(FEAT_MENU) && !(defined(MSWIN) && !defined(FEAT_TEAROFF))
|
||||
if (using_tearoff != prev_tearoff)
|
||||
{
|
||||
gui_mch_toggle_tearoffs(using_tearoff);
|
||||
prev_tearoff = using_tearoff;
|
||||
}
|
||||
if (using_tearoff != prev_tearoff)
|
||||
{
|
||||
gui_mch_toggle_tearoffs(using_tearoff);
|
||||
prev_tearoff = using_tearoff;
|
||||
}
|
||||
#endif
|
||||
if (need_set_size != 0)
|
||||
{
|
||||
if (need_set_size != 0)
|
||||
{
|
||||
#ifdef FEAT_GUI_GTK
|
||||
long prev_Columns = Columns;
|
||||
long prev_Rows = Rows;
|
||||
long prev_Columns = Columns;
|
||||
long prev_Rows = Rows;
|
||||
#endif
|
||||
// Adjust the size of the window to make the text area keep the
|
||||
// same size and to avoid that part of our window is off-screen
|
||||
// and a scrollbar can't be used, for example.
|
||||
gui_set_shellsize(FALSE, fix_size, need_set_size);
|
||||
// Adjust the size of the window to make the text area keep the
|
||||
// same size and to avoid that part of our window is off-screen
|
||||
// and a scrollbar can't be used, for example.
|
||||
gui_set_shellsize(FALSE, fix_size, need_set_size);
|
||||
|
||||
#ifdef FEAT_GUI_GTK
|
||||
// GTK has the annoying habit of sending us resize events when
|
||||
// changing the window size ourselves. This mostly happens when
|
||||
// waiting for a character to arrive, quite unpredictably, and may
|
||||
// change Columns and Rows when we don't want it. Wait for a
|
||||
// character here to avoid this effect.
|
||||
// If you remove this, please test this command for resizing
|
||||
// effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
|
||||
// Don't do this while starting up though.
|
||||
// Don't change Rows when adding menu/toolbar/tabline.
|
||||
// Don't change Columns when adding vertical toolbar.
|
||||
if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
|
||||
(void)char_avail();
|
||||
if ((need_set_size & RESIZE_VERT) == 0)
|
||||
Rows = prev_Rows;
|
||||
if ((need_set_size & RESIZE_HOR) == 0)
|
||||
Columns = prev_Columns;
|
||||
// GTK has the annoying habit of sending us resize events when
|
||||
// changing the window size ourselves. This mostly happens when
|
||||
// waiting for a character to arrive, quite unpredictably, and may
|
||||
// change Columns and Rows when we don't want it. Wait for a
|
||||
// character here to avoid this effect.
|
||||
// If you remove this, please test this command for resizing
|
||||
// effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
|
||||
// Don't do this while starting up though.
|
||||
// Don't change Rows when adding menu/toolbar/tabline.
|
||||
// Don't change Columns when adding vertical toolbar.
|
||||
if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
|
||||
(void)char_avail();
|
||||
if ((need_set_size & RESIZE_VERT) == 0)
|
||||
Rows = prev_Rows;
|
||||
if ((need_set_size & RESIZE_HOR) == 0)
|
||||
Columns = prev_Columns;
|
||||
#endif
|
||||
}
|
||||
// When the console tabline appears or disappears the window positions
|
||||
// change.
|
||||
if (firstwin->w_winrow != tabline_height())
|
||||
shell_new_rows(); // recompute window positions and heights
|
||||
}
|
||||
// When the console tabline appears or disappears the window positions
|
||||
// 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
|
||||
{
|
||||
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);
|
||||
}
|
||||
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,22 +5016,26 @@ display_errors(void)
|
||||
char_u *p;
|
||||
|
||||
if (isatty(2))
|
||||
fflush(stderr);
|
||||
else if (error_ga.ga_data != NULL)
|
||||
{
|
||||
// avoid putting up a message box with blanks only
|
||||
for (p = (char_u *)error_ga.ga_data; *p != NUL; ++p)
|
||||
if (!isspace(*p))
|
||||
{
|
||||
// Truncate a very long message, it will go off-screen.
|
||||
if (STRLEN(p) > 2000)
|
||||
STRCPY(p + 2000 - 14, "...(truncated)");
|
||||
(void)do_dialog(VIM_ERROR, (char_u *)_("Error"),
|
||||
p, (char_u *)_("&Ok"), 1, NULL, FALSE);
|
||||
break;
|
||||
}
|
||||
ga_clear(&error_ga);
|
||||
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))
|
||||
{
|
||||
// Truncate a very long message, it will go off-screen.
|
||||
if (STRLEN(p) > 2000)
|
||||
STRCPY(p + 2000 - 14, "...(truncated)");
|
||||
(void)do_dialog(VIM_ERROR, (char_u *)_("Error"),
|
||||
p, (char_u *)_("&Ok"), 1, NULL, FALSE);
|
||||
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)
|
||||
{
|
||||
wp = mouse_find_win(&row, &col, FAIL_POPUP);
|
||||
if (wp != NULL && wp != curwin)
|
||||
win_goto(wp);
|
||||
}
|
||||
if (row < 0 || col < 0)
|
||||
return;
|
||||
|
||||
wp = mouse_find_win(&row, &col, FAIL_POPUP);
|
||||
if (wp != NULL && wp != curwin)
|
||||
win_goto(wp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user