vim-patch:9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown (#27651)

Problem:  The cursor screen row was incorrectly being calculated when the
          cursor follows a 1 character text_align 'below' virtual text line,
          resulting in the cursor being shown on the wrong line.
          This was caused by a cell size of 2 instead of 1 being used for the EOL
          character, which propagated to the calculation of space for putting the
          'below' virtual text on its own line. (rickhowe)
Solution: Fix the size used for the EOL character in calculating the
          cursor's screen position (Dylan Thacker-Smith)

fixes: vim/vim#11959
related: vim/vim#12028
closes: vim/vim#14096

da0c9137d1

Co-authored-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
This commit is contained in:
zeertzjq 2024-02-28 07:28:48 +08:00 committed by GitHub
parent 63f9c2da9a
commit 7e46ff791c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -136,8 +136,10 @@ CharSize charsize_regular(CharsizeArg *csarg, char *const cur, colnr_T const vco
int is_doublewidth = false;
if (use_tabstop) {
size = tabstop_padding(vcol, buf->b_p_ts, buf->b_p_vts_array);
} else if (*cur == NUL && !has_lcs_eol) {
size = 0;
} else if (*cur == NUL) {
// 1 cell for EOL list char (if present), as opposed to the two cell ^@
// for a NUL character in the text.
size = has_lcs_eol ? 1 : 0;
} else if (cur_char < 0) {
size = kInvalidByteCells;
} else {