Mercurial > vim
diff src/drawline.c @ 30231:0d084880276a v9.0.0451
patch 9.0.0451: virtual text "above" does not work with 'nowrap'
Commit: https://github.com/vim/vim/commit/c9dc03fff5acf6fb91a923fb95006f9c2bca6141
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 12 17:51:07 2022 +0100
patch 9.0.0451: virtual text "above" does not work with 'nowrap'
Problem: Virtual text "above" does not work with 'nowrap'.
Solution: Do wrap the line after. (closes https://github.com/vim/vim/issues/11084)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 12 Sep 2022 19:00:05 +0200 |
parents | 4fedacdad3b4 |
children | 8d660a45299f |
line wrap: on
line diff
--- a/src/drawline.c +++ b/src/drawline.c @@ -666,6 +666,7 @@ win_line( // syntax_attr int text_prop_id = 0; // active property ID int text_prop_flags = 0; + int text_prop_above = FALSE; // first doing virtual text above int text_prop_follows = FALSE; // another text prop to display int saved_search_attr = 0; // search_attr to be used when n_extra // goes to zero @@ -1784,6 +1785,7 @@ win_line( // Sort the properties on priority and/or starting last. // Then combine the attributes, highest priority last. + text_prop_above = FALSE; text_prop_follows = FALSE; sort_text_props(wp->w_buffer, text_props, text_prop_idxs, text_props_active); @@ -1817,6 +1819,8 @@ win_line( char_u *p = ((char_u **)wp->w_buffer ->b_textprop_text.ga_data)[ -text_prop_id - 1]; + int above = (tp->tp_flags + & TP_FLAG_ALIGN_ABOVE); // reset the ID in the copy to avoid it being used // again @@ -1826,8 +1830,6 @@ win_line( { int right = (tp->tp_flags & TP_FLAG_ALIGN_RIGHT); - int above = (tp->tp_flags - & TP_FLAG_ALIGN_ABOVE); int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW); int wrap = (tp->tp_flags & TP_FLAG_WRAP); @@ -1902,6 +1904,9 @@ win_line( // If another text prop follows the condition below at // the last window column must know. + // If this is an "above" text prop and 'nowrap' the we + // must wrap anyway. + text_prop_above = above; text_prop_follows = other_tpi != -1; } } @@ -3581,7 +3586,7 @@ win_line( || filler_todo > 0 #endif #ifdef FEAT_PROP_POPUP - || text_prop_follows + || text_prop_above || text_prop_follows #endif || (wp->w_p_list && wp->w_lcs_chars.eol != NUL && wlv.p_extra != at_end_str) @@ -3608,12 +3613,12 @@ win_line( && filler_todo <= 0 #endif #ifdef FEAT_PROP_POPUP - && !text_prop_follows + && !text_prop_above && !text_prop_follows #endif ) || lcs_eol_one == -1) break; #ifdef FEAT_PROP_POPUP - if (!wp->w_p_wrap && text_prop_follows) + if (!wp->w_p_wrap && text_prop_follows && !text_prop_above) { // do not output more of the line, only the "below" prop ptr += STRLEN(ptr); @@ -3647,7 +3652,7 @@ win_line( && filler_todo <= 0 #endif #ifdef FEAT_PROP_POPUP - && !text_prop_follows + && !text_prop_above && !text_prop_follows #endif && wp->w_width == Columns) {