Mercurial > vim
comparison src/textprop.c @ 24206:55631f8e0730 v8.2.2644
patch 8.2.2644: prop_clear() causes a screen update even when nothing changed
Commit: https://github.com/vim/vim/commit/da1dbed0dfac00952b42982f8fffa42c4f5ed0c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 22 19:43:34 2021 +0100
patch 8.2.2644: prop_clear() causes a screen update even when nothing changed
Problem: prop_clear() causes a screen update even when nothing changed.
Solution: Only redraw when a property was cleared. (Dominique Pell?)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 22 Mar 2021 19:45:05 +0100 |
parents | dced82a0e5b2 |
children | 7422f2f719a3 |
comparison
equal
deleted
inserted
replaced
24205:f8f6ec7d7652 | 24206:55631f8e0730 |
---|---|
533 { | 533 { |
534 linenr_T start = tv_get_number(&argvars[0]); | 534 linenr_T start = tv_get_number(&argvars[0]); |
535 linenr_T end = start; | 535 linenr_T end = start; |
536 linenr_T lnum; | 536 linenr_T lnum; |
537 buf_T *buf = curbuf; | 537 buf_T *buf = curbuf; |
538 int did_clear = FALSE; | |
538 | 539 |
539 if (argvars[1].v_type != VAR_UNKNOWN) | 540 if (argvars[1].v_type != VAR_UNKNOWN) |
540 { | 541 { |
541 end = tv_get_number(&argvars[1]); | 542 end = tv_get_number(&argvars[1]); |
542 if (argvars[2].v_type != VAR_UNKNOWN) | 543 if (argvars[2].v_type != VAR_UNKNOWN) |
560 break; | 561 break; |
561 text = ml_get_buf(buf, lnum, FALSE); | 562 text = ml_get_buf(buf, lnum, FALSE); |
562 len = STRLEN(text) + 1; | 563 len = STRLEN(text) + 1; |
563 if ((size_t)buf->b_ml.ml_line_len > len) | 564 if ((size_t)buf->b_ml.ml_line_len > len) |
564 { | 565 { |
566 did_clear = TRUE; | |
565 if (!(buf->b_ml.ml_flags & ML_LINE_DIRTY)) | 567 if (!(buf->b_ml.ml_flags & ML_LINE_DIRTY)) |
566 { | 568 { |
567 char_u *newtext = vim_strsave(text); | 569 char_u *newtext = vim_strsave(text); |
568 | 570 |
569 // need to allocate the line now | 571 // need to allocate the line now |
573 buf->b_ml.ml_flags |= ML_LINE_DIRTY; | 575 buf->b_ml.ml_flags |= ML_LINE_DIRTY; |
574 } | 576 } |
575 buf->b_ml.ml_line_len = (int)len; | 577 buf->b_ml.ml_line_len = (int)len; |
576 } | 578 } |
577 } | 579 } |
578 redraw_buf_later(buf, NOT_VALID); | 580 if (did_clear) |
581 redraw_buf_later(buf, NOT_VALID); | |
579 } | 582 } |
580 | 583 |
581 /* | 584 /* |
582 * prop_find({props} [, {direction}]) | 585 * prop_find({props} [, {direction}]) |
583 */ | 586 */ |