vim-patch:9.1.0730: Crash with cursor-screenline and narrow window

Problem:  Crash with cursor-screenline and narrow window
          (elig0n)
Solution: Don't set right_col when width2 is 0 (zeertzjq).

fixes: vim/vim#15677
closes: vim/vim#15678

59149f0269
This commit is contained in:
zeertzjq
2024-09-14 19:28:13 +08:00
parent 90585e47fe
commit 5191a11d66
2 changed files with 13 additions and 3 deletions

View File

@@ -189,7 +189,7 @@ static void margin_columns_win(win_T *wp, int *left_col, int *right_col)
*left_col = 0;
*right_col = width1;
if (wp->w_virtcol >= (colnr_T)width1) {
if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0) {
*right_col = width1 + ((wp->w_virtcol - width1) / width2 + 1) * width2;
}
if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0) {