Mercurial > vim
comparison src/charset.c @ 32925:5d17e74a756d v9.0.1770
patch 9.0.1770: lines disappear when modifying chars before virt text
Commit: https://github.com/vim/vim/commit/a6ab5e69d3f14da8036a3018e8e93c635803ee8b
Author: Ibby <33922797+SleepySwords@users.noreply.github.com>
Date: Sun Aug 20 20:24:18 2023 +0200
patch 9.0.1770: lines disappear when modifying chars before virt text
Problem: lines disappear when modifying chars before virt text
Solution: take virtual text property length into account
closes: #12558
closes: #12244
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ibby <33922797+SleepySwords@users.noreply.github.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Aug 2023 20:45:03 +0200 |
parents | fbe3a843b6af |
children | ccfca4f03a2b 75c283beb74f |
comparison
equal
deleted
inserted
replaced
32924:1eff503fd3ca | 32925:5d17e74a756d |
---|---|
806 #endif | 806 #endif |
807 for ( ; *cts->cts_ptr != NUL && (len == MAXCOL || cts->cts_ptr < cts->cts_line + len); | 807 for ( ; *cts->cts_ptr != NUL && (len == MAXCOL || cts->cts_ptr < cts->cts_line + len); |
808 MB_PTR_ADV(cts->cts_ptr)) | 808 MB_PTR_ADV(cts->cts_ptr)) |
809 cts->cts_vcol += win_lbr_chartabsize(cts, NULL); | 809 cts->cts_vcol += win_lbr_chartabsize(cts, NULL); |
810 #ifdef FEAT_PROP_POPUP | 810 #ifdef FEAT_PROP_POPUP |
811 // check for a virtual text on an empty line | 811 // check for a virtual text at the end of a line or on an empty line |
812 if (cts->cts_has_prop_with_text && *cts->cts_ptr == NUL | 812 if (cts->cts_has_prop_with_text && *cts->cts_ptr == NUL) |
813 && cts->cts_ptr == cts->cts_line) | |
814 { | 813 { |
815 (void)win_lbr_chartabsize(cts, NULL); | 814 (void)win_lbr_chartabsize(cts, NULL); |
816 cts->cts_vcol += cts->cts_cur_text_width; | 815 cts->cts_vcol += cts->cts_cur_text_width; |
817 | |
818 // when properties are above or below the empty line must also be | 816 // when properties are above or below the empty line must also be |
819 // counted | 817 // counted |
820 if (cts->cts_prop_lines > 0) | 818 if (cts->cts_ptr == cts->cts_line && cts->cts_prop_lines > 0) |
821 ++cts->cts_vcol; | 819 ++cts->cts_vcol; |
822 } | 820 } |
823 #endif | 821 #endif |
824 } | 822 } |
825 | 823 |
1188 && ((tp->tp_col - 1 >= col | 1186 && ((tp->tp_col - 1 >= col |
1189 && tp->tp_col - 1 < col + charlen) | 1187 && tp->tp_col - 1 < col + charlen) |
1190 || (tp->tp_col == MAXCOL | 1188 || (tp->tp_col == MAXCOL |
1191 && ((tp->tp_flags & TP_FLAG_ALIGN_ABOVE) | 1189 && ((tp->tp_flags & TP_FLAG_ALIGN_ABOVE) |
1192 ? col == 0 | 1190 ? col == 0 |
1193 : (s[0] == NUL || s[charlen] == NUL) | 1191 : s[0] == NUL |
1194 && cts->cts_with_trailing))) | 1192 && cts->cts_with_trailing))) |
1195 && -tp->tp_id - 1 < gap->ga_len) | 1193 && -tp->tp_id - 1 < gap->ga_len) |
1196 { | 1194 { |
1197 char_u *p = ((char_u **)gap->ga_data)[-tp->tp_id - 1]; | 1195 char_u *p = ((char_u **)gap->ga_data)[-tp->tp_id - 1]; |
1198 | 1196 |