vim-patch:9.0.0194: cursor displayed in wrong position after removing text prop (#22706)

Problem:    Cursor displayed in wrong position after removing text prop. (Ben
            Jackson)
Solution:   Invalidate the cursor position. (closes vim/vim#10898)

326c5d36e7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-03-17 21:19:34 +08:00
committed by GitHub
parent 86c164d2a1
commit eb3fcf652b
4 changed files with 19 additions and 3 deletions

View File

@@ -446,6 +446,7 @@ void deleted_lines_mark(linenr_T lnum, long count)
}
/// Marks the area to be redrawn after a change.
/// Consider also calling changed_line_display_buf().
///
/// @param buf the buffer where lines were changed
/// @param lnum first line with change

View File

@@ -11,6 +11,7 @@
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
#include "nvim/memory.h"
#include "nvim/move.h"
#include "nvim/pos.h"
#include "nvim/sign_defs.h"
@@ -86,6 +87,7 @@ void decor_redraw(buf_T *buf, int row1, int row2, Decoration *decor)
if (decor && kv_size(decor->virt_lines)) {
redraw_buf_line_later(buf, row1 + 1 + (decor->virt_lines_above?0:1), true);
changed_line_display_buf(buf);
}
}

View File

@@ -471,6 +471,19 @@ void changed_line_abv_curs_win(win_T *wp)
|VALID_CHEIGHT|VALID_TOPLINE);
}
/// Display of line has changed for "buf", invalidate cursor position and
/// w_botline.
void changed_line_display_buf(buf_T *buf)
{
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_buffer == buf) {
wp->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL
|VALID_CROW|VALID_CHEIGHT
|VALID_TOPLINE|VALID_BOTLINE|VALID_BOTLINE_AP);
}
}
}
// Make sure the value of curwin->w_botline is valid.
void validate_botline(win_T *wp)
{