diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-18 12:28:59 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-12-18 12:28:59 +0000 |
commit | ba2d19193201277397c25c1f5a134ea042542555 (patch) | |
tree | adb4bef44960829754d2ef883ed302d8a96dda51 | |
parent | b5328b46a79d1383fb1d7d193e7271efcf2f996a (diff) |
patch 9.0.1072: screenpos() column result in fold may be too smallv9.0.1072
Problem: screenpos() column result in fold may be too small.
Solution: Add space of 'number', sign column, etc. (closes #11715)
-rw-r--r-- | src/move.c | 5 | ||||
-rw-r--r-- | src/testdir/test_cursor_func.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/move.c b/src/move.c index fde7f20e25..29ba56940b 100644 --- a/src/move.c +++ b/src/move.c @@ -1416,7 +1416,6 @@ textpos2screenpos( if (pos->lnum >= wp->w_topline && pos->lnum <= wp->w_botline) { - colnr_T off; colnr_T col; int width; linenr_T lnum = pos->lnum; @@ -1432,11 +1431,12 @@ textpos2screenpos( row += diff_check_fill(wp, lnum); #endif + colnr_T off = win_col_off(wp); #ifdef FEAT_FOLDING if (is_folded) { row += W_WINROW(wp); - coloff = wp->w_wincol + 1; + coloff = wp->w_wincol + 1 + off; } else #endif @@ -1445,7 +1445,6 @@ textpos2screenpos( // similar to what is done in validate_cursor_col() col = scol; - off = win_col_off(wp); col += off; width = wp->w_width - off + win_col_off2(wp); diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim index fe64be0e71..d74255e19b 100644 --- a/src/testdir/test_cursor_func.vim +++ b/src/testdir/test_cursor_func.vim @@ -150,8 +150,12 @@ func Test_screenpos_fold() redraw call assert_equal(2, screenpos(1, 2, 1).row) call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 3, 1)) - call assert_equal(3, screenpos(1, 4, 1).row) - call assert_equal(3, screenpos(1, 5, 1).row) + call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 4, 1)) + call assert_equal(#{col: 1, row: 3, endcol: 1, curscol: 1}, screenpos(1, 5, 1)) + setlocal number + call assert_equal(#{col: 5, row: 3, endcol: 5, curscol: 5}, screenpos(1, 3, 1)) + call assert_equal(#{col: 5, row: 3, endcol: 5, curscol: 5}, screenpos(1, 4, 1)) + call assert_equal(#{col: 5, row: 3, endcol: 5, curscol: 5}, screenpos(1, 5, 1)) call assert_equal(4, screenpos(1, 6, 1).row) bwipe! endfunc diff --git a/src/version.c b/src/version.c index f80aeca913..91313cb3f3 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1072, +/**/ 1071, /**/ 1070, |