aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/plines.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-24 07:27:18 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-28 05:51:01 +0800
commit128091a256d64db2f983d70a888b379d7e63f131 (patch)
tree02d71afdc932cb051d648f9353e480934917aa7a /src/nvim/plines.c
parentabb8c2c453d1e084f8ab3e9bbaa8b27515c81a9f (diff)
downloadrneovim-128091a256d64db2f983d70a888b379d7e63f131.tar.gz
rneovim-128091a256d64db2f983d70a888b379d7e63f131.tar.bz2
rneovim-128091a256d64db2f983d70a888b379d7e63f131.zip
fix(ui): wrong cursor position with left gravity inline virt text at eol
Diffstat (limited to 'src/nvim/plines.c')
-rw-r--r--src/nvim/plines.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/plines.c b/src/nvim/plines.c
index c95f362518..b95adc1415 100644
--- a/src/nvim/plines.c
+++ b/src/nvim/plines.c
@@ -359,7 +359,7 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp)
if (width <= 0) {
width = 1;
}
- // divide "size - prev_width" by "width", rounding up
+ // Divide "size - prev_rem" by "width", rounding up.
int cnt = (size - prev_rem + width - 1) / width;
added += cnt * head_mid;
@@ -371,7 +371,11 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp)
} else if (max_head_vcol < 0) {
int off = virt_text_cursor_off(cts, c == NUL);
if (off >= prev_rem) {
- head += (1 + (off - prev_rem) / width) * head_mid;
+ if (size > off) {
+ head += (1 + (off - prev_rem) / width) * head_mid;
+ } else {
+ head += (off - prev_rem + width - 1) / width * head_mid;
+ }
}
}
}