comparison src/change.c @ 28865:a04815de0bd3 v8.2.4955

patch 8.2.4955: text property in wrong position after auto-indent Commit: https://github.com/vim/vim/commit/788c06a2492b546dd0824b119251cd8ea7da9cb5 Author: LemonBoy <thatlemon@gmail.com> Date: Sat May 14 18:48:05 2022 +0100 patch 8.2.4955: text property in wrong position after auto-indent Problem: Text property in wrong position after auto-indent. Solution: Adjust text property columns. (closes https://github.com/vim/vim/issues/10422, closes https://github.com/vim/vim/issues/7719)
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 May 2022 20:00:05 +0200
parents 948877671c54
children aa44d5842d6c
comparison
equal deleted inserted replaced
28864:1df04dc2fa27 28865:a04815de0bd3
1370 { 1370 {
1371 char_u *saved_line; // copy of the original line 1371 char_u *saved_line; // copy of the original line
1372 char_u *next_line = NULL; // copy of the next line 1372 char_u *next_line = NULL; // copy of the next line
1373 char_u *p_extra = NULL; // what goes to next line 1373 char_u *p_extra = NULL; // what goes to next line
1374 int less_cols = 0; // less columns for mark in new line 1374 int less_cols = 0; // less columns for mark in new line
1375 int less_cols_off = 0; // columns to skip for mark adjust 1375 int less_cols_off = 0; // columns to skip for mark and
1376 // textprop adjustment
1376 pos_T old_cursor; // old cursor position 1377 pos_T old_cursor; // old cursor position
1377 int newcol = 0; // new cursor column 1378 int newcol = 0; // new cursor column
1378 int newindent = 0; // auto-indent of the new line 1379 int newindent = 0; // auto-indent of the new line
1379 int n; 1380 int n;
1380 int trunc_line = FALSE; // truncate current line afterwards 1381 int trunc_line = FALSE; // truncate current line afterwards
2149 ) 2150 )
2150 mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); 2151 mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
2151 did_append = TRUE; 2152 did_append = TRUE;
2152 #ifdef FEAT_PROP_POPUP 2153 #ifdef FEAT_PROP_POPUP
2153 if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0) 2154 if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0)
2154 // properties after the split move to the next line 2155 // Properties after the split move to the next line.
2155 adjust_props_for_split(curwin->w_cursor.lnum, curwin->w_cursor.lnum, 2156 adjust_props_for_split(curwin->w_cursor.lnum, curwin->w_cursor.lnum,
2156 curwin->w_cursor.col + 1, 0); 2157 curwin->w_cursor.col + 1, 0);
2157 #endif 2158 #endif
2158 } 2159 }
2159 else 2160 else
2160 { 2161 {
2161 // In MODE_VREPLACE state we are starting to replace the next line. 2162 // In MODE_VREPLACE state we are starting to replace the next line.
2246 // Move marks after the line break to the new line. 2247 // Move marks after the line break to the new line.
2247 if (flags & OPENLINE_MARKFIX) 2248 if (flags & OPENLINE_MARKFIX)
2248 mark_col_adjust(curwin->w_cursor.lnum, 2249 mark_col_adjust(curwin->w_cursor.lnum,
2249 curwin->w_cursor.col + less_cols_off, 2250 curwin->w_cursor.col + less_cols_off,
2250 1L, (long)-less_cols, 0); 2251 1L, (long)-less_cols, 0);
2252 #ifdef FEAT_PROP_POPUP
2253 // Keep into account the deleted blanks on the new line.
2254 if (curbuf->b_has_textprop && less_cols_off != 0)
2255 adjust_prop_columns(curwin->w_cursor.lnum + 1, 0,
2256 -less_cols_off, 0);
2257 #endif
2251 } 2258 }
2252 else 2259 else
2253 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col); 2260 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
2254 } 2261 }
2255 2262