To: vim_dev@googlegroups.com Subject: Patch 9.0.1600 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1600 Problem: screenpos() does not take w_skipcol into account. Solution: Subtract w_skipcol from column. (closes #12486, closes #12476) Files: src/move.c, src/testdir/test_cursor_func.vim *** ../vim-9.0.1599/src/move.c 2023-06-01 19:26:23.435627545 +0100 --- src/move.c 2023-06-03 16:37:52.429066161 +0100 *************** *** 1479,1484 **** --- 1479,1487 ---- 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 if (wp->w_p_wrap && col >= (colnr_T)wp->w_width *** ../vim-9.0.1599/src/testdir/test_cursor_func.vim 2022-12-18 12:28:54.334332509 +0000 --- src/testdir/test_cursor_func.vim 2023-06-03 17:09:35.949150162 +0100 *************** *** 127,133 **** \ 'curscol': wincol + 7, \ 'endcol': wincol + 7}, winid->screenpos(line('$'), 8)) call assert_equal({'row': 0, 'col': 0, 'curscol': 0, 'endcol': 0}, ! \ winid->screenpos(line('$'), 22)) close call assert_equal({}, screenpos(999, 1, 1)) --- 127,166 ---- \ 'curscol': wincol + 7, \ 'endcol': wincol + 7}, winid->screenpos(line('$'), 8)) call assert_equal({'row': 0, 'col': 0, 'curscol': 0, 'endcol': 0}, ! \ winid->screenpos(line('$'), 22)) ! ! 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, ! \ 'col': wincol + 10 - 1, ! \ 'curscol': wincol + 10 - 1, ! \ 'endcol': wincol + 10 - 1}, ! \ screenpos(win_getid(), line('.'), col('.'))) ! ! " w_skipcol should only matter for the topline ! " FIXME: This fails because pline_m_win() does not take w_skipcol into ! " account. If it does, then other tests fail. ! " wincmd + ! " setlocal wrap smoothscroll ! " call setline(line('$') + 1, 'last line') ! " exe "normal \G$" ! " redraw ! " call assert_equal({'row': winrow + 1, ! " \ 'col': wincol + 9 - 1, ! " \ 'curscol': wincol + 9 - 1, ! " \ 'endcol': wincol + 9 - 1}, ! " \ screenpos(win_getid(), line('.'), col('.'))) ! close close call assert_equal({}, screenpos(999, 1, 1)) *** ../vim-9.0.1599/src/version.c 2023-06-02 14:16:31.911127060 +0100 --- src/version.c 2023-06-03 15:52:51.189041376 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1600, /**/ -- A meeting is an event at which the minutes are kept and the hours are lost. /// 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 ///