aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-28 07:47:22 +0800
committerGitHub <noreply@github.com>2023-12-28 07:47:22 +0800
commitd82e105727475aa18720bd0b12103c23600e7ca0 (patch)
treea993ebb7b9bbc678ad57ecb51ed30e087103e3f9 /src
parent7f9fc2fbf03e18c1e4033763be4905707d7a84e7 (diff)
downloadrneovim-d82e105727475aa18720bd0b12103c23600e7ca0.tar.gz
rneovim-d82e105727475aa18720bd0b12103c23600e7ca0.tar.bz2
rneovim-d82e105727475aa18720bd0b12103c23600e7ca0.zip
vim-patch:9.0.2187: Visual not drawn with 'breakindent' when line doesn't fit (#26765)
Problem: Visual selection isn't drawn with 'breakindent' when the line doesn't fit in the window (Jaehwang Jung) Solution: Adjust wlv->fromcol also for 'breakindent' (zeertzjq) closes: vim/vim#13767 closes: vim/vim#13768 https://github.com/vim/vim/commit/23627722d36b49e38ba6f8dc6bb3ebe19c98a83b
Diffstat (limited to 'src')
-rw-r--r--src/nvim/drawline.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 24714e2d6e..6b4ef2d3d9 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -691,11 +691,7 @@ static void handle_breakindent(win_T *wp, winlinevars_T *wlv)
}
}
- // Correct end of highlighted area for 'breakindent',
- // required wen 'linebreak' is also set.
- if (wlv->tocol == wlv->vcol) {
- wlv->tocol += num;
- }
+ colnr_T vcol_before = wlv->vcol;
for (int i = 0; i < num; i++) {
linebuf_char[wlv->off] = schar_from_ascii(' ');
@@ -710,6 +706,17 @@ static void handle_breakindent(win_T *wp, winlinevars_T *wlv)
wlv->off++;
}
+ // Correct start of highlighted area for 'breakindent',
+ if (wlv->fromcol >= vcol_before && wlv->fromcol < wlv->vcol) {
+ wlv->fromcol = wlv->vcol;
+ }
+
+ // Correct end of highlighted area for 'breakindent',
+ // required wen 'linebreak' is also set.
+ if (wlv->tocol == vcol_before) {
+ wlv->tocol = wlv->vcol;
+ }
+
if (wp->w_skipcol > 0 && wlv->startrow == 0 && wp->w_p_wrap && wp->w_briopt_sbr) {
wlv->need_showbreak = false;
}
@@ -737,13 +744,13 @@ static void handle_showbreak_and_filler(win_T *wp, winlinevars_T *wlv)
}
// Combine 'showbreak' with 'cursorline', prioritizing 'showbreak'.
int attr = hl_combine_attr(wlv->cul_attr, win_hl_attr(wp, HLF_AT));
- int vcol_before = wlv->vcol;
+ colnr_T vcol_before = wlv->vcol;
draw_col_buf(wp, wlv, sbr, strlen(sbr), attr, true);
wlv->vcol_sbr = wlv->vcol;
// Correct start of highlighted area for 'showbreak'.
- if (wlv->fromcol >= vcol_before && wlv->fromcol < wlv->vcol_sbr) {
- wlv->fromcol = wlv->vcol_sbr;
+ if (wlv->fromcol >= vcol_before && wlv->fromcol < wlv->vcol) {
+ wlv->fromcol = wlv->vcol;
}
// Correct end of highlighted area for 'showbreak',