0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.0.1135: W_WINCOL() is always the same

Problem:    W_WINCOL() is always the same.
Solution:   Expand the macro.
This commit is contained in:
Bram Moolenaar 2017-09-22 14:35:51 +02:00
parent 76301956f0
commit 53f8174eae
15 changed files with 40 additions and 40 deletions

View File

@ -1776,7 +1776,7 @@ edit_putchar(int c, int highlight)
else else
attr = 0; attr = 0;
pc_row = W_WINROW(curwin) + curwin->w_wrow; pc_row = W_WINROW(curwin) + curwin->w_wrow;
pc_col = W_WINCOL(curwin); pc_col = curwin->w_wincol;
#if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE) #if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
pc_status = PC_STATUS_UNSET; pc_status = PC_STATUS_UNSET;
#endif #endif

View File

@ -9111,7 +9111,7 @@ ex_sleep(exarg_T *eap)
{ {
n = W_WINROW(curwin) + curwin->w_wrow - msg_scrolled; n = W_WINROW(curwin) + curwin->w_wrow - msg_scrolled;
if (n >= 0) if (n >= 0)
windgoto((int)n, W_WINCOL(curwin) + curwin->w_wcol); windgoto((int)n, curwin->w_wincol + curwin->w_wcol);
} }
len = eap->line2; len = eap->line2;

View File

@ -1954,7 +1954,7 @@ popup_menu_position_func(GtkMenu *menu UNUSED,
# endif # endif
{ {
/* Find the cursor position in the current window */ /* Find the cursor position in the current window */
*x += FILL_X(W_WINCOL(curwin) + curwin->w_wcol + 1) + 1; *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1;
*y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1; *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1;
} }
} }

View File

@ -6608,7 +6608,7 @@ gui_make_popup(char_u *path_name, int mouse_pos)
} }
else if (curwin != NULL) else if (curwin != NULL)
{ {
p.x += TEXT_X(W_WINCOL(curwin) + curwin->w_wcol + 1); p.x += TEXT_X(curwin->w_wincol + curwin->w_wcol + 1);
p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1);
} }
msg_scroll = FALSE; msg_scroll = FALSE;

View File

@ -3877,7 +3877,7 @@ WindowAttr(WindowObject *self, char *name)
else if (strcmp(name, "width") == 0) else if (strcmp(name, "width") == 0)
return PyLong_FromLong((long)(W_WIDTH(self->win))); return PyLong_FromLong((long)(W_WIDTH(self->win)));
else if (strcmp(name, "col") == 0) else if (strcmp(name, "col") == 0)
return PyLong_FromLong((long)(W_WINCOL(self->win))); return PyLong_FromLong((long)(self->win->w_wincol));
else if (strcmp(name, "vars") == 0) else if (strcmp(name, "vars") == 0)
return NEW_DICTIONARY(self->win->w_vars); return NEW_DICTIONARY(self->win->w_vars);
else if (strcmp(name, "options") == 0) else if (strcmp(name, "options") == 0)

View File

@ -2872,7 +2872,7 @@ netbeans_button_release(int button)
if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf) if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf)
{ {
int col = mouse_col - W_WINCOL(curwin) int col = mouse_col - curwin->w_wincol
- ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1); - ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1);
long off = pos2off(curbuf, &curwin->w_cursor); long off = pos2off(curbuf, &curwin->w_cursor);

View File

@ -190,10 +190,10 @@ redo:
/* Calculate column */ /* Calculate column */
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl) if (curwin->w_p_rl)
col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol - 1; col = curwin->w_wincol + W_WIDTH(curwin) - curwin->w_wcol - 1;
else else
#endif #endif
col = W_WINCOL(curwin) + curwin->w_wcol; col = curwin->w_wincol + curwin->w_wcol;
/* if there are more items than room we need a scrollbar */ /* if there are more items than room we need a scrollbar */
if (pum_height < size) if (pum_height < size)
@ -312,7 +312,7 @@ pum_redraw(void)
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl) if (curwin->w_p_rl)
{ {
if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1) if (pum_col < curwin->w_wincol + W_WIDTH(curwin) - 1)
screen_putchar(' ', row, pum_col + 1, attr); screen_putchar(' ', row, pum_col + 1, attr);
} }
else else

View File

@ -2211,10 +2211,10 @@ win_update(win_T *wp)
/* /*
* Last line isn't finished: Display "@@@" in the last screen line. * Last line isn't finished: Display "@@@" in the last screen line.
*/ */
screen_puts_len((char_u *)"@@", 2, scr_row, W_WINCOL(wp), screen_puts_len((char_u *)"@@", 2, scr_row, wp->w_wincol,
HL_ATTR(HLF_AT)); HL_ATTR(HLF_AT));
screen_fill(scr_row, scr_row + 1, screen_fill(scr_row, scr_row + 1,
(int)W_WINCOL(wp) + 2, (int)W_ENDCOL(wp), (int)wp->w_wincol + 2, (int)W_ENDCOL(wp),
'@', ' ', HL_ATTR(HLF_AT)); '@', ' ', HL_ATTR(HLF_AT));
set_empty_rows(wp, srow); set_empty_rows(wp, srow);
wp->w_botline = lnum; wp->w_botline = lnum;
@ -2375,7 +2375,7 @@ win_draw_end(
} }
# endif # endif
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_WINCOL(wp), W_ENDCOL(wp) - 1 - FDC_OFF, wp->w_wincol, W_ENDCOL(wp) - 1 - FDC_OFF,
c2, c2, HL_ATTR(hl)); c2, c2, HL_ATTR(hl));
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF, W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF,
@ -2392,7 +2392,7 @@ win_draw_end(
if (n > wp->w_width) if (n > wp->w_width)
n = wp->w_width; n = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_WINCOL(wp), (int)W_WINCOL(wp) + n, wp->w_wincol, (int)wp->w_wincol + n,
cmdwin_type, ' ', HL_ATTR(HLF_AT)); cmdwin_type, ' ', HL_ATTR(HLF_AT));
} }
#endif #endif
@ -2405,7 +2405,7 @@ win_draw_end(
if (nn > W_WIDTH(wp)) if (nn > W_WIDTH(wp))
nn = W_WIDTH(wp); nn = W_WIDTH(wp);
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, wp->w_wincol + n, (int)wp->w_wincol + nn,
' ', ' ', HL_ATTR(HLF_FC)); ' ', ' ', HL_ATTR(HLF_FC));
n = nn; n = nn;
} }
@ -2419,13 +2419,13 @@ win_draw_end(
if (nn > W_WIDTH(wp)) if (nn > W_WIDTH(wp))
nn = W_WIDTH(wp); nn = W_WIDTH(wp);
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, wp->w_wincol + n, (int)wp->w_wincol + nn,
' ', ' ', HL_ATTR(HLF_SC)); ' ', ' ', HL_ATTR(HLF_SC));
n = nn; n = nn;
} }
#endif #endif
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_WINCOL(wp) + FDC_OFF, (int)W_ENDCOL(wp), wp->w_wincol + FDC_OFF, (int)W_ENDCOL(wp),
c1, c2, HL_ATTR(hl)); c1, c2, HL_ATTR(hl));
} }
set_empty_rows(wp, row); set_empty_rows(wp, row);
@ -2894,7 +2894,7 @@ fold_line(
} }
#endif #endif
screen_line(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp), screen_line(row + W_WINROW(wp), wp->w_wincol, (int)W_WIDTH(wp),
(int)W_WIDTH(wp), FALSE); (int)W_WIDTH(wp), FALSE);
/* /*
@ -4016,7 +4016,7 @@ win_line(
#endif #endif
) )
{ {
screen_line(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp), screen_line(screen_row, wp->w_wincol, col, -(int)W_WIDTH(wp),
HAS_RIGHTLEFT(wp->w_p_rl)); HAS_RIGHTLEFT(wp->w_p_rl));
/* Pretend we have finished updating the window. Except when /* Pretend we have finished updating the window. Except when
* 'cursorcolumn' is set. */ * 'cursorcolumn' is set. */
@ -5488,7 +5488,7 @@ win_line(
} }
#endif #endif
screen_line(screen_row, W_WINCOL(wp), col, screen_line(screen_row, wp->w_wincol, col,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
row++; row++;
@ -5794,11 +5794,11 @@ win_line(
) )
{ {
#ifdef FEAT_CONCEAL #ifdef FEAT_CONCEAL
screen_line(screen_row, W_WINCOL(wp), col - boguscols, screen_line(screen_row, wp->w_wincol, col - boguscols,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
boguscols = 0; boguscols = 0;
#else #else
screen_line(screen_row, W_WINCOL(wp), col, screen_line(screen_row, wp->w_wincol, col,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
#endif #endif
++row; ++row;
@ -6931,14 +6931,14 @@ win_redr_status(win_T *wp)
} }
row = W_WINROW(wp) + wp->w_height; row = W_WINROW(wp) + wp->w_height;
screen_puts(p, row, W_WINCOL(wp), attr); screen_puts(p, row, wp->w_wincol, attr);
screen_fill(row, row + 1, len + W_WINCOL(wp), screen_fill(row, row + 1, len + wp->w_wincol,
this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr); this_ru_col + wp->w_wincol, fillchar, fillchar, attr);
if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL) if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL)
&& (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1)) && (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1))
screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff) screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
- 1 + W_WINCOL(wp)), attr); - 1 + wp->w_wincol), attr);
#ifdef FEAT_CMDL_INFO #ifdef FEAT_CMDL_INFO
win_redr_ruler(wp, TRUE); win_redr_ruler(wp, TRUE);
@ -7167,7 +7167,7 @@ win_redr_custom(
# endif # endif
} }
col += W_WINCOL(wp); col += wp->w_wincol;
} }
if (maxwidth <= 0) if (maxwidth <= 0)
@ -9418,7 +9418,7 @@ setcursor(void)
{ {
validate_cursor(); validate_cursor();
windgoto(W_WINROW(curwin) + curwin->w_wrow, windgoto(W_WINROW(curwin) + curwin->w_wrow,
W_WINCOL(curwin) + ( curwin->w_wincol + (
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
/* With 'rightleft' set and the cursor on a double-wide /* With 'rightleft' set and the cursor on a double-wide
* character, position it on the leftmost column. */ * character, position it on the leftmost column. */
@ -9495,7 +9495,7 @@ win_ins_lines(
if (lastrow > Rows) if (lastrow > Rows)
lastrow = Rows; lastrow = Rows;
screen_fill(nextrow - line_count, lastrow - line_count, screen_fill(nextrow - line_count, lastrow - line_count,
W_WINCOL(wp), (int)W_ENDCOL(wp), wp->w_wincol, (int)W_ENDCOL(wp),
' ', ' ', 0); ' ', ' ', 0);
} }
@ -9606,7 +9606,7 @@ win_do_lines(
if (row + line_count >= wp->w_height) if (row + line_count >= wp->w_height)
{ {
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
W_WINCOL(wp), (int)W_ENDCOL(wp), wp->w_wincol, (int)W_ENDCOL(wp),
' ', ' ', 0); ' ', ' ', 0);
return OK; return OK;
} }
@ -10768,7 +10768,7 @@ redraw_win_toolbar(win_T *wp)
} }
wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */ wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */
screen_line(wp->w_winrow, W_WINCOL(wp), (int)W_WIDTH(wp), screen_line(wp->w_winrow, wp->w_wincol, (int)W_WIDTH(wp),
(int)W_WIDTH(wp), FALSE); (int)W_WIDTH(wp), FALSE);
} }
#endif #endif
@ -10900,7 +10900,7 @@ win_redr_ruler(win_T *wp, int always)
{ {
row = W_WINROW(wp) + wp->w_height; row = W_WINROW(wp) + wp->w_height;
fillchar = fillchar_status(&attr, wp); fillchar = fillchar_status(&attr, wp);
off = W_WINCOL(wp); off = wp->w_wincol;
width = W_WIDTH(wp); width = W_WIDTH(wp);
} }
else else

View File

@ -2700,8 +2700,7 @@ struct window_S
int w_height; /* number of rows in window, excluding int w_height; /* number of rows in window, excluding
status/command/winbar line(s) */ status/command/winbar line(s) */
int w_status_height; /* number of status lines (0 or 1) */ int w_status_height; /* number of status lines (0 or 1) */
int w_wincol; /* Leftmost column of window in screen. int w_wincol; /* Leftmost column of window in screen. */
use W_WINCOL() */
int w_width; /* Width of window, excluding separation. int w_width; /* Width of window, excluding separation.
use W_WIDTH() */ use W_WIDTH() */
int w_vsep_width; /* Number of separator columns (0 or 1). int w_vsep_width; /* Number of separator columns (0 or 1).

View File

@ -3816,8 +3816,8 @@ scroll_region_set(win_T *wp, int off)
OUT_STR(tgoto((char *)T_CS, W_WINROW(wp) + wp->w_height - 1, OUT_STR(tgoto((char *)T_CS, W_WINROW(wp) + wp->w_height - 1,
W_WINROW(wp) + off)); W_WINROW(wp) + off));
if (*T_CSV != NUL && wp->w_width != Columns) if (*T_CSV != NUL && wp->w_width != Columns)
OUT_STR(tgoto((char *)T_CSV, W_WINCOL(wp) + wp->w_width - 1, OUT_STR(tgoto((char *)T_CSV, wp->w_wincol + wp->w_width - 1,
W_WINCOL(wp))); wp->w_wincol));
screen_start(); /* don't know where cursor is now */ screen_start(); /* don't know where cursor is now */
} }

View File

@ -730,7 +730,7 @@ term_send_mouse(VTerm *vterm, int button, int pressed)
VTermModifier mod = VTERM_MOD_NONE; VTermModifier mod = VTERM_MOD_NONE;
vterm_mouse_move(vterm, mouse_row - W_WINROW(curwin), vterm_mouse_move(vterm, mouse_row - W_WINROW(curwin),
mouse_col - W_WINCOL(curwin), mod); mouse_col - curwin->w_wincol, mod);
vterm_mouse_button(vterm, button, pressed, mod); vterm_mouse_button(vterm, button, pressed, mod);
return TRUE; return TRUE;
} }
@ -1308,7 +1308,7 @@ send_keys_to_term(term_T *term, int c, int typed)
case K_MOUSERIGHT: case K_MOUSERIGHT:
if (mouse_row < W_WINROW(curwin) if (mouse_row < W_WINROW(curwin)
|| mouse_row >= (W_WINROW(curwin) + curwin->w_height) || mouse_row >= (W_WINROW(curwin) + curwin->w_height)
|| mouse_col < W_WINCOL(curwin) || mouse_col < curwin->w_wincol
|| mouse_col >= W_ENDCOL(curwin) || mouse_col >= W_ENDCOL(curwin)
|| dragging_outside) || dragging_outside)
{ {

View File

@ -2845,7 +2845,7 @@ retnomove:
#endif #endif
row -= W_WINROW(curwin); row -= W_WINROW(curwin);
col -= W_WINCOL(curwin); col -= curwin->w_wincol;
/* /*
* When clicking beyond the end of the window, scroll the screen. * When clicking beyond the end of the window, scroll the screen.

View File

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

View File

@ -859,7 +859,6 @@ extern int (*dyn_libintl_putenv)(const char *envstring);
#define FINDFILE_DIR 1 /* only directories */ #define FINDFILE_DIR 1 /* only directories */
#define FINDFILE_BOTH 2 /* files and directories */ #define FINDFILE_BOTH 2 /* files and directories */
#define W_WINCOL(wp) (wp->w_wincol)
#define W_WIDTH(wp) (wp->w_width) #define W_WIDTH(wp) (wp->w_width)
#define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) #define W_ENDCOL(wp) (wp->w_wincol + wp->w_width)
#define W_VSEP_WIDTH(wp) (wp->w_vsep_width) #define W_VSEP_WIDTH(wp) (wp->w_vsep_width)

View File

@ -2724,7 +2724,7 @@ winframe_remove(
if (frp2 == frp_close->fr_next) if (frp2 == frp_close->fr_next)
{ {
int row = win->w_winrow; int row = win->w_winrow;
int col = W_WINCOL(win); int col = win->w_wincol;
frame_comp_pos(frp2, &row, &col); frame_comp_pos(frp2, &row, &col);
} }