Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
30230:aad84f731ef9 | 30231:0d084880276a |
---|---|
664 int text_prop_attr = 0; | 664 int text_prop_attr = 0; |
665 int text_prop_attr_comb = 0; // text_prop_attr combined with | 665 int text_prop_attr_comb = 0; // text_prop_attr combined with |
666 // syntax_attr | 666 // syntax_attr |
667 int text_prop_id = 0; // active property ID | 667 int text_prop_id = 0; // active property ID |
668 int text_prop_flags = 0; | 668 int text_prop_flags = 0; |
669 int text_prop_above = FALSE; // first doing virtual text above | |
669 int text_prop_follows = FALSE; // another text prop to display | 670 int text_prop_follows = FALSE; // another text prop to display |
670 int saved_search_attr = 0; // search_attr to be used when n_extra | 671 int saved_search_attr = 0; // search_attr to be used when n_extra |
671 // goes to zero | 672 // goes to zero |
672 #endif | 673 #endif |
673 #ifdef FEAT_SPELL | 674 #ifdef FEAT_SPELL |
1782 int used_attr = 0; | 1783 int used_attr = 0; |
1783 int other_tpi = -1; | 1784 int other_tpi = -1; |
1784 | 1785 |
1785 // Sort the properties on priority and/or starting last. | 1786 // Sort the properties on priority and/or starting last. |
1786 // Then combine the attributes, highest priority last. | 1787 // Then combine the attributes, highest priority last. |
1788 text_prop_above = FALSE; | |
1787 text_prop_follows = FALSE; | 1789 text_prop_follows = FALSE; |
1788 sort_text_props(wp->w_buffer, text_props, | 1790 sort_text_props(wp->w_buffer, text_props, |
1789 text_prop_idxs, text_props_active); | 1791 text_prop_idxs, text_props_active); |
1790 | 1792 |
1791 for (pi = 0; pi < text_props_active; ++pi) | 1793 for (pi = 0; pi < text_props_active; ++pi) |
1815 { | 1817 { |
1816 textprop_T *tp = &text_props[used_tpi]; | 1818 textprop_T *tp = &text_props[used_tpi]; |
1817 char_u *p = ((char_u **)wp->w_buffer | 1819 char_u *p = ((char_u **)wp->w_buffer |
1818 ->b_textprop_text.ga_data)[ | 1820 ->b_textprop_text.ga_data)[ |
1819 -text_prop_id - 1]; | 1821 -text_prop_id - 1]; |
1822 int above = (tp->tp_flags | |
1823 & TP_FLAG_ALIGN_ABOVE); | |
1820 | 1824 |
1821 // reset the ID in the copy to avoid it being used | 1825 // reset the ID in the copy to avoid it being used |
1822 // again | 1826 // again |
1823 tp->tp_id = -MAXCOL; | 1827 tp->tp_id = -MAXCOL; |
1824 | 1828 |
1825 if (p != NULL) | 1829 if (p != NULL) |
1826 { | 1830 { |
1827 int right = (tp->tp_flags | 1831 int right = (tp->tp_flags |
1828 & TP_FLAG_ALIGN_RIGHT); | 1832 & TP_FLAG_ALIGN_RIGHT); |
1829 int above = (tp->tp_flags | |
1830 & TP_FLAG_ALIGN_ABOVE); | |
1831 int below = (tp->tp_flags | 1833 int below = (tp->tp_flags |
1832 & TP_FLAG_ALIGN_BELOW); | 1834 & TP_FLAG_ALIGN_BELOW); |
1833 int wrap = (tp->tp_flags & TP_FLAG_WRAP); | 1835 int wrap = (tp->tp_flags & TP_FLAG_WRAP); |
1834 int padding = tp->tp_col == MAXCOL | 1836 int padding = tp->tp_col == MAXCOL |
1835 && tp->tp_len > 1 | 1837 && tp->tp_len > 1 |
1900 } | 1902 } |
1901 } | 1903 } |
1902 | 1904 |
1903 // If another text prop follows the condition below at | 1905 // If another text prop follows the condition below at |
1904 // the last window column must know. | 1906 // the last window column must know. |
1907 // If this is an "above" text prop and 'nowrap' the we | |
1908 // must wrap anyway. | |
1909 text_prop_above = above; | |
1905 text_prop_follows = other_tpi != -1; | 1910 text_prop_follows = other_tpi != -1; |
1906 } | 1911 } |
1907 } | 1912 } |
1908 else if (text_prop_next < text_prop_count | 1913 else if (text_prop_next < text_prop_count |
1909 && text_props[text_prop_next].tp_col == MAXCOL | 1914 && text_props[text_prop_next].tp_col == MAXCOL |
3579 || *ptr != NUL | 3584 || *ptr != NUL |
3580 #ifdef FEAT_DIFF | 3585 #ifdef FEAT_DIFF |
3581 || filler_todo > 0 | 3586 || filler_todo > 0 |
3582 #endif | 3587 #endif |
3583 #ifdef FEAT_PROP_POPUP | 3588 #ifdef FEAT_PROP_POPUP |
3584 || text_prop_follows | 3589 || text_prop_above || text_prop_follows |
3585 #endif | 3590 #endif |
3586 || (wp->w_p_list && wp->w_lcs_chars.eol != NUL | 3591 || (wp->w_p_list && wp->w_lcs_chars.eol != NUL |
3587 && wlv.p_extra != at_end_str) | 3592 && wlv.p_extra != at_end_str) |
3588 || (wlv.n_extra != 0 && (wlv.c_extra != NUL | 3593 || (wlv.n_extra != 0 && (wlv.c_extra != NUL |
3589 || *wlv.p_extra != NUL))) | 3594 || *wlv.p_extra != NUL))) |
3606 if ((!wp->w_p_wrap | 3611 if ((!wp->w_p_wrap |
3607 #ifdef FEAT_DIFF | 3612 #ifdef FEAT_DIFF |
3608 && filler_todo <= 0 | 3613 && filler_todo <= 0 |
3609 #endif | 3614 #endif |
3610 #ifdef FEAT_PROP_POPUP | 3615 #ifdef FEAT_PROP_POPUP |
3611 && !text_prop_follows | 3616 && !text_prop_above && !text_prop_follows |
3612 #endif | 3617 #endif |
3613 ) || lcs_eol_one == -1) | 3618 ) || lcs_eol_one == -1) |
3614 break; | 3619 break; |
3615 #ifdef FEAT_PROP_POPUP | 3620 #ifdef FEAT_PROP_POPUP |
3616 if (!wp->w_p_wrap && text_prop_follows) | 3621 if (!wp->w_p_wrap && text_prop_follows && !text_prop_above) |
3617 { | 3622 { |
3618 // do not output more of the line, only the "below" prop | 3623 // do not output more of the line, only the "below" prop |
3619 ptr += STRLEN(ptr); | 3624 ptr += STRLEN(ptr); |
3620 # ifdef FEAT_LINEBREAK | 3625 # ifdef FEAT_LINEBREAK |
3621 dont_use_showbreak = TRUE; | 3626 dont_use_showbreak = TRUE; |
3645 if (screen_cur_row == wlv.screen_row - 1 | 3650 if (screen_cur_row == wlv.screen_row - 1 |
3646 #ifdef FEAT_DIFF | 3651 #ifdef FEAT_DIFF |
3647 && filler_todo <= 0 | 3652 && filler_todo <= 0 |
3648 #endif | 3653 #endif |
3649 #ifdef FEAT_PROP_POPUP | 3654 #ifdef FEAT_PROP_POPUP |
3650 && !text_prop_follows | 3655 && !text_prop_above && !text_prop_follows |
3651 #endif | 3656 #endif |
3652 && wp->w_width == Columns) | 3657 && wp->w_width == Columns) |
3653 { | 3658 { |
3654 // Remember that the line wraps, used for modeless copy. | 3659 // Remember that the line wraps, used for modeless copy. |
3655 LineWraps[wlv.screen_row - 1] = TRUE; | 3660 LineWraps[wlv.screen_row - 1] = TRUE; |