comparison src/ops.c @ 16682:7847d281cbbf v8.1.1343

patch 8.1.1343: text properties not adjusted for Visual block mode delete commit https://github.com/vim/vim/commit/8055d17388736421d875dd4933c4c93d49a2ab58 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 17 22:57:26 2019 +0200 patch 8.1.1343: text properties not adjusted for Visual block mode delete Problem: Text properties not adjusted for Visual block mode delete. Solution: Call adjust_prop_columns(). (closes https://github.com/vim/vim/issues/4384)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 May 2019 23:00:05 +0200
parents c263acbbd961
children 23af483c4ceb
comparison
equal deleted inserted replaced
16681:12218ecea336 16682:7847d281cbbf
1914 { 1914 {
1915 curwin->w_cursor.col = bd.textcol + bd.startspaces; 1915 curwin->w_cursor.col = bd.textcol + bd.startspaces;
1916 curwin->w_cursor.coladd = 0; 1916 curwin->w_cursor.coladd = 0;
1917 } 1917 }
1918 1918
1919 /* n == number of chars deleted 1919 // "n" == number of chars deleted
1920 * If we delete a TAB, it may be replaced by several characters. 1920 // If we delete a TAB, it may be replaced by several characters.
1921 * Thus the number of characters may increase! 1921 // Thus the number of characters may increase!
1922 */
1923 n = bd.textlen - bd.startspaces - bd.endspaces; 1922 n = bd.textlen - bd.startspaces - bd.endspaces;
1924 oldp = ml_get(lnum); 1923 oldp = ml_get(lnum);
1925 newp = alloc_check((unsigned)STRLEN(oldp) + 1 - n); 1924 newp = alloc_check((unsigned)STRLEN(oldp) + 1 - n);
1926 if (newp == NULL) 1925 if (newp == NULL)
1927 continue; 1926 continue;
1933 /* copy the part after the deleted part */ 1932 /* copy the part after the deleted part */
1934 oldp += bd.textcol + bd.textlen; 1933 oldp += bd.textcol + bd.textlen;
1935 STRMOVE(newp + bd.textcol + bd.startspaces + bd.endspaces, oldp); 1934 STRMOVE(newp + bd.textcol + bd.startspaces + bd.endspaces, oldp);
1936 /* replace the line */ 1935 /* replace the line */
1937 ml_replace(lnum, newp, FALSE); 1936 ml_replace(lnum, newp, FALSE);
1937
1938 #ifdef FEAT_TEXT_PROP
1939 if (curbuf->b_has_textprop && n != 0)
1940 adjust_prop_columns(lnum, bd.textcol, -n);
1941 #endif
1938 } 1942 }
1939 1943
1940 check_cursor_col(); 1944 check_cursor_col();
1941 changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col, 1945 changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col,
1942 oap->end.lnum + 1, 0L); 1946 oap->end.lnum + 1, 0L);