comparison src/drawline.c @ 29740:b167c91b5f6b v9.0.0210

patch 9.0.0210: 'list' mode does not work properly with virtual text Commit: https://github.com/vim/vim/commit/c3a483fc3c65f649f9985bb88792a465ea18b0a2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 14 19:37:36 2022 +0100 patch 9.0.0210: 'list' mode does not work properly with virtual text Problem: 'list' mode does not work properly with virtual text. Solution: Show the "$" at the right position. (closes https://github.com/vim/vim/issues/10913)
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Aug 2022 20:45:03 +0200
parents 4092d04cd46f
children 3035901eceb7
comparison
equal deleted inserted replaced
29739:fee763635e6b 29740:b167c91b5f6b
1638 || (text_props[text_prop_next].tp_flags 1638 || (text_props[text_prop_next].tp_flags
1639 & TP_FLAG_ALIGN_BELOW))) 1639 & TP_FLAG_ALIGN_BELOW)))
1640 : bcol >= text_props[text_prop_next].tp_col - 1)) 1640 : bcol >= text_props[text_prop_next].tp_col - 1))
1641 { 1641 {
1642 if (text_props[text_prop_next].tp_col == MAXCOL 1642 if (text_props[text_prop_next].tp_col == MAXCOL
1643 && *ptr == NUL && wp->w_p_list && lcs_eol_one > 0)
1644 {
1645 // first display the '$' after the line
1646 text_prop_follows = TRUE;
1647 break;
1648 }
1649 if (text_props[text_prop_next].tp_col == MAXCOL
1643 || bcol <= text_props[text_prop_next].tp_col - 1 1650 || bcol <= text_props[text_prop_next].tp_col - 1
1644 + text_props[text_prop_next].tp_len) 1651 + text_props[text_prop_next].tp_len)
1645 text_prop_idxs[text_props_active++] = text_prop_next; 1652 text_prop_idxs[text_props_active++] = text_prop_next;
1646 ++text_prop_next; 1653 ++text_prop_next;
1647 } 1654 }
1753 if (added < 0 1760 if (added < 0
1754 || (below 1761 || (below
1755 ? wlv.col == 0 || !wp->w_p_wrap 1762 ? wlv.col == 0 || !wp->w_p_wrap
1756 : n_used < wlv.n_extra)) 1763 : n_used < wlv.n_extra))
1757 added = 0; 1764 added = 0;
1765
1766 // With 'nowrap' add one to show the
1767 // "extends" character if needed (it
1768 // doesn't show it the text just fits).
1769 if (!wp->w_p_wrap
1770 && n_used < wlv.n_extra
1771 && wp->w_lcs_chars.ext != NUL
1772 && wp->w_p_list)
1773 ++n_used;
1774
1758 // add 1 for NUL, 2 for when '…' is used 1775 // add 1 for NUL, 2 for when '…' is used
1759 l = alloc(n_used + added + 3); 1776 l = alloc(n_used + added + 3);
1760 if (l != NULL) 1777 if (l != NULL)
1761 { 1778 {
1762 vim_memset(l, ' ', added); 1779 vim_memset(l, ' ', added);
2726 ) 2743 )
2727 #endif 2744 #endif
2728 { 2745 {
2729 // In virtualedit, visual selections may extend 2746 // In virtualedit, visual selections may extend
2730 // beyond end of line. 2747 // beyond end of line.
2731 if (area_highlighting && virtual_active() 2748 if (!(area_highlighting && virtual_active()
2732 && tocol != MAXCOL && wlv.vcol < tocol) 2749 && tocol != MAXCOL && wlv.vcol < tocol))
2733 wlv.n_extra = 0;
2734 else
2735 {
2736 wlv.p_extra = at_end_str; 2750 wlv.p_extra = at_end_str;
2737 wlv.n_extra = 1; 2751 wlv.n_extra = 0;
2738 wlv.c_extra = NUL;
2739 wlv.c_final = NUL;
2740 }
2741 } 2752 }
2742 if (wp->w_p_list && wp->w_lcs_chars.eol > 0) 2753 if (wp->w_p_list && wp->w_lcs_chars.eol > 0)
2743 c = wp->w_lcs_chars.eol; 2754 c = wp->w_lcs_chars.eol;
2744 else 2755 else
2745 c = ' '; 2756 c = ' ';
3216 #ifdef FEAT_RIGHTLEFT 3227 #ifdef FEAT_RIGHTLEFT
3217 wp->w_p_rl ? wlv.col == 0 : 3228 wp->w_p_rl ? wlv.col == 0 :
3218 #endif 3229 #endif
3219 wlv.col == wp->w_width - 1) 3230 wlv.col == wp->w_width - 1)
3220 && (*ptr != NUL 3231 && (*ptr != NUL
3221 || (wp->w_p_list && lcs_eol_one > 0) 3232 || lcs_eol_one > 0
3222 || (wlv.n_extra && (wlv.c_extra != NUL 3233 || (wlv.n_extra > 0 && (wlv.c_extra != NUL
3223 || *wlv.p_extra != NUL)))) 3234 || *wlv.p_extra != NUL))))
3224 { 3235 {
3225 c = wp->w_lcs_chars.ext; 3236 c = wp->w_lcs_chars.ext;
3226 wlv.char_attr = hl_combine_attr(wlv.win_attr, HL_ATTR(HLF_AT)); 3237 wlv.char_attr = hl_combine_attr(wlv.win_attr, HL_ATTR(HLF_AT));
3227 mb_c = c; 3238 mb_c = c;