comparison src/message.c @ 15502:bc17a9d37810 v8.1.0759

patch 8.1.0759: showing two characters for tab is limited commit https://github.com/vim/vim/commit/83a52171ba00b2b9fd2d1d22a07e38fc9fc69c1e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 16 22:41:54 2019 +0100 patch 8.1.0759: showing two characters for tab is limited Problem: Showing two characters for tab is limited. Solution: Allow for a third character for "tab:" in 'listchars'. (Nathaniel Braun, Ken Takata, closes #3810)
author Bram Moolenaar <Bram@vim.org>
date Wed, 16 Jan 2019 22:45:07 +0100
parents 55ccc2d353bd
children dd725a8ab112
comparison
equal deleted inserted replaced
15501:f1ba08812cf2 15502:bc17a9d37810
1769 { 1769 {
1770 int c; 1770 int c;
1771 int col = 0; 1771 int col = 0;
1772 int n_extra = 0; 1772 int n_extra = 0;
1773 int c_extra = 0; 1773 int c_extra = 0;
1774 int c_final = 0;
1774 char_u *p_extra = NULL; /* init to make SASC shut up */ 1775 char_u *p_extra = NULL; /* init to make SASC shut up */
1775 int n; 1776 int n;
1776 int attr = 0; 1777 int attr = 0;
1777 char_u *trail = NULL; 1778 char_u *trail = NULL;
1778 #ifdef FEAT_MBYTE 1779 #ifdef FEAT_MBYTE
1799 while (!got_int) 1800 while (!got_int)
1800 { 1801 {
1801 if (n_extra > 0) 1802 if (n_extra > 0)
1802 { 1803 {
1803 --n_extra; 1804 --n_extra;
1804 if (c_extra) 1805 if (n_extra == 0 && c_final)
1806 c = c_final;
1807 else if (c_extra)
1805 c = c_extra; 1808 c = c_extra;
1806 else 1809 else
1807 c = *p_extra++; 1810 c = *p_extra++;
1808 } 1811 }
1809 #ifdef FEAT_MBYTE 1812 #ifdef FEAT_MBYTE
1842 #endif 1845 #endif
1843 if (!list) 1846 if (!list)
1844 { 1847 {
1845 c = ' '; 1848 c = ' ';
1846 c_extra = ' '; 1849 c_extra = ' ';
1850 c_final = NUL;
1847 } 1851 }
1848 else 1852 else
1849 { 1853 {
1850 c = lcs_tab1; 1854 c = (n_extra == 0 && lcs_tab3) ? lcs_tab3 : lcs_tab1;
1851 c_extra = lcs_tab2; 1855 c_extra = lcs_tab2;
1856 c_final = lcs_tab3;
1852 attr = HL_ATTR(HLF_8); 1857 attr = HL_ATTR(HLF_8);
1853 } 1858 }
1854 } 1859 }
1855 else if (c == 160 && list && lcs_nbsp != NUL) 1860 else if (c == 160 && list && lcs_nbsp != NUL)
1856 { 1861 {
1859 } 1864 }
1860 else if (c == NUL && list && lcs_eol != NUL) 1865 else if (c == NUL && list && lcs_eol != NUL)
1861 { 1866 {
1862 p_extra = (char_u *)""; 1867 p_extra = (char_u *)"";
1863 c_extra = NUL; 1868 c_extra = NUL;
1869 c_final = NUL;
1864 n_extra = 1; 1870 n_extra = 1;
1865 c = lcs_eol; 1871 c = lcs_eol;
1866 attr = HL_ATTR(HLF_AT); 1872 attr = HL_ATTR(HLF_AT);
1867 --s; 1873 --s;
1868 } 1874 }
1869 else if (c != NUL && (n = byte2cells(c)) > 1) 1875 else if (c != NUL && (n = byte2cells(c)) > 1)
1870 { 1876 {
1871 n_extra = n - 1; 1877 n_extra = n - 1;
1872 p_extra = transchar_byte(c); 1878 p_extra = transchar_byte(c);
1873 c_extra = NUL; 1879 c_extra = NUL;
1880 c_final = NUL;
1874 c = *p_extra++; 1881 c = *p_extra++;
1875 /* Use special coloring to be able to distinguish <hex> from 1882 /* Use special coloring to be able to distinguish <hex> from
1876 * the same in plain text. */ 1883 * the same in plain text. */
1877 attr = HL_ATTR(HLF_8); 1884 attr = HL_ATTR(HLF_8);
1878 } 1885 }