Mercurial > vim
diff src/normal.c @ 31881:df061831a85f v9.0.1273
patch 9.0.1273: "1v" may select block with wrong size
Commit: https://github.com/vim/vim/commit/8f531662e28c37560bf5ac20a059bf00d01ee5a4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 1 17:33:18 2023 +0000
patch 9.0.1273: "1v" may select block with wrong size
Problem: "1v" may select block with wrong size. (Evgeni Chasnovski)
Solution: Compute "curswant" in the right line. (closes https://github.com/vim/vim/issues/11925)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 01 Feb 2023 18:45:04 +0100 |
parents | 3365a601e73b |
children | d8fdafc4b390 |
line wrap: on
line diff
--- a/src/normal.c +++ b/src/normal.c @@ -5493,8 +5493,13 @@ nv_visual(cmdarg_T *cap) } else if (VIsual_mode == Ctrl_V) { + // Update curswant on the original line, that is where "col" is + // valid. + linenr_T lnum = curwin->w_cursor.lnum; + curwin->w_cursor.lnum = VIsual.lnum; update_curswant_force(); - curwin->w_curswant += + resel_VIsual_vcol * cap->count0 - 1; + curwin->w_curswant += resel_VIsual_vcol * cap->count0 - 1; + curwin->w_cursor.lnum = lnum; coladvance(curwin->w_curswant); } else