screen: remove superfluous default_grid indirection for global size

This was changed by mistake in multigrid PR.
default_grid.Rows rather corresponds to the old screen_Rows
This commit is contained in:
Björn Linse
2019-01-25 16:50:35 +01:00
parent d9406f4b64
commit 80b75bc99a

View File

@@ -324,7 +324,7 @@ void update_screen(int type)
wp->w_redr_status = true; wp->w_redr_status = true;
} }
} }
} else if (msg_scrolled > default_grid.Rows - 5) { // clearing is faster } else if (msg_scrolled > Rows - 5) { // clearing is faster
type = CLEAR; type = CLEAR;
} else if (type != CLEAR) { } else if (type != CLEAR) {
check_for_delay(false); check_for_delay(false);
@@ -4627,8 +4627,7 @@ win_redr_status_matches (
if (matches == NULL) /* interrupted completion? */ if (matches == NULL) /* interrupted completion? */
return; return;
buf = xmalloc(has_mbyte ? default_grid.Columns * MB_MAXBYTES + 1 buf = xmalloc(Columns * MB_MAXBYTES + 1);
: default_grid.Columns + 1);
if (match == -1) { /* don't show match but original text */ if (match == -1) { /* don't show match but original text */
match = 0; match = 0;
@@ -4649,13 +4648,13 @@ win_redr_status_matches (
if (first_match > 0) if (first_match > 0)
clen += 2; clen += 2;
// jumping right, put match at the left // jumping right, put match at the left
if ((long)clen > default_grid.Columns) { if ((long)clen > Columns) {
first_match = match; first_match = match;
/* if showing the last match, we can add some on the left */ /* if showing the last match, we can add some on the left */
clen = 2; clen = 2;
for (i = match; i < num_matches; ++i) { for (i = match; i < num_matches; ++i) {
clen += status_match_len(xp, L_MATCH(i)) + 2; clen += status_match_len(xp, L_MATCH(i)) + 2;
if ((long)clen >= default_grid.Columns) { if ((long)clen >= Columns) {
break; break;
} }
} }
@@ -4666,7 +4665,7 @@ win_redr_status_matches (
if (add_left) if (add_left)
while (first_match > 0) { while (first_match > 0) {
clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2; clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2;
if ((long)clen >= default_grid.Columns) { if ((long)clen >= Columns) {
break; break;
} }
first_match--; first_match--;
@@ -4684,8 +4683,7 @@ win_redr_status_matches (
clen = len; clen = len;
i = first_match; i = first_match;
while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < Columns) {
< default_grid.Columns) {
if (i == match) { if (i == match) {
selstart = buf + len; selstart = buf + len;
selstart_col = clen; selstart_col = clen;
@@ -4736,7 +4734,7 @@ win_redr_status_matches (
if (msg_scrolled > 0) { if (msg_scrolled > 0) {
/* Put the wildmenu just above the command line. If there is /* Put the wildmenu just above the command line. If there is
* no room, scroll the screen one line up. */ * no room, scroll the screen one line up. */
if (cmdline_row == default_grid.Rows - 1) { if (cmdline_row == Rows - 1) {
grid_del_lines(&default_grid, 0, 1, (int)Rows, 0, (int)Columns); grid_del_lines(&default_grid, 0, 1, (int)Rows, 0, (int)Columns);
msg_scrolled++; msg_scrolled++;
} else { } else {
@@ -4765,7 +4763,7 @@ win_redr_status_matches (
grid_puts(&default_grid, selstart, row, selstart_col, HL_ATTR(HLF_WM)); grid_puts(&default_grid, selstart, row, selstart_col, HL_ATTR(HLF_WM));
} }
grid_fill(&default_grid, row, row + 1, clen, (int)default_grid.Columns, grid_fill(&default_grid, row, row + 1, clen, (int)Columns,
fillchar, fillchar, attr); fillchar, fillchar, attr);
} }
@@ -5031,7 +5029,7 @@ win_redr_custom (
row = 0; row = 0;
fillchar = ' '; fillchar = ' ';
attr = HL_ATTR(HLF_TPF); attr = HL_ATTR(HLF_TPF);
maxwidth = default_grid.Columns; maxwidth = Columns;
use_sandbox = was_set_insecurely((char_u *)"tabline", 0); use_sandbox = was_set_insecurely((char_u *)"tabline", 0);
} else { } else {
row = W_ENDROW(wp); row = W_ENDROW(wp);
@@ -5050,13 +5048,13 @@ win_redr_custom (
if (*stl++ != '(') if (*stl++ != '(')
stl = p_ruf; stl = p_ruf;
} }
col = ru_col - (default_grid.Columns - wp->w_width); col = ru_col - (Columns - wp->w_width);
if (col < (wp->w_width + 1) / 2) { if (col < (wp->w_width + 1) / 2) {
col = (wp->w_width + 1) / 2; col = (wp->w_width + 1) / 2;
} }
maxwidth = wp->w_width - col; maxwidth = wp->w_width - col;
if (!wp->w_status_height) { if (!wp->w_status_height) {
row = default_grid.Rows - 1; row = Rows - 1;
maxwidth--; // writing in last column may cause scrolling maxwidth--; // writing in last column may cause scrolling
fillchar = ' '; fillchar = ' ';
attr = 0; attr = 0;
@@ -5150,7 +5148,7 @@ win_redr_custom (
p = (char_u *) tabtab[n].start; p = (char_u *) tabtab[n].start;
cur_click_def = tabtab[n].def; cur_click_def = tabtab[n].def;
} }
while (col < default_grid.Columns) { while (col < Columns) {
tab_page_click_defs[col++] = cur_click_def; tab_page_click_defs[col++] = cur_click_def;
} }
} }
@@ -5849,7 +5847,7 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col,
} }
// TODO(bfredl): The relevant caller should do this // TODO(bfredl): The relevant caller should do this
if (row == default_grid.Rows - 1) { // overwritten the command line if (row == Rows - 1) { // overwritten the command line
redraw_cmdline = true; redraw_cmdline = true;
if (start_col == 0 && end_col == Columns if (start_col == 0 && end_col == Columns
&& c1 == ' ' && c2 == ' ' && attr == 0) { && c1 == ' ' && c2 == ' ' && attr == 0) {
@@ -6037,7 +6035,7 @@ retry:
xfree(tab_page_click_defs); xfree(tab_page_click_defs);
tab_page_click_defs = new_tab_page_click_defs; tab_page_click_defs = new_tab_page_click_defs;
tab_page_click_defs_size = default_grid.Columns; tab_page_click_defs_size = Columns;
default_grid.row_offset = 0; default_grid.row_offset = 0;
default_grid.col_offset = 0; default_grid.col_offset = 0;
@@ -6443,7 +6441,7 @@ int showmode(void)
/* if the cmdline is more than one line high, erase top lines */ /* if the cmdline is more than one line high, erase top lines */
need_clear = clear_cmdline; need_clear = clear_cmdline;
if (clear_cmdline && cmdline_row < default_grid.Rows - 1) { if (clear_cmdline && cmdline_row < Rows - 1) {
msg_clr_cmdline(); // will reset clear_cmdline msg_clr_cmdline(); // will reset clear_cmdline
} }
@@ -6463,7 +6461,7 @@ int showmode(void)
if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) { if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) {
/* These messages can get long, avoid a wrap in a narrow /* These messages can get long, avoid a wrap in a narrow
* window. Prefer showing edit_submode_extra. */ * window. Prefer showing edit_submode_extra. */
length = (default_grid.Rows - msg_row) * default_grid.Columns - 3; length = (Rows - msg_row) * Columns - 3;
if (edit_submode_extra != NULL) { if (edit_submode_extra != NULL) {
length -= vim_strsize(edit_submode_extra); length -= vim_strsize(edit_submode_extra);
} }
@@ -6587,7 +6585,7 @@ int showmode(void)
static void msg_pos_mode(void) static void msg_pos_mode(void)
{ {
msg_col = 0; msg_col = 0;
msg_row = default_grid.Rows - 1; msg_row = Rows - 1;
} }
/// Delete mode message. Used when ESC is typed which is expected to end /// Delete mode message. Used when ESC is typed which is expected to end
@@ -6661,7 +6659,7 @@ static void draw_tabline(void)
// Init TabPageIdxs[] to zero: Clicking outside of tabs has no effect. // Init TabPageIdxs[] to zero: Clicking outside of tabs has no effect.
assert(default_grid.Columns == tab_page_click_defs_size); assert(Columns == tab_page_click_defs_size);
clear_tab_page_click_defs(tab_page_click_defs, tab_page_click_defs_size); clear_tab_page_click_defs(tab_page_click_defs, tab_page_click_defs_size);
/* Use the 'tabline' option if it's set. */ /* Use the 'tabline' option if it's set. */
@@ -6683,7 +6681,7 @@ static void draw_tabline(void)
} }
if (tabcount > 0) { if (tabcount > 0) {
tabwidth = (default_grid.Columns - 1 + tabcount / 2) / tabcount; tabwidth = (Columns - 1 + tabcount / 2) / tabcount;
} }
if (tabwidth < 6) { if (tabwidth < 6) {
@@ -6694,7 +6692,7 @@ static void draw_tabline(void)
tabcount = 0; tabcount = 0;
FOR_ALL_TABS(tp) { FOR_ALL_TABS(tp) {
if (col >= default_grid.Columns - 4) { if (col >= Columns - 4) {
break; break;
} }
@@ -6735,7 +6733,7 @@ static void draw_tabline(void)
if (wincount > 1) { if (wincount > 1) {
vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount); vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
len = (int)STRLEN(NameBuff); len = (int)STRLEN(NameBuff);
if (col + len >= default_grid.Columns - 3) { if (col + len >= Columns - 3) {
break; break;
} }
grid_puts_len(&default_grid, NameBuff, len, 0, col, grid_puts_len(&default_grid, NameBuff, len, 0, col,
@@ -6764,8 +6762,8 @@ static void draw_tabline(void)
p += len - room; p += len - room;
len = room; len = room;
} }
if (len > default_grid.Columns - col - 1) { if (len > Columns - col - 1) {
len = default_grid.Columns - col - 1; len = Columns - col - 1;
} }
grid_puts_len(&default_grid, p, (int)STRLEN(p), 0, col, attr); grid_puts_len(&default_grid, p, (int)STRLEN(p), 0, col, attr);
@@ -6789,14 +6787,14 @@ static void draw_tabline(void)
c = '_'; c = '_';
else else
c = ' '; c = ' ';
grid_fill(&default_grid, 0, 1, col, (int)default_grid.Columns, c, c, grid_fill(&default_grid, 0, 1, col, (int)Columns, c, c,
attr_fill); attr_fill);
/* Put an "X" for closing the current tab if there are several. */ /* Put an "X" for closing the current tab if there are several. */
if (first_tabpage->tp_next != NULL) { if (first_tabpage->tp_next != NULL) {
grid_putchar(&default_grid, 'X', 0, (int)default_grid.Columns - 1, grid_putchar(&default_grid, 'X', 0, (int)Columns - 1,
attr_nosel); attr_nosel);
tab_page_click_defs[default_grid.Columns - 1] = (StlClickDefinition) { tab_page_click_defs[Columns - 1] = (StlClickDefinition) {
.type = kStlClickTabClose, .type = kStlClickTabClose,
.tabnr = 999, .tabnr = 999,
.func = NULL, .func = NULL,
@@ -6992,10 +6990,10 @@ static void win_redr_ruler(win_T *wp, int always)
off = wp->w_wincol; off = wp->w_wincol;
width = wp->w_width; width = wp->w_width;
} else { } else {
row = default_grid.Rows - 1; row = Rows - 1;
fillchar = ' '; fillchar = ' ';
attr = 0; attr = 0;
width = default_grid.Columns; width = Columns;
off = 0; off = 0;
} }
@@ -7033,7 +7031,7 @@ static void win_redr_ruler(win_T *wp, int always)
if (wp->w_status_height == 0) { // can't use last char of screen if (wp->w_status_height == 0) { // can't use last char of screen
o++; o++;
} }
int this_ru_col = ru_col - (default_grid.Columns - width); int this_ru_col = ru_col - (Columns - width);
if (this_ru_col < 0) { if (this_ru_col < 0) {
this_ru_col = 0; this_ru_col = 0;
} }