Mercurial > vim
comparison src/charset.c @ 31946:05414bdc5c2c v9.0.1305
patch 9.0.1305: cursor in wrong line with virtual text above
Commit: https://github.com/vim/vim/commit/55a27d8ea7c112429fff14aba5db562de7f765f1
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 12 18:03:57 2023 +0000
patch 9.0.1305: cursor in wrong line with virtual text above
Problem: Cursor in wrong line with virtual text above.
Solution: Count extra line for text property above/below. (closes https://github.com/vim/vim/issues/11959)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Feb 2023 19:15:03 +0100 |
parents | 96d6d31dd66b |
children | c0a9bc376b54 |
comparison
equal
deleted
inserted
replaced
31945:884702f65f17 | 31946:05414bdc5c2c |
---|---|
811 if (cts->cts_has_prop_with_text && *cts->cts_ptr == NUL | 811 if (cts->cts_has_prop_with_text && *cts->cts_ptr == NUL |
812 && cts->cts_ptr == cts->cts_line) | 812 && cts->cts_ptr == cts->cts_line) |
813 { | 813 { |
814 (void)win_lbr_chartabsize(cts, NULL); | 814 (void)win_lbr_chartabsize(cts, NULL); |
815 cts->cts_vcol += cts->cts_cur_text_width; | 815 cts->cts_vcol += cts->cts_cur_text_width; |
816 | |
817 // when properties are above or below the empty line must also be | |
818 // counted | |
819 if (cts->cts_prop_lines > 0) | |
820 ++cts->cts_vcol; | |
816 } | 821 } |
817 #endif | 822 #endif |
818 } | 823 } |
819 | 824 |
820 /* | 825 /* |
1215 // tab size changes because of the inserted text | 1220 // tab size changes because of the inserted text |
1216 size -= tab_size; | 1221 size -= tab_size; |
1217 tab_size = win_chartabsize(wp, s, vcol + size); | 1222 tab_size = win_chartabsize(wp, s, vcol + size); |
1218 size += tab_size; | 1223 size += tab_size; |
1219 } | 1224 } |
1225 if (tp->tp_col == MAXCOL && (tp->tp_flags | |
1226 & (TP_FLAG_ALIGN_ABOVE | TP_FLAG_ALIGN_BELOW))) | |
1227 // count extra line for property above/below | |
1228 ++cts->cts_prop_lines; | |
1220 } | 1229 } |
1221 } | 1230 } |
1222 if (tp->tp_col != MAXCOL && tp->tp_col - 1 > col) | 1231 if (tp->tp_col != MAXCOL && tp->tp_col - 1 > col) |
1223 break; | 1232 break; |
1224 } | 1233 } |