1
0
forked from aniani/vim

patch 8.0.1136: W_WIDTH() is always the same

Problem:    W_WIDTH() is always the same.
Solution:   Expand the macro.
This commit is contained in:
Bram Moolenaar
2017-09-22 15:20:32 +02:00
parent 53f8174eae
commit 0263146b5d
26 changed files with 142 additions and 142 deletions

View File

@@ -2353,8 +2353,8 @@ win_draw_end(
if (n > 0)
{
/* draw the fold column at the right */
if (n > W_WIDTH(wp))
n = W_WIDTH(wp);
if (n > wp->w_width)
n = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - n, (int)W_ENDCOL(wp),
' ', ' ', HL_ATTR(HLF_FC));
@@ -2366,8 +2366,8 @@ win_draw_end(
int nn = n + 2;
/* draw the sign column left of the fold column */
if (nn > W_WIDTH(wp))
nn = W_WIDTH(wp);
if (nn > wp->w_width)
nn = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n,
' ', ' ', HL_ATTR(HLF_SC));
@@ -2402,8 +2402,8 @@ win_draw_end(
int nn = n + fdc;
/* draw the fold column at the left */
if (nn > W_WIDTH(wp))
nn = W_WIDTH(wp);
if (nn > wp->w_width)
nn = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol + n, (int)wp->w_wincol + nn,
' ', ' ', HL_ATTR(HLF_FC));
@@ -2416,8 +2416,8 @@ win_draw_end(
int nn = n + 2;
/* draw the sign column after the fold column */
if (nn > W_WIDTH(wp))
nn = W_WIDTH(wp);
if (nn > wp->w_width)
nn = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol + n, (int)wp->w_wincol + nn,
' ', ' ', HL_ATTR(HLF_SC));
@@ -2482,7 +2482,7 @@ text_to_screenline(win_T *wp, char_u *text, int col)
{
cells = (*mb_ptr2cells)(p);
c_len = (*mb_ptr2len)(p);
if (col + cells > W_WIDTH(wp)
if (col + cells > wp->w_width
# ifdef FEAT_RIGHTLEFT
- (wp->w_p_rl ? col : 0)
# endif
@@ -2566,8 +2566,8 @@ text_to_screenline(win_T *wp, char_u *text, int col)
{
int len = (int)STRLEN(text);
if (len > W_WIDTH(wp) - col)
len = W_WIDTH(wp) - col;
if (len > wp->w_width - col)
len = wp->w_width - col;
if (len > 0)
{
#ifdef FEAT_RIGHTLEFT
@@ -2593,7 +2593,7 @@ compute_foldcolumn(win_T *wp, int col)
{
int fdc = wp->w_p_fdc;
int wmw = wp == curwin && p_wmw == 0 ? 1 : p_wmw;
int wwidth = W_WIDTH(wp);
int wwidth = wp->w_width;
if (fdc > wwidth - (col + wmw))
fdc = wwidth - (col + wmw);
@@ -2662,11 +2662,11 @@ fold_line(
{
int i;
copy_text_attr(off + W_WIDTH(wp) - fdc - col, buf, fdc,
copy_text_attr(off + wp->w_width - fdc - col, buf, fdc,
HL_ATTR(HLF_FC));
/* reverse the fold column */
for (i = 0; i < fdc; ++i)
ScreenLines[off + W_WIDTH(wp) - i - 1 - col] = buf[i];
ScreenLines[off + wp->w_width - i - 1 - col] = buf[i];
}
else
#endif
@@ -2677,7 +2677,7 @@ fold_line(
#ifdef FEAT_RIGHTLEFT
# define RL_MEMSET(p, v, l) if (wp->w_p_rl) \
for (ri = 0; ri < l; ++ri) \
ScreenAttrs[off + (W_WIDTH(wp) - (p) - (l)) + ri] = v; \
ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \
else \
for (ri = 0; ri < l; ++ri) \
ScreenAttrs[off + (p) + ri] = v
@@ -2688,13 +2688,13 @@ fold_line(
/* Set all attributes of the 'number' or 'relativenumber' column and the
* text */
RL_MEMSET(col, HL_ATTR(HLF_FL), W_WIDTH(wp) - col);
RL_MEMSET(col, HL_ATTR(HLF_FL), wp->w_width - col);
#ifdef FEAT_SIGNS
/* If signs are being displayed, add two spaces. */
if (signcolumn_on(wp))
{
len = W_WIDTH(wp) - col;
len = wp->w_width - col;
if (len > 0)
{
if (len > 2)
@@ -2702,7 +2702,7 @@ fold_line(
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col,
copy_text_attr(off + wp->w_width - len - col,
(char_u *)" ", len, HL_ATTR(HLF_FL));
else
# endif
@@ -2717,7 +2717,7 @@ fold_line(
*/
if (wp->w_p_nu || wp->w_p_rnu)
{
len = W_WIDTH(wp) - col;
len = wp->w_width - col;
if (len > 0)
{
int w = number_width(wp);
@@ -2747,7 +2747,7 @@ fold_line(
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
/* the line number isn't reversed */
copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
copy_text_attr(off + wp->w_width - len - col, buf, len,
HL_ATTR(HLF_FL));
else
#endif
@@ -2775,7 +2775,7 @@ fold_line(
if (wp->w_p_rl)
col -= txtcol;
#endif
while (col < W_WIDTH(wp)
while (col < wp->w_width
#ifdef FEAT_RIGHTLEFT
- (wp->w_p_rl ? txtcol : 0)
#endif
@@ -2837,14 +2837,14 @@ fold_line(
if (VIsual_mode == Ctrl_V)
{
/* Visual block mode: highlight the chars part of the block */
if (wp->w_old_cursor_fcol + txtcol < (colnr_T)W_WIDTH(wp))
if (wp->w_old_cursor_fcol + txtcol < (colnr_T)wp->w_width)
{
if (wp->w_old_cursor_lcol != MAXCOL
&& wp->w_old_cursor_lcol + txtcol
< (colnr_T)W_WIDTH(wp))
< (colnr_T)wp->w_width)
len = wp->w_old_cursor_lcol;
else
len = W_WIDTH(wp) - txtcol;
len = wp->w_width - txtcol;
RL_MEMSET(wp->w_old_cursor_fcol + txtcol, HL_ATTR(HLF_V),
len - (int)wp->w_old_cursor_fcol);
}
@@ -2852,7 +2852,7 @@ fold_line(
else
{
/* Set all attributes of the text */
RL_MEMSET(txtcol, HL_ATTR(HLF_V), W_WIDTH(wp) - txtcol);
RL_MEMSET(txtcol, HL_ATTR(HLF_V), wp->w_width - txtcol);
}
}
}
@@ -2872,7 +2872,7 @@ fold_line(
txtcol -= wp->w_skipcol;
else
txtcol -= wp->w_leftcol;
if (txtcol >= 0 && txtcol < W_WIDTH(wp))
if (txtcol >= 0 && txtcol < wp->w_width)
ScreenAttrs[off + txtcol] = hl_combine_attr(
ScreenAttrs[off + txtcol], HL_ATTR(HLF_MC));
txtcol = old_txtcol;
@@ -2888,14 +2888,14 @@ fold_line(
txtcol -= wp->w_skipcol;
else
txtcol -= wp->w_leftcol;
if (txtcol >= 0 && txtcol < W_WIDTH(wp))
if (txtcol >= 0 && txtcol < wp->w_width)
ScreenAttrs[off + txtcol] = hl_combine_attr(
ScreenAttrs[off + txtcol], HL_ATTR(HLF_CUC));
}
#endif
screen_line(row + W_WINROW(wp), wp->w_wincol, (int)W_WIDTH(wp),
(int)W_WIDTH(wp), FALSE);
screen_line(row + W_WINROW(wp), wp->w_wincol, (int)wp->w_width,
(int)wp->w_width, FALSE);
/*
* Update w_cline_height and w_cline_folded if the cursor line was
@@ -3724,7 +3724,7 @@ win_line(
/* Rightleft window: process the text in the normal direction, but put
* it in current_ScreenLine[] from right to left. Start at the
* rightmost column of the window. */
col = W_WIDTH(wp) - 1;
col = wp->w_width - 1;
off += col;
}
#endif
@@ -3963,7 +3963,7 @@ win_line(
n_extra = col + 1;
else
# endif
n_extra = W_WIDTH(wp) - col;
n_extra = wp->w_width - col;
char_attr = HL_ATTR(HLF_DED);
}
# endif
@@ -4016,7 +4016,7 @@ win_line(
#endif
)
{
screen_line(screen_row, wp->w_wincol, col, -(int)W_WIDTH(wp),
screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width,
HAS_RIGHTLEFT(wp->w_p_rl));
/* Pretend we have finished updating the window. Except when
* 'cursorcolumn' is set. */
@@ -4285,7 +4285,7 @@ win_line(
# ifdef FEAT_RIGHTLEFT
wp->w_p_rl ? (col <= 0) :
# endif
(col >= W_WIDTH(wp) - 1))
(col >= wp->w_width - 1))
&& (*mb_char2cells)(mb_c) == 2)
{
c = '>';
@@ -4486,7 +4486,7 @@ win_line(
# ifdef FEAT_RIGHTLEFT
wp->w_p_rl ? (col <= 0) :
# endif
(col >= W_WIDTH(wp) - 1))
(col >= wp->w_width - 1))
&& (*mb_char2cells)(mb_c) == 2)
{
c = '>';
@@ -4703,7 +4703,7 @@ win_line(
/* TODO: is passing p for start of the line OK? */
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
NULL) - 1;
if (c == TAB && n_extra + col > W_WIDTH(wp))
if (c == TAB && n_extra + col > wp->w_width)
n_extra = (int)wp->w_buffer->b_p_ts
- vcol % (int)wp->w_buffer->b_p_ts - 1;
@@ -4920,7 +4920,7 @@ win_line(
# ifdef FEAT_RIGHTLEFT
wp->w_p_rl ? (col >= 0) :
# endif
(col < W_WIDTH(wp)))
(col < wp->w_width))
&& !(noinvcur
&& lnum == wp->w_cursor.lnum
&& (colnr_T)vcol == wp->w_virtcol)))
@@ -5031,7 +5031,7 @@ win_line(
# ifdef FEAT_RIGHTLEFT
wp->w_p_rl ? (col >= 0) :
# endif
(col < W_WIDTH(wp))))
(col < wp->w_width)))
{
c = ' ';
--ptr; /* put it back at the NUL */
@@ -5054,7 +5054,7 @@ win_line(
# ifdef FEAT_CONCEAL
- boguscols
# endif
< W_WIDTH(wp))))
< wp->w_width)))
{
/* Highlight until the right side of the window */
c = ' ';
@@ -5175,7 +5175,7 @@ win_line(
{
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
wp->w_wcol = W_WIDTH(wp) - col + boguscols - 1;
wp->w_wcol = wp->w_width - col + boguscols - 1;
else
# endif
wp->w_wcol = col - boguscols;
@@ -5338,7 +5338,7 @@ win_line(
else
#endif
{
if (col >= W_WIDTH(wp))
if (col >= wp->w_width)
n = -1;
}
if (n != 0)
@@ -5442,7 +5442,7 @@ win_line(
if (((wp->w_p_cuc
&& (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off
&& (int)wp->w_virtcol <
W_WIDTH(wp) * (row - startrow + 1) + v
wp->w_width * (row - startrow + 1) + v
&& lnum != wp->w_cursor.lnum)
|| draw_color_col)
# ifdef FEAT_RIGHTLEFT
@@ -5461,7 +5461,7 @@ win_line(
if (rightmost_vcol < color_cols[i])
rightmost_vcol = color_cols[i];
while (col < W_WIDTH(wp))
while (col < wp->w_width)
{
ScreenLines[off] = ' ';
#ifdef FEAT_MBYTE
@@ -5489,7 +5489,7 @@ win_line(
#endif
screen_line(screen_row, wp->w_wincol, col,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
row++;
/*
@@ -5519,7 +5519,7 @@ win_line(
#ifdef FEAT_RIGHTLEFT
wp->w_p_rl ? col == 0 :
#endif
col == W_WIDTH(wp) - 1)
col == wp->w_width - 1)
&& (*ptr != NUL
|| (wp->w_p_list && lcs_eol_one > 0)
|| (n_extra && (c_extra != NUL || *p_extra != NUL))))
@@ -5784,7 +5784,7 @@ win_line(
#ifdef FEAT_RIGHTLEFT
wp->w_p_rl ? (col < 0) :
#endif
(col >= W_WIDTH(wp)))
(col >= wp->w_width))
&& (*ptr != NUL
#ifdef FEAT_DIFF
|| filler_todo > 0
@@ -5795,11 +5795,11 @@ win_line(
{
#ifdef FEAT_CONCEAL
screen_line(screen_row, wp->w_wincol, col - boguscols,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
boguscols = 0;
#else
screen_line(screen_row, wp->w_wincol, col,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
#endif
++row;
++screen_row;
@@ -5836,7 +5836,7 @@ win_line(
#ifdef FEAT_DIFF
&& filler_todo <= 0
#endif
&& W_WIDTH(wp) == Columns)
&& wp->w_width == Columns)
{
/* Remember that the line wraps, used for modeless copy. */
LineWraps[screen_row - 1] = TRUE;
@@ -5873,7 +5873,7 @@ win_line(
* then output the same character again to let the
* terminal know about the wrap. If the terminal doesn't
* auto-wrap, we overwrite the character. */
if (screen_cur_col != W_WIDTH(wp))
if (screen_cur_col != wp->w_width)
screen_char(LineOffset[screen_row - 1]
+ (unsigned)Columns - 1,
screen_row - 1, (int)(Columns - 1));
@@ -5899,7 +5899,7 @@ win_line(
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
col = W_WIDTH(wp) - 1; /* col is not used if breaking! */
col = wp->w_width - 1; /* col is not used if breaking! */
off += col;
}
#endif
@@ -6890,9 +6890,9 @@ win_redr_status(win_T *wp)
len += (int)STRLEN(p + len);
}
this_ru_col = ru_col - (Columns - W_WIDTH(wp));
if (this_ru_col < (W_WIDTH(wp) + 1) / 2)
this_ru_col = (W_WIDTH(wp) + 1) / 2;
this_ru_col = ru_col - (Columns - wp->w_width);
if (this_ru_col < (wp->w_width + 1) / 2)
this_ru_col = (wp->w_width + 1) / 2;
if (this_ru_col <= 1)
{
p = (char_u *)"<"; /* No room for file name! */
@@ -7123,7 +7123,7 @@ win_redr_custom(
{
row = W_WINROW(wp) + wp->w_height;
fillchar = fillchar_status(&attr, wp);
maxwidth = W_WIDTH(wp);
maxwidth = wp->w_width;
if (draw_ruler)
{
@@ -7139,10 +7139,10 @@ win_redr_custom(
if (*stl++ != '(')
stl = p_ruf;
}
col = ru_col - (Columns - W_WIDTH(wp));
if (col < (W_WIDTH(wp) + 1) / 2)
col = (W_WIDTH(wp) + 1) / 2;
maxwidth = W_WIDTH(wp) - col;
col = ru_col - (Columns - wp->w_width);
if (col < (wp->w_width + 1) / 2)
col = (wp->w_width + 1) / 2;
maxwidth = wp->w_width - col;
if (!wp->w_status_height)
{
row = Rows - 1;
@@ -9422,7 +9422,7 @@ setcursor(void)
#ifdef FEAT_RIGHTLEFT
/* With 'rightleft' set and the cursor on a double-wide
* character, position it on the leftmost column. */
curwin->w_p_rl ? ((int)W_WIDTH(curwin) - curwin->w_wcol - (
curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol - (
# ifdef FEAT_MBYTE
(has_mbyte
&& (*mb_ptr2cells)(ml_get_cursor()) == 2
@@ -9628,7 +9628,7 @@ win_do_lines(
* a character in the lower right corner of the scroll region may cause a
* scroll-up .
*/
if (scroll_region || W_WIDTH(wp) != Columns)
if (scroll_region || wp->w_width != Columns)
{
if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL))
scroll_region_set(wp, row);
@@ -10729,21 +10729,21 @@ redraw_win_toolbar(win_T *wp)
/* TODO: use fewer spaces if there is not enough room */
for (menu = wp->w_winbar->children;
menu != NULL && col < W_WIDTH(wp); menu = menu->next)
menu != NULL && col < wp->w_width; menu = menu->next)
{
space_to_screenline(off + col, fill_attr);
if (++col >= W_WIDTH(wp))
if (++col >= wp->w_width)
break;
if (col > 1)
{
space_to_screenline(off + col, fill_attr);
if (++col >= W_WIDTH(wp))
if (++col >= wp->w_width)
break;
}
wp->w_winbar_items[item_idx].wb_startcol = col;
space_to_screenline(off + col, button_attr);
if (++col >= W_WIDTH(wp))
if (++col >= wp->w_width)
break;
next_col = text_to_screenline(wp, menu->name, col);
@@ -10756,20 +10756,20 @@ redraw_win_toolbar(win_T *wp)
wp->w_winbar_items[item_idx].wb_menu = menu;
++item_idx;
if (col >= W_WIDTH(wp))
if (col >= wp->w_width)
break;
space_to_screenline(off + col, button_attr);
++col;
}
while (col < W_WIDTH(wp))
while (col < wp->w_width)
{
space_to_screenline(off + col, fill_attr);
++col;
}
wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */
screen_line(wp->w_winrow, wp->w_wincol, (int)W_WIDTH(wp),
(int)W_WIDTH(wp), FALSE);
screen_line(wp->w_winrow, wp->w_wincol, (int)wp->w_width,
(int)wp->w_width, FALSE);
}
#endif
/*
@@ -10901,7 +10901,7 @@ win_redr_ruler(win_T *wp, int always)
row = W_WINROW(wp) + wp->w_height;
fillchar = fillchar_status(&attr, wp);
off = wp->w_wincol;
width = W_WIDTH(wp);
width = wp->w_width;
}
else
{