diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-08 23:07:24 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-08 23:07:24 +0100 |
commit | 663bc89bbb8158bd0888f7d7228b2dbc6bbd4802 (patch) | |
tree | 9294a8f3419b280c596e21af2b1284ae23bc9a58 /src/misc1.c | |
parent | e12bab3144af8943937bd0ff4bc57f04e53037b3 (diff) | |
download | vim-git-663bc89bbb8158bd0888f7d7228b2dbc6bbd4802.tar.gz |
patch 8.1.0707: text property columns are not adjusted for changed indentv8.1.0707
Problem: Text property columns are not adjusted for changed indent.
Solution: Adjust text properties.
Diffstat (limited to 'src/misc1.c')
-rw-r--r-- | src/misc1.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/misc1.c b/src/misc1.c index c2d2d19d2..f8b726a93 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -411,24 +411,29 @@ set_indent( } mch_memmove(s, p, (size_t)line_len); - /* Replace the line (unless undo fails). */ + // Replace the line (unless undo fails). if (!(flags & SIN_UNDO) || u_savesub(curwin->w_cursor.lnum) == OK) { ml_replace(curwin->w_cursor.lnum, newline, FALSE); if (flags & SIN_CHANGED) changed_bytes(curwin->w_cursor.lnum, 0); - /* Correct saved cursor position if it is in this line. */ + + // Correct saved cursor position if it is in this line. if (saved_cursor.lnum == curwin->w_cursor.lnum) { if (saved_cursor.col >= (colnr_T)(p - oldline)) - /* cursor was after the indent, adjust for the number of - * bytes added/removed */ + // cursor was after the indent, adjust for the number of + // bytes added/removed saved_cursor.col += ind_len - (colnr_T)(p - oldline); else if (saved_cursor.col >= (colnr_T)(s - newline)) - /* cursor was in the indent, and is now after it, put it back - * at the start of the indent (replacing spaces with TAB) */ + // cursor was in the indent, and is now after it, put it back + // at the start of the indent (replacing spaces with TAB) saved_cursor.col = (colnr_T)(s - newline); } +#ifdef FEAT_TEXT_PROP + adjust_prop_columns(curwin->w_cursor.lnum, (colnr_T)(p - oldline), + ind_len - (colnr_T)(p - oldline)); +#endif retval = TRUE; } else |