mirror of
https://github.com/vim/vim.git
synced 2025-10-06 05:44:14 -04:00
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:
22
src/move.c
22
src/move.c
@@ -855,14 +855,14 @@ validate_cursor_col(void)
|
||||
col = curwin->w_virtcol;
|
||||
off = curwin_col_off();
|
||||
col += off;
|
||||
width = W_WIDTH(curwin) - off + curwin_col_off2();
|
||||
width = curwin->w_width - off + curwin_col_off2();
|
||||
|
||||
/* long line wrapping, adjust curwin->w_wrow */
|
||||
if (curwin->w_p_wrap
|
||||
&& col >= (colnr_T)W_WIDTH(curwin)
|
||||
&& col >= (colnr_T)curwin->w_width
|
||||
&& width > 0)
|
||||
/* use same formula as what is used in curs_columns() */
|
||||
col -= ((col - W_WIDTH(curwin)) / width + 1) * width;
|
||||
col -= ((col - curwin->w_width) / width + 1) * width;
|
||||
if (col > (int)curwin->w_leftcol)
|
||||
col -= curwin->w_leftcol;
|
||||
else
|
||||
@@ -975,11 +975,11 @@ curs_columns(
|
||||
*/
|
||||
curwin->w_wrow = curwin->w_cline_row;
|
||||
|
||||
textwidth = W_WIDTH(curwin) - extra;
|
||||
textwidth = curwin->w_width - extra;
|
||||
if (textwidth <= 0)
|
||||
{
|
||||
/* No room for text, put cursor in last char of window. */
|
||||
curwin->w_wcol = W_WIDTH(curwin) - 1;
|
||||
curwin->w_wcol = curwin->w_width - 1;
|
||||
curwin->w_wrow = curwin->w_height - 1;
|
||||
}
|
||||
else if (curwin->w_p_wrap && curwin->w_width != 0)
|
||||
@@ -987,10 +987,10 @@ curs_columns(
|
||||
width = textwidth + curwin_col_off2();
|
||||
|
||||
/* long line wrapping, adjust curwin->w_wrow */
|
||||
if (curwin->w_wcol >= W_WIDTH(curwin))
|
||||
if (curwin->w_wcol >= curwin->w_width)
|
||||
{
|
||||
/* this same formula is used in validate_cursor_col() */
|
||||
n = (curwin->w_wcol - W_WIDTH(curwin)) / width + 1;
|
||||
n = (curwin->w_wcol - curwin->w_width) / width + 1;
|
||||
curwin->w_wcol -= n * width;
|
||||
curwin->w_wrow += n;
|
||||
|
||||
@@ -1021,7 +1021,7 @@ curs_columns(
|
||||
* extra
|
||||
*/
|
||||
off_left = (int)startcol - (int)curwin->w_leftcol - p_siso;
|
||||
off_right = (int)endcol - (int)(curwin->w_leftcol + W_WIDTH(curwin)
|
||||
off_right = (int)endcol - (int)(curwin->w_leftcol + curwin->w_width
|
||||
- p_siso) + 1;
|
||||
if (off_left < 0 || off_right > 0)
|
||||
{
|
||||
@@ -1249,7 +1249,7 @@ scrolldown(
|
||||
validate_virtcol();
|
||||
validate_cheight();
|
||||
wrow += curwin->w_cline_height - 1 -
|
||||
curwin->w_virtcol / W_WIDTH(curwin);
|
||||
curwin->w_virtcol / curwin->w_width;
|
||||
}
|
||||
while (wrow >= curwin->w_height && curwin->w_cursor.lnum > 1)
|
||||
{
|
||||
@@ -1454,7 +1454,7 @@ scrolldown_clamp(void)
|
||||
validate_cheight();
|
||||
validate_virtcol();
|
||||
end_row += curwin->w_cline_height - 1 -
|
||||
curwin->w_virtcol / W_WIDTH(curwin);
|
||||
curwin->w_virtcol / curwin->w_width;
|
||||
}
|
||||
if (end_row < curwin->w_height - p_so)
|
||||
{
|
||||
@@ -1512,7 +1512,7 @@ scrollup_clamp(void)
|
||||
if (curwin->w_p_wrap && curwin->w_width != 0)
|
||||
{
|
||||
validate_virtcol();
|
||||
start_row -= curwin->w_virtcol / W_WIDTH(curwin);
|
||||
start_row -= curwin->w_virtcol / curwin->w_width;
|
||||
}
|
||||
if (start_row >= p_so)
|
||||
{
|
||||
|
Reference in New Issue
Block a user