To: vim_dev@googlegroups.com Subject: Patch 8.1.2228 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2228 Problem: screenpos() returns wrong values when 'number' is set. (Ben Jackson) Solution: Compare the column with the window width. (closes #5133) Files: src/move.c, src/testdir/test_cursor_func.vim *** ../vim-8.1.2227/src/move.c 2019-10-17 22:58:59.066497012 +0200 --- src/move.c 2019-10-27 21:34:02.036916285 +0100 *************** *** 1217,1223 **** col -= rowoff * width; } col -= wp->w_leftcol; ! if (col >= width) col = -1; if (col >= 0) coloff = col - scol + wp->w_wincol + 1; --- 1217,1223 ---- col -= rowoff * width; } col -= wp->w_leftcol; ! if (col >= wp->w_width) col = -1; if (col >= 0) coloff = col - scol + wp->w_wincol + 1; *** ../vim-8.1.2227/src/testdir/test_cursor_func.vim 2019-09-08 21:51:36.449843947 +0200 --- src/testdir/test_cursor_func.vim 2019-10-27 21:25:06.731282610 +0100 *************** *** 100,102 **** --- 100,117 ---- close bwipe! endfunc + + func Test_screenpos_number() + rightbelow new + rightbelow 73vsplit + call setline (1, repeat('x', 66)) + setlocal number + redraw + let winid = win_getid() + let [winrow, wincol] = win_screenpos(winid) + let pos = screenpos(winid, 1, 66) + call assert_equal(winrow, pos.row) + call assert_equal(wincol + 66 + 3, pos.col) + close + bwipe! + endfunc *** ../vim-8.1.2227/src/version.c 2019-10-27 20:36:21.876503832 +0100 --- src/version.c 2019-10-27 21:23:30.067728182 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2228, /**/ -- Q: What's a light-year? A: One-third less calories than a regular year. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///