vim-patch:9.0.1172: when 'selection' is "exclusive" then "1v" is one char short (#21735)

Problem:    When 'selection' is "exclusive" then "1v" is one char short.
Solution:   Add one character when 'selection' is "exclusive. (closes vim/vim#11791)

79c11e399b

Cherry-pick update_curswant_force() refactor from patch 9.0.0482.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-01-11 06:39:20 +08:00
committed by GitHub
parent 15ee93c0b4
commit 08d5b4275e
3 changed files with 31 additions and 15 deletions

View File

@@ -379,12 +379,19 @@ static bool check_top_offset(void)
return false;
}
/// Update w_curswant.
void update_curswant_force(void)
{
validate_virtcol();
curwin->w_curswant = curwin->w_virtcol;
curwin->w_set_curswant = false;
}
/// Update w_curswant if w_set_curswant is set.
void update_curswant(void)
{
if (curwin->w_set_curswant) {
validate_virtcol();
curwin->w_curswant = curwin->w_virtcol;
curwin->w_set_curswant = false;
update_curswant_force();
}
}