Mercurial > vim
comparison src/ops.c @ 22282:5adb97bf0b32 v8.2.1690
patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Commit: https://github.com/vim/vim/commit/8b51b7f0f17af149a8ce76e805050977857f9e50
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 15 21:34:18 2020 +0200
patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Problem: Text properties not adjusted for "I" in Visual block mode.
Solution: Call inserted_bytes().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 15 Sep 2020 21:45:04 +0200 |
parents | 0416105e103b |
children | 9debc021e99e |
comparison
equal
deleted
inserted
replaced
22281:7509c66a371a | 22282:5adb97bf0b32 |
---|---|
479 { | 479 { |
480 int ts_val; | 480 int ts_val; |
481 int count = 0; // extra spaces to replace a cut TAB | 481 int count = 0; // extra spaces to replace a cut TAB |
482 int spaces = 0; // non-zero if cutting a TAB | 482 int spaces = 0; // non-zero if cutting a TAB |
483 colnr_T offset; // pointer along new line | 483 colnr_T offset; // pointer along new line |
484 colnr_T startcol; // column where insert starts | |
484 unsigned s_len; // STRLEN(s) | 485 unsigned s_len; // STRLEN(s) |
485 char_u *newp, *oldp; // new, old lines | 486 char_u *newp, *oldp; // new, old lines |
486 linenr_T lnum; // loop var | 487 linenr_T lnum; // loop var |
487 int oldstate = State; | 488 int oldstate = State; |
488 | 489 |
551 mch_memmove(newp, oldp, (size_t)(offset)); | 552 mch_memmove(newp, oldp, (size_t)(offset)); |
552 oldp += offset; | 553 oldp += offset; |
553 | 554 |
554 // insert pre-padding | 555 // insert pre-padding |
555 vim_memset(newp + offset, ' ', (size_t)spaces); | 556 vim_memset(newp + offset, ' ', (size_t)spaces); |
557 startcol = offset + spaces; | |
556 | 558 |
557 // copy the new text | 559 // copy the new text |
558 mch_memmove(newp + offset + spaces, s, (size_t)s_len); | 560 mch_memmove(newp + startcol, s, (size_t)s_len); |
559 offset += s_len; | 561 offset += s_len; |
560 | 562 |
561 if (spaces && !bdp->is_short) | 563 if (spaces && !bdp->is_short) |
562 { | 564 { |
563 // insert post-padding | 565 // insert post-padding |
571 if (spaces > 0) | 573 if (spaces > 0) |
572 offset += count; | 574 offset += count; |
573 STRMOVE(newp + offset, oldp); | 575 STRMOVE(newp + offset, oldp); |
574 | 576 |
575 ml_replace(lnum, newp, FALSE); | 577 ml_replace(lnum, newp, FALSE); |
578 | |
579 if (b_insert) | |
580 // correct any text properties | |
581 inserted_bytes(lnum, startcol, s_len); | |
576 | 582 |
577 if (lnum == oap->end.lnum) | 583 if (lnum == oap->end.lnum) |
578 { | 584 { |
579 // Set "']" mark to the end of the block instead of the end of | 585 // Set "']" mark to the end of the block instead of the end of |
580 // the insert in the first line. | 586 // the insert in the first line. |