Mercurial > vim
comparison src/edit.c @ 19097:bcbc9fe665b5 v8.2.0109
patch 8.2.0109: corrupted text properties when expanding spaces
Commit: https://github.com/vim/vim/commit/ac15fd8c6761763c8feedef1a2fbd8309f0a823c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 9 21:35:48 2020 +0100
patch 8.2.0109: corrupted text properties when expanding spaces
Problem: Corrupted text properties when expanding spaces.
Solution: Reallocate the line. (Nobuhiro Takasaki, closes https://github.com/vim/vim/issues/5457)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 09 Jan 2020 21:45:03 +0100 |
parents | 143d44d8f477 |
children | 06ef1e438ac8 |
comparison
equal
deleted
inserted
replaced
19096:af8bd2f486b6 | 19097:bcbc9fe665b5 |
---|---|
5602 if (i > 0) | 5602 if (i > 0) |
5603 { | 5603 { |
5604 #ifdef FEAT_PROP_POPUP | 5604 #ifdef FEAT_PROP_POPUP |
5605 if (!(State & VREPLACE_FLAG)) | 5605 if (!(State & VREPLACE_FLAG)) |
5606 { | 5606 { |
5607 mch_memmove(ptr, ptr + i, curbuf->b_ml.ml_line_len - i | 5607 char_u *newp; |
5608 - (ptr - curbuf->b_ml.ml_line_ptr)); | 5608 int col; |
5609 | |
5610 newp = alloc(curbuf->b_ml.ml_line_len - i); | |
5611 if (newp == NULL) | |
5612 return FALSE; | |
5613 | |
5614 col = ptr - curbuf->b_ml.ml_line_ptr; | |
5615 if (col > 0) | |
5616 mch_memmove(newp, ptr - col, col); | |
5617 mch_memmove(newp + col, ptr + i, | |
5618 curbuf->b_ml.ml_line_len - col - i); | |
5619 | |
5620 if (curbuf->b_ml.ml_flags & ML_LINE_DIRTY) | |
5621 vim_free(curbuf->b_ml.ml_line_ptr); | |
5622 curbuf->b_ml.ml_line_ptr = newp; | |
5609 curbuf->b_ml.ml_line_len -= i; | 5623 curbuf->b_ml.ml_line_len -= i; |
5624 curbuf->b_ml.ml_flags = | |
5625 (curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY; | |
5610 } | 5626 } |
5611 else | 5627 else |
5612 #endif | 5628 #endif |
5613 STRMOVE(ptr, ptr + i); | 5629 STRMOVE(ptr, ptr + i); |
5614 // correct replace stack. | 5630 // correct replace stack. |