aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-02-03 01:22:24 +0000
committerSean Dewar <seandewar@users.noreply.github.com>2022-02-14 17:29:49 +0000
commitafbed8cb75af714a636128c4ad7fb4be6edf7727 (patch)
treea403cd5761ab8acbef62687199edeaf391b431ea /src/nvim/ops.c
parente662d86e8d3198ea77e1a6d0b9be7c09255de520 (diff)
downloadrneovim-afbed8cb75af714a636128c4ad7fb4be6edf7727.tar.gz
rneovim-afbed8cb75af714a636128c4ad7fb4be6edf7727.tar.bz2
rneovim-afbed8cb75af714a636128c4ad7fb4be6edf7727.zip
vim-patch:8.2.4151: reading beyond the end of a line
Problem: Reading beyond the end of a line. Solution: For block insert only use the offset for correcting the length. https://github.com/vim/vim/commit/57df9e8a9f9ae1aafdde9b86b10ad907627a87dc
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index e712aa18b3..c9a99fef84 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -568,19 +568,8 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def
}
if (spaces > 0) {
- int off;
-
- // Avoid starting halfway through a multi-byte character.
- if (b_insert) {
- off = utf_head_off(oldp, oldp + offset + spaces);
- spaces -= off;
- count -= off;
- } else {
- // spaces fill the gap, the character that's at the edge moves
- // right
- off = utf_head_off(oldp, oldp + offset);
- offset -= off;
- }
+ // avoid copying part of a multi-byte character
+ offset -= utf_head_off(oldp, oldp + offset);
}
if (spaces < 0) { // can happen when the cursor was moved
spaces = 0;