To: vim_dev@googlegroups.com Subject: Patch 9.0.1607 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1607 Problem: screenpos() returns wrong row with diff filler lines. Solution: Only add filler lines when appropriate. Also don't add the 'smoothscroll' marker when w_skipcol is zero. (closes #12485, closes #12484) Files: src/move.c, src/testdir/test_cursor_func.vim *** ../vim-9.0.1606/src/move.c 2023-06-03 22:08:11.522360596 +0100 --- src/move.c 2023-06-04 19:27:24.104636327 +0100 *************** *** 344,350 **** check_topline = TRUE; else if (check_top_offset()) check_topline = TRUE; ! else if (curwin->w_cursor.lnum == curwin->w_topline) { colnr_T vcol; --- 344,351 ---- check_topline = TRUE; else if (check_top_offset()) check_topline = TRUE; ! else if (curwin->w_skipcol > 0 ! && curwin->w_cursor.lnum == curwin->w_topline) { colnr_T vcol; *************** *** 1459,1465 **** #ifdef FEAT_DIFF // Add filler lines above this buffer line. ! row += diff_check_fill(wp, lnum); #endif colnr_T off = win_col_off(wp); --- 1460,1467 ---- #ifdef FEAT_DIFF // Add filler lines above this buffer line. ! row += lnum == wp->w_topline ? wp->w_topfill ! : diff_check_fill(wp, lnum); #endif colnr_T off = win_col_off(wp); *************** *** 1479,1485 **** col += off; width = wp->w_width - off + win_col_off2(wp); ! if (pos->lnum == wp->w_topline) col -= wp->w_skipcol; // long line wrapping, adjust row --- 1481,1487 ---- col += off; width = wp->w_width - off + win_col_off2(wp); ! if (lnum == wp->w_topline) col -= wp->w_skipcol; // long line wrapping, adjust row *************** *** 1848,1853 **** --- 1850,1856 ---- } } + // TODO: is comparing w_topline with prev_topline still needed? if (curwin->w_topline == prev_topline || curwin->w_skipcol != prev_skipcol) // need to redraw because wl_size of the topline may now be invalid *** ../vim-9.0.1606/src/testdir/test_cursor_func.vim 2023-06-03 17:11:40.789005400 +0100 --- src/testdir/test_cursor_func.vim 2023-06-04 19:25:42.232818166 +0100 *************** *** 132,144 **** 1split normal G$ redraw call assert_equal({'row': winrow + 0, \ 'col': wincol + 20 - 1, \ 'curscol': wincol + 20 - 1, \ 'endcol': wincol + 20 - 1}, \ screenpos(win_getid(), line('.'), col('.'))) ! " w_skipcol should be subtracted setlocal nowrap normal 050zl$ call assert_equal({'row': winrow + 0, --- 132,145 ---- 1split normal G$ redraw + " w_skipcol should be subtracted call assert_equal({'row': winrow + 0, \ 'col': wincol + 20 - 1, \ 'curscol': wincol + 20 - 1, \ 'endcol': wincol + 20 - 1}, \ screenpos(win_getid(), line('.'), col('.'))) ! " w_leftcol should be subtracted setlocal nowrap normal 050zl$ call assert_equal({'row': winrow + 0, *************** *** 203,208 **** --- 204,222 ---- windo diffthis wincmd w call assert_equal(#{col: 3, row: 7, endcol: 3, curscol: 3}, screenpos(0, 4, 1)) + call assert_equal(#{col: 3, row: 8, endcol: 3, curscol: 3}, screenpos(0, 5, 1)) + exe "normal! 3\" + call assert_equal(#{col: 3, row: 4, endcol: 3, curscol: 3}, screenpos(0, 4, 1)) + call assert_equal(#{col: 3, row: 5, endcol: 3, curscol: 3}, screenpos(0, 5, 1)) + exe "normal! \" + call assert_equal(#{col: 3, row: 3, endcol: 3, curscol: 3}, screenpos(0, 4, 1)) + call assert_equal(#{col: 3, row: 4, endcol: 3, curscol: 3}, screenpos(0, 5, 1)) + exe "normal! \" + call assert_equal(#{col: 3, row: 2, endcol: 3, curscol: 3}, screenpos(0, 4, 1)) + call assert_equal(#{col: 3, row: 3, endcol: 3, curscol: 3}, screenpos(0, 5, 1)) + exe "normal! \" + call assert_equal(#{col: 3, row: 1, endcol: 3, curscol: 3}, screenpos(0, 4, 1)) + call assert_equal(#{col: 3, row: 2, endcol: 3, curscol: 3}, screenpos(0, 5, 1)) windo diffoff bwipe! *** ../vim-9.0.1606/src/version.c 2023-06-04 18:46:25.158494677 +0100 --- src/version.c 2023-06-04 19:26:09.652769031 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1607, /**/ -- Two percent of zero is almost nothing. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///