Mercurial > vim
comparison src/register.c @ 29451:057c26b5c33a v9.0.0067
patch 9.0.0067: cannot show virtual text
Commit: https://github.com/vim/vim/commit/7f9969c559b51446632ac7e8f76cde07e7d0078d
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 25 18:13:54 2022 +0100
patch 9.0.0067: cannot show virtual text
Problem: Cannot show virtual text.
Solution: Initial changes for virtual text support, using text properties.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 25 Jul 2022 19:15:06 +0200 |
parents | 575bc8eaa593 |
children | 1c688281673d |
comparison
equal
deleted
inserted
replaced
29450:67f31c24291b | 29451:057c26b5c33a |
---|---|
1818 } | 1818 } |
1819 curwin->w_cursor.coladd = 0; | 1819 curwin->w_cursor.coladd = 0; |
1820 bd.textcol = 0; | 1820 bd.textcol = 0; |
1821 for (i = 0; i < y_size; ++i) | 1821 for (i = 0; i < y_size; ++i) |
1822 { | 1822 { |
1823 int spaces = 0; | 1823 int spaces = 0; |
1824 char shortline; | 1824 char shortline; |
1825 chartabsize_T cts; | |
1825 | 1826 |
1826 bd.startspaces = 0; | 1827 bd.startspaces = 0; |
1827 bd.endspaces = 0; | 1828 bd.endspaces = 0; |
1828 vcol = 0; | 1829 vcol = 0; |
1829 delcount = 0; | 1830 delcount = 0; |
1837 ++nr_lines; | 1838 ++nr_lines; |
1838 } | 1839 } |
1839 // get the old line and advance to the position to insert at | 1840 // get the old line and advance to the position to insert at |
1840 oldp = ml_get_curline(); | 1841 oldp = ml_get_curline(); |
1841 oldlen = (int)STRLEN(oldp); | 1842 oldlen = (int)STRLEN(oldp); |
1842 for (ptr = oldp; vcol < col && *ptr; ) | 1843 init_chartabsize_arg(&cts, curwin, curwin->w_cursor.lnum, 0, |
1844 oldp, oldp); | |
1845 | |
1846 while (cts.cts_vcol < col && *cts.cts_ptr != NUL) | |
1843 { | 1847 { |
1844 // Count a tab for what it's worth (if list mode not on) | 1848 // Count a tab for what it's worth (if list mode not on) |
1845 incr = lbr_chartabsize_adv(oldp, &ptr, vcol); | 1849 incr = lbr_chartabsize_adv(&cts); |
1846 vcol += incr; | 1850 cts.cts_vcol += incr; |
1847 } | 1851 } |
1852 vcol = cts.cts_vcol; | |
1853 ptr = cts.cts_ptr; | |
1848 bd.textcol = (colnr_T)(ptr - oldp); | 1854 bd.textcol = (colnr_T)(ptr - oldp); |
1855 clear_chartabsize_arg(&cts); | |
1849 | 1856 |
1850 shortline = (vcol < col) || (vcol == col && !*ptr) ; | 1857 shortline = (vcol < col) || (vcol == col && !*ptr) ; |
1851 | 1858 |
1852 if (vcol < col) // line too short, padd with spaces | 1859 if (vcol < col) // line too short, padd with spaces |
1853 bd.startspaces = col - vcol; | 1860 bd.startspaces = col - vcol; |
1874 if ((flags & PUT_BLOCK_INNER) == 0) | 1881 if ((flags & PUT_BLOCK_INNER) == 0) |
1875 { | 1882 { |
1876 // calculate number of spaces required to fill right side of | 1883 // calculate number of spaces required to fill right side of |
1877 // block | 1884 // block |
1878 spaces = y_width + 1; | 1885 spaces = y_width + 1; |
1886 init_chartabsize_arg(&cts, curwin, 0, 0, | |
1887 y_array[i], y_array[i]); | |
1879 for (j = 0; j < yanklen; j++) | 1888 for (j = 0; j < yanklen; j++) |
1880 spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0); | 1889 { |
1890 spaces -= lbr_chartabsize(&cts); | |
1891 ++cts.cts_ptr; | |
1892 cts.cts_vcol = 0; | |
1893 } | |
1894 clear_chartabsize_arg(&cts); | |
1881 if (spaces < 0) | 1895 if (spaces < 0) |
1882 spaces = 0; | 1896 spaces = 0; |
1883 } | 1897 } |
1884 | 1898 |
1885 // Insert the new text. | 1899 // Insert the new text. |