Mercurial > vim
comparison src/ex_cmds.c @ 18444:967ca19425e3 v8.1.2216
patch 8.1.2216: text property in wrong place after :substitute
Commit: https://github.com/vim/vim/commit/1fd30d7bae1b3e57f008c052d765a3ec73d58114
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 25 22:13:29 2019 +0200
patch 8.1.2216: text property in wrong place after :substitute
Problem: Text property in wrong place after :substitute.
Solution: Pass the new column instead of the old one. (Christian Brabandt,
closes #4427)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 25 Oct 2019 22:15:03 +0200 |
parents | 50c0a9fb07ae |
children | b026f4524f25 |
comparison
equal
deleted
inserted
replaced
18443:21f48049529e | 18444:967ca19425e3 |
---|---|
3854 { | 3854 { |
3855 colnr_T copycol; | 3855 colnr_T copycol; |
3856 colnr_T matchcol; | 3856 colnr_T matchcol; |
3857 colnr_T prev_matchcol = MAXCOL; | 3857 colnr_T prev_matchcol = MAXCOL; |
3858 char_u *new_end, *new_start = NULL; | 3858 char_u *new_end, *new_start = NULL; |
3859 colnr_T total_added = 0; | |
3859 unsigned new_start_len = 0; | 3860 unsigned new_start_len = 0; |
3860 char_u *p1; | 3861 char_u *p1; |
3861 int did_sub = FALSE; | 3862 int did_sub = FALSE; |
3862 int lastone; | 3863 int lastone; |
3863 int len, copy_len, needed_len; | 3864 int len, copy_len, needed_len; |
4277 { | 4278 { |
4278 p1 = sub_firstline; | 4279 p1 = sub_firstline; |
4279 #ifdef FEAT_TEXT_PROP | 4280 #ifdef FEAT_TEXT_PROP |
4280 if (curbuf->b_has_textprop) | 4281 if (curbuf->b_has_textprop) |
4281 { | 4282 { |
4283 int bytes_added = sublen - 1 - (regmatch.endpos[0].col | |
4284 - regmatch.startpos[0].col); | |
4285 | |
4282 // When text properties are changed, need to save for | 4286 // When text properties are changed, need to save for |
4283 // undo first, unless done already. | 4287 // undo first, unless done already. |
4284 if (adjust_prop_columns(lnum, regmatch.startpos[0].col, | 4288 if (adjust_prop_columns(lnum, |
4285 sublen - 1 - (regmatch.endpos[0].col | 4289 total_added + regmatch.startpos[0].col, |
4286 - regmatch.startpos[0].col), | 4290 bytes_added, apc_flags)) |
4287 apc_flags)) | |
4288 apc_flags &= ~APC_SAVE_FOR_UNDO; | 4291 apc_flags &= ~APC_SAVE_FOR_UNDO; |
4292 // Offset for column byte number of the text property | |
4293 // in the resulting buffer afterwards. | |
4294 total_added += bytes_added; | |
4289 } | 4295 } |
4290 #endif | 4296 #endif |
4291 } | 4297 } |
4292 else | 4298 else |
4293 { | 4299 { |