mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.0746: breakindent test cases are commented out
Problem: Breakindent test cases are commented out. Solution: Adjust expected result to slightly different behavior. Correct computations for cursor position.
This commit is contained in:
59
src/move.c
59
src/move.c
@@ -1036,8 +1036,8 @@ curs_columns(
|
|||||||
int off_left, off_right;
|
int off_left, off_right;
|
||||||
int n;
|
int n;
|
||||||
int p_lines;
|
int p_lines;
|
||||||
int width = 0;
|
int width1; // text width for first screen line
|
||||||
int textwidth;
|
int width2 = 0; // text width for second and later screen line
|
||||||
int new_leftcol;
|
int new_leftcol;
|
||||||
colnr_T startcol;
|
colnr_T startcol;
|
||||||
colnr_T endcol;
|
colnr_T endcol;
|
||||||
@@ -1087,8 +1087,8 @@ curs_columns(
|
|||||||
*/
|
*/
|
||||||
curwin->w_wrow = curwin->w_cline_row;
|
curwin->w_wrow = curwin->w_cline_row;
|
||||||
|
|
||||||
textwidth = curwin->w_width - extra;
|
width1 = curwin->w_width - extra;
|
||||||
if (textwidth <= 0)
|
if (width1 <= 0)
|
||||||
{
|
{
|
||||||
// No room for text, put cursor in last char of window.
|
// No room for text, put cursor in last char of window.
|
||||||
// If not wrapping, the last non-empty line.
|
// If not wrapping, the last non-empty line.
|
||||||
@@ -1100,13 +1100,20 @@ curs_columns(
|
|||||||
}
|
}
|
||||||
else if (curwin->w_p_wrap && curwin->w_width != 0)
|
else if (curwin->w_p_wrap && curwin->w_width != 0)
|
||||||
{
|
{
|
||||||
width = textwidth + curwin_col_off2();
|
width2 = width1 + curwin_col_off2();
|
||||||
|
|
||||||
// skip columns that are not visible
|
// skip columns that are not visible
|
||||||
if (curwin->w_cursor.lnum == curwin->w_topline
|
if (curwin->w_cursor.lnum == curwin->w_topline
|
||||||
|
&& curwin->w_skipcol > 0
|
||||||
&& curwin->w_wcol >= curwin->w_skipcol)
|
&& curwin->w_wcol >= curwin->w_skipcol)
|
||||||
{
|
{
|
||||||
curwin->w_wcol -= curwin->w_skipcol;
|
// w_skipcol excludes win_col_off(). Include it here, since w_wcol
|
||||||
|
// counts actual screen columns.
|
||||||
|
if (curwin->w_skipcol <= width1)
|
||||||
|
curwin->w_wcol -= curwin->w_width;
|
||||||
|
else
|
||||||
|
curwin->w_wcol -= curwin->w_width
|
||||||
|
* (((curwin->w_skipcol - width1) / width2) + 1);
|
||||||
did_sub_skipcol = TRUE;
|
did_sub_skipcol = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,8 +1121,8 @@ curs_columns(
|
|||||||
if (curwin->w_wcol >= curwin->w_width)
|
if (curwin->w_wcol >= curwin->w_width)
|
||||||
{
|
{
|
||||||
// this same formula is used in validate_cursor_col()
|
// this same formula is used in validate_cursor_col()
|
||||||
n = (curwin->w_wcol - curwin->w_width) / width + 1;
|
n = (curwin->w_wcol - curwin->w_width) / width2 + 1;
|
||||||
curwin->w_wcol -= n * width;
|
curwin->w_wcol -= n * width2;
|
||||||
curwin->w_wrow += n;
|
curwin->w_wrow += n;
|
||||||
|
|
||||||
#ifdef FEAT_LINEBREAK
|
#ifdef FEAT_LINEBREAK
|
||||||
@@ -1170,8 +1177,8 @@ curs_columns(
|
|||||||
|
|
||||||
// When far off or not enough room on either side, put cursor in
|
// When far off or not enough room on either side, put cursor in
|
||||||
// middle of window.
|
// middle of window.
|
||||||
if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left)
|
if (p_ss == 0 || diff >= width1 / 2 || off_right >= off_left)
|
||||||
new_leftcol = curwin->w_wcol - extra - textwidth / 2;
|
new_leftcol = curwin->w_wcol - extra - width1 / 2;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (diff < p_ss)
|
if (diff < p_ss)
|
||||||
@@ -1223,7 +1230,7 @@ curs_columns(
|
|||||||
- 1 >= curwin->w_height))
|
- 1 >= curwin->w_height))
|
||||||
&& curwin->w_height != 0
|
&& curwin->w_height != 0
|
||||||
&& curwin->w_cursor.lnum == curwin->w_topline
|
&& curwin->w_cursor.lnum == curwin->w_topline
|
||||||
&& width > 0
|
&& width2 > 0
|
||||||
&& curwin->w_width != 0)
|
&& curwin->w_width != 0)
|
||||||
{
|
{
|
||||||
// Cursor past end of screen. Happens with a single line that does
|
// Cursor past end of screen. Happens with a single line that does
|
||||||
@@ -1233,7 +1240,7 @@ curs_columns(
|
|||||||
// 2: Less than 'scrolloff' lines below
|
// 2: Less than 'scrolloff' lines below
|
||||||
// 3: both of them
|
// 3: both of them
|
||||||
extra = 0;
|
extra = 0;
|
||||||
if (curwin->w_skipcol + so * width > curwin->w_virtcol)
|
if (curwin->w_skipcol + so * width2 > curwin->w_virtcol)
|
||||||
extra = 1;
|
extra = 1;
|
||||||
// Compute last display line of the buffer line that we want at the
|
// Compute last display line of the buffer line that we want at the
|
||||||
// bottom of the window.
|
// bottom of the window.
|
||||||
@@ -1244,13 +1251,13 @@ curs_columns(
|
|||||||
n = curwin->w_wrow + so;
|
n = curwin->w_wrow + so;
|
||||||
else
|
else
|
||||||
n = p_lines;
|
n = p_lines;
|
||||||
if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width - so)
|
if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width2 - so)
|
||||||
extra += 2;
|
extra += 2;
|
||||||
|
|
||||||
if (extra == 3 || curwin->w_height <= so * 2)
|
if (extra == 3 || curwin->w_height <= so * 2)
|
||||||
{
|
{
|
||||||
// not enough room for 'scrolloff', put cursor in the middle
|
// not enough room for 'scrolloff', put cursor in the middle
|
||||||
n = curwin->w_virtcol / width;
|
n = curwin->w_virtcol / width2;
|
||||||
if (n > curwin->w_height / 2)
|
if (n > curwin->w_height / 2)
|
||||||
n -= curwin->w_height / 2;
|
n -= curwin->w_height / 2;
|
||||||
else
|
else
|
||||||
@@ -1258,45 +1265,45 @@ curs_columns(
|
|||||||
// don't skip more than necessary
|
// don't skip more than necessary
|
||||||
if (n > p_lines - curwin->w_height + 1)
|
if (n > p_lines - curwin->w_height + 1)
|
||||||
n = p_lines - curwin->w_height + 1;
|
n = p_lines - curwin->w_height + 1;
|
||||||
curwin->w_skipcol = n * width;
|
curwin->w_skipcol = n * width2;
|
||||||
}
|
}
|
||||||
else if (extra == 1)
|
else if (extra == 1)
|
||||||
{
|
{
|
||||||
// less than 'scrolloff' lines above, decrease skipcol
|
// less than 'scrolloff' lines above, decrease skipcol
|
||||||
extra = (curwin->w_skipcol + so * width - curwin->w_virtcol
|
extra = (curwin->w_skipcol + so * width2 - curwin->w_virtcol
|
||||||
+ width - 1) / width;
|
+ width2 - 1) / width2;
|
||||||
if (extra > 0)
|
if (extra > 0)
|
||||||
{
|
{
|
||||||
if ((colnr_T)(extra * width) > curwin->w_skipcol)
|
if ((colnr_T)(extra * width2) > curwin->w_skipcol)
|
||||||
extra = curwin->w_skipcol / width;
|
extra = curwin->w_skipcol / width2;
|
||||||
curwin->w_skipcol -= extra * width;
|
curwin->w_skipcol -= extra * width2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (extra == 2)
|
else if (extra == 2)
|
||||||
{
|
{
|
||||||
// less than 'scrolloff' lines below, increase skipcol
|
// less than 'scrolloff' lines below, increase skipcol
|
||||||
endcol = (n - curwin->w_height + 1) * width;
|
endcol = (n - curwin->w_height + 1) * width2;
|
||||||
while (endcol > curwin->w_virtcol)
|
while (endcol > curwin->w_virtcol)
|
||||||
endcol -= width;
|
endcol -= width2;
|
||||||
if (endcol > curwin->w_skipcol)
|
if (endcol > curwin->w_skipcol)
|
||||||
curwin->w_skipcol = endcol;
|
curwin->w_skipcol = endcol;
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust w_wrow for the changed w_skipcol
|
// adjust w_wrow for the changed w_skipcol
|
||||||
if (did_sub_skipcol)
|
if (did_sub_skipcol)
|
||||||
curwin->w_wrow -= (curwin->w_skipcol - prev_skipcol) / width;
|
curwin->w_wrow -= (curwin->w_skipcol - prev_skipcol) / width2;
|
||||||
else
|
else
|
||||||
curwin->w_wrow -= curwin->w_skipcol / width;
|
curwin->w_wrow -= curwin->w_skipcol / width2;
|
||||||
|
|
||||||
if (curwin->w_wrow >= curwin->w_height)
|
if (curwin->w_wrow >= curwin->w_height)
|
||||||
{
|
{
|
||||||
// small window, make sure cursor is in it
|
// small window, make sure cursor is in it
|
||||||
extra = curwin->w_wrow - curwin->w_height + 1;
|
extra = curwin->w_wrow - curwin->w_height + 1;
|
||||||
curwin->w_skipcol += extra * width;
|
curwin->w_skipcol += extra * width2;
|
||||||
curwin->w_wrow -= extra;
|
curwin->w_wrow -= extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
extra = ((int)prev_skipcol - (int)curwin->w_skipcol) / width;
|
extra = ((int)prev_skipcol - (int)curwin->w_skipcol) / width2;
|
||||||
if (extra > 0)
|
if (extra > 0)
|
||||||
win_ins_lines(curwin, 0, extra, FALSE, FALSE);
|
win_ins_lines(curwin, 0, extra, FALSE, FALSE);
|
||||||
else if (extra < 0)
|
else if (extra < 0)
|
||||||
|
@@ -3600,7 +3600,7 @@ struct window_S
|
|||||||
// 'wrap' is off
|
// 'wrap' is off
|
||||||
colnr_T w_skipcol; // starting screen column for the first
|
colnr_T w_skipcol; // starting screen column for the first
|
||||||
// line in the window; used when 'wrap' is
|
// line in the window; used when 'wrap' is
|
||||||
// on
|
// on; does not include win_col_off()
|
||||||
|
|
||||||
int w_empty_rows; // number of ~ rows in window
|
int w_empty_rows; // number of ~ rows in window
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
|
@@ -683,7 +683,7 @@ func Test_breakindent20_cpo_n_nextpage()
|
|||||||
call s:compare_lines(expect, lines)
|
call s:compare_lines(expect, lines)
|
||||||
" Scroll down one screen line
|
" Scroll down one screen line
|
||||||
setl scrolloff=5
|
setl scrolloff=5
|
||||||
norm! 5gj
|
norm! 6gj
|
||||||
redraw!
|
redraw!
|
||||||
let lines = s:screen_lines(1, 20)
|
let lines = s:screen_lines(1, 20)
|
||||||
let expect = [
|
let expect = [
|
||||||
@@ -691,8 +691,7 @@ func Test_breakindent20_cpo_n_nextpage()
|
|||||||
\ " mnopqrstabcdefgh",
|
\ " mnopqrstabcdefgh",
|
||||||
\ " ijklmnopqrstabcd",
|
\ " ijklmnopqrstabcd",
|
||||||
\ ]
|
\ ]
|
||||||
" FIXME: this currently fails
|
call s:compare_lines(expect, lines)
|
||||||
" call s:compare_lines(expect, lines)
|
|
||||||
|
|
||||||
setl briopt+=shift:2
|
setl briopt+=shift:2
|
||||||
norm! 1gg
|
norm! 1gg
|
||||||
@@ -704,15 +703,14 @@ func Test_breakindent20_cpo_n_nextpage()
|
|||||||
\ ]
|
\ ]
|
||||||
call s:compare_lines(expect, lines)
|
call s:compare_lines(expect, lines)
|
||||||
" Scroll down one screen line
|
" Scroll down one screen line
|
||||||
norm! 5gj
|
norm! 6gj
|
||||||
let lines = s:screen_lines(1, 20)
|
let lines = s:screen_lines(1, 20)
|
||||||
let expect = [
|
let expect = [
|
||||||
\ "<<< qrstabcdefghij",
|
\ "<<< qrstabcdefghij",
|
||||||
\ " klmnopqrstabcd",
|
\ " klmnopqrstabcd",
|
||||||
\ " efghijklmnopqr",
|
\ " efghijklmnopqr",
|
||||||
\ ]
|
\ ]
|
||||||
" FIXME: this currently fails
|
call s:compare_lines(expect, lines)
|
||||||
" call s:compare_lines(expect, lines)
|
|
||||||
|
|
||||||
call s:close_windows('set breakindent& briopt& cpo& number&')
|
call s:close_windows('set breakindent& briopt& cpo& number&')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -699,6 +699,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 */
|
||||||
|
/**/
|
||||||
|
746,
|
||||||
/**/
|
/**/
|
||||||
745,
|
745,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user