[completely wrong diff was included, this is the right one]
Patch 9.0.0746
Problem: Breakindent test cases are commented out.
Solution: Adjust expected result to slightly different behavior. Correct
computations for cursor position.
Files: src/move.c, src/structs.h, src/testdir/test_breakindent.vim
*** ../vim-9.0.0745/src/move.c 2022-10-13 20:23:24.438002818 +0100
--- src/move.c 2022-10-13 21:44:28.593765638 +0100
***************
*** 1036,1043 ****
int off_left, off_right;
int n;
int p_lines;
! int width = 0;
! int textwidth;
int new_leftcol;
colnr_T startcol;
colnr_T endcol;
--- 1036,1043 ----
int off_left, off_right;
int n;
int p_lines;
! int width1; // text width for first screen line
! int width2 = 0; // text width for second and later
screen line
int new_leftcol;
colnr_T startcol;
colnr_T endcol;
***************
*** 1087,1094 ****
*/
curwin->w_wrow = curwin->w_cline_row;
! textwidth = curwin->w_width - extra;
! if (textwidth <= 0)
{
// No room for text, put cursor in last char of window.
// If not wrapping, the last non-empty line.
--- 1087,1094 ----
*/
curwin->w_wrow = curwin->w_cline_row;
! width1 = curwin->w_width - extra;
! if (width1 <= 0)
{
// No room for text, put cursor in last char of window.
// If not wrapping, the last non-empty line.
***************
*** 1100,1112 ****
}
else if (curwin->w_p_wrap && curwin->w_width != 0)
{
! width = textwidth + curwin_col_off2();
// skip columns that are not visible
if (curwin->w_cursor.lnum == curwin->w_topline
&& curwin->w_wcol >= curwin->w_skipcol)
{
! curwin->w_wcol -= curwin->w_skipcol;
did_sub_skipcol = TRUE;
}
--- 1100,1119 ----
}
else if (curwin->w_p_wrap && curwin->w_width != 0)
{
! width2 = width1 + curwin_col_off2();
// skip columns that are not visible
if (curwin->w_cursor.lnum == curwin->w_topline
+ && curwin->w_skipcol > 0
&& 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;
}
***************
*** 1114,1121 ****
if (curwin->w_wcol >= curwin->w_width)
{
// this same formula is used in validate_cursor_col()
! n = (curwin->w_wcol - curwin->w_width) / width + 1;
! curwin->w_wcol -= n * width;
curwin->w_wrow += n;
#ifdef FEAT_LINEBREAK
--- 1121,1128 ----
if (curwin->w_wcol >= curwin->w_width)
{
// this same formula is used in validate_cursor_col()
! n = (curwin->w_wcol - curwin->w_width) / width2 + 1;
! curwin->w_wcol -= n * width2;
curwin->w_wrow += n;
#ifdef FEAT_LINEBREAK
***************
*** 1170,1177 ****
// When far off or not enough room on either side, put cursor in
// middle of window.
! if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left)
! new_leftcol = curwin->w_wcol - extra - textwidth / 2;
else
{
if (diff < p_ss)
--- 1177,1184 ----
// When far off or not enough room on either side, put cursor in
// middle of window.
! if (p_ss == 0 || diff >= width1 / 2 || off_right >= off_left)
! new_leftcol = curwin->w_wcol - extra - width1 / 2;
else
{
if (diff < p_ss)
***************
*** 1223,1229 ****
- 1 >= curwin->w_height))
&& curwin->w_height != 0
&& curwin->w_cursor.lnum == curwin->w_topline
! && width > 0
&& curwin->w_width != 0)
{
// Cursor past end of screen. Happens with a single line that does
--- 1230,1236 ----
- 1 >= curwin->w_height))
&& curwin->w_height != 0
&& curwin->w_cursor.lnum == curwin->w_topline
! && width2 > 0
&& curwin->w_width != 0)
{
// Cursor past end of screen. Happens with a single line that does
***************
*** 1233,1239 ****
// 2: Less than 'scrolloff' lines below
// 3: both of them
extra = 0;
! if (curwin->w_skipcol + so * width > curwin->w_virtcol)
extra = 1;
// Compute last display line of the buffer line that we want at the
// bottom of the window.
--- 1240,1246 ----
// 2: Less than 'scrolloff' lines below
// 3: both of them
extra = 0;
! if (curwin->w_skipcol + so * width2 > curwin->w_virtcol)
extra = 1;
// Compute last display line of the buffer line that we want at the
// bottom of the window.
***************
*** 1244,1256 ****
n = curwin->w_wrow + so;
else
n = p_lines;
! if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width - so)
extra += 2;
if (extra == 3 || curwin->w_height <= so * 2)
{
// not enough room for 'scrolloff', put cursor in the middle
! n = curwin->w_virtcol / width;
if (n > curwin->w_height / 2)
n -= curwin->w_height / 2;
else
--- 1251,1263 ----
n = curwin->w_wrow + so;
else
n = p_lines;
! if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width2 - so)
extra += 2;
if (extra == 3 || curwin->w_height <= so * 2)
{
// not enough room for 'scrolloff', put cursor in the middle
! n = curwin->w_virtcol / width2;
if (n > curwin->w_height / 2)
n -= curwin->w_height / 2;
else
***************
*** 1258,1302 ****
// don't skip more than necessary
if (n > p_lines - curwin->w_height + 1)
n = p_lines - curwin->w_height + 1;
! curwin->w_skipcol = n * width;
}
else if (extra == 1)
{
// less than 'scrolloff' lines above, decrease skipcol
! extra = (curwin->w_skipcol + so * width - curwin->w_virtcol
! + width - 1) / width;
if (extra > 0)
{
! if ((colnr_T)(extra * width) > curwin->w_skipcol)
! extra = curwin->w_skipcol / width;
! curwin->w_skipcol -= extra * width;
}
}
else if (extra == 2)
{
// less than 'scrolloff' lines below, increase skipcol
! endcol = (n - curwin->w_height + 1) * width;
while (endcol > curwin->w_virtcol)
! endcol -= width;
if (endcol > curwin->w_skipcol)
curwin->w_skipcol = endcol;
}
// adjust w_wrow for the changed w_skipcol
if (did_sub_skipcol)
! curwin->w_wrow -= (curwin->w_skipcol - prev_skipcol) / width;
else
! curwin->w_wrow -= curwin->w_skipcol / width;
if (curwin->w_wrow >= curwin->w_height)
{
// small window, make sure cursor is in it
extra = curwin->w_wrow - curwin->w_height + 1;
! curwin->w_skipcol += extra * width;
curwin->w_wrow -= extra;
}
! extra = ((int)prev_skipcol - (int)curwin->w_skipcol) / width;
if (extra > 0)
win_ins_lines(curwin, 0, extra, FALSE, FALSE);
else if (extra < 0)
--- 1265,1309 ----
// don't skip more than necessary
if (n > p_lines - curwin->w_height + 1)
n = p_lines - curwin->w_height + 1;
! curwin->w_skipcol = n * width2;
}
else if (extra == 1)
{
// less than 'scrolloff' lines above, decrease skipcol
! extra = (curwin->w_skipcol + so * width2 - curwin->w_virtcol
! + width2 - 1) / width2;
if (extra > 0)
{
! if ((colnr_T)(extra * width2) > curwin->w_skipcol)
! extra = curwin->w_skipcol / width2;
! curwin->w_skipcol -= extra * width2;
}
}
else if (extra == 2)
{
// less than 'scrolloff' lines below, increase skipcol
! endcol = (n - curwin->w_height + 1) * width2;
while (endcol > curwin->w_virtcol)
! endcol -= width2;
if (endcol > curwin->w_skipcol)
curwin->w_skipcol = endcol;
}
// adjust w_wrow for the changed w_skipcol
if (did_sub_skipcol)
! curwin->w_wrow -= (curwin->w_skipcol - prev_skipcol) / width2;
else
! curwin->w_wrow -= curwin->w_skipcol / width2;
if (curwin->w_wrow >= curwin->w_height)
{
// small window, make sure cursor is in it
extra = curwin->w_wrow - curwin->w_height + 1;
! curwin->w_skipcol += extra * width2;
curwin->w_wrow -= extra;
}
! extra = ((int)prev_skipcol - (int)curwin->w_skipcol) / width2;
if (extra > 0)
win_ins_lines(curwin, 0, extra, FALSE, FALSE);
else if (extra < 0)
*** ../vim-9.0.0745/src/structs.h 2022-10-12 19:53:10.617726846 +0100
--- src/structs.h 2022-10-13 21:29:12.619398016 +0100
***************
*** 3600,3606 ****
// 'wrap' is off
colnr_T w_skipcol; // starting screen column for the first
// line in the window; used when 'wrap' is
! // on
int w_empty_rows; // number of ~ rows in window
#ifdef FEAT_DIFF
--- 3600,3606 ----
// 'wrap' is off
colnr_T w_skipcol; // starting screen column for the first
// line in the window; used when 'wrap' is
! // on; does not include win_col_off()
int w_empty_rows; // number of ~ rows in window
#ifdef FEAT_DIFF
***************
*** 4667,4674 ****
// cts_text_props is not used
textprop_T *cts_text_props; // text props (allocated)
char cts_has_prop_with_text; // TRUE if if a property inserts text
! int cts_cur_text_width; // width of current inserted text
! int cts_first_char; // width text props above the
line
int cts_with_trailing; // include size of trailing
props with
// last character
int cts_start_incl; // prop has true "start_incl"
arg
--- 4667,4674 ----
// cts_text_props is not used
textprop_T *cts_text_props; // text props (allocated)
char cts_has_prop_with_text; // TRUE if if a property inserts text
! int cts_cur_text_width; // width of current inserted
text
! int cts_first_char; // width text props above the
line
int cts_with_trailing; // include size of trailing
props with
// last character
int cts_start_incl; // prop has true "start_incl"
arg
*** ../vim-9.0.0745/src/testdir/test_breakindent.vim 2022-10-13
20:23:24.438002818 +0100
--- src/testdir/test_breakindent.vim 2022-10-13 21:06:03.251815907 +0100
***************
*** 683,689 ****
call s:compare_lines(expect, lines)
" Scroll down one screen line
setl scrolloff=5
! norm! 5gj
redraw!
let lines = s:screen_lines(1, 20)
let expect = [
--- 683,689 ----
call s:compare_lines(expect, lines)
" Scroll down one screen line
setl scrolloff=5
! norm! 6gj
redraw!
let lines = s:screen_lines(1, 20)
let expect = [
***************
*** 691,698 ****
\ " mnopqrstabcdefgh",
\ " ijklmnopqrstabcd",
\ ]
! " FIXME: this currently fails
! " call s:compare_lines(expect, lines)
setl briopt+=shift:2
norm! 1gg
--- 691,697 ----
\ " mnopqrstabcdefgh",
\ " ijklmnopqrstabcd",
\ ]
! call s:compare_lines(expect, lines)
setl briopt+=shift:2
norm! 1gg
***************
*** 704,718 ****
\ ]
call s:compare_lines(expect, lines)
" Scroll down one screen line
! norm! 5gj
let lines = s:screen_lines(1, 20)
let expect = [
\ "<<< qrstabcdefghij",
\ " klmnopqrstabcd",
\ " efghijklmnopqr",
\ ]
! " FIXME: this currently fails
! " call s:compare_lines(expect, lines)
call s:close_windows('set breakindent& briopt& cpo& number&')
endfunc
--- 703,716 ----
\ ]
call s:compare_lines(expect, lines)
" Scroll down one screen line
! norm! 6gj
let lines = s:screen_lines(1, 20)
let expect = [
\ "<<< qrstabcdefghij",
\ " klmnopqrstabcd",
\ " efghijklmnopqr",
\ ]
! call s:compare_lines(expect, lines)
call s:close_windows('set breakindent& briopt& cpo& number&')
endfunc
*** ../vim-9.0.0745/src/version.c 2022-10-13 20:23:24.438002818 +0100
--- src/version.c 2022-10-13 21:12:02.938115288 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 746,
/**/
--
Two cows are standing together in a field. One asks the other:
"So what do you think about this Mad Cow Disease?"
The other replies: "That doesn't concern me. I'm a helicopter."
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221013205815.487441C0760%40moolenaar.net.