2022-07-13 10:40:41 +08:00
|
|
|
|
From d25f003342aca9889067f2e839963dfeccf1fe05 Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
From: Bram Moolenaar <Bram@vim.org>
|
|
|
|
|
|
Date: Thu, 30 Jun 2022 12:30:19 +0100
|
|
|
|
|
|
Subject: [PATCH] patch 9.0.0011: reading beyond the end of the line with put
|
|
|
|
|
|
command
|
|
|
|
|
|
|
|
|
|
|
|
Problem: Reading beyond the end of the line with put command.
|
|
|
|
|
|
Solution: Adjust the end mark position.
|
|
|
|
|
|
---
|
|
|
|
|
|
src/register.c | 2 ++
|
|
|
|
|
|
src/testdir/test_put.vim | 12 ++++++++++++
|
|
|
|
|
|
2 files changed, 14 insertions(+)
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/register.c b/src/register.c
|
|
|
|
|
|
index 87689f7..51c14b8 100644
|
|
|
|
|
|
--- a/src/register.c
|
|
|
|
|
|
+++ b/src/register.c
|
2022-11-03 15:03:25 +08:00
|
|
|
|
@@ -1918,6 +1918,8 @@ do_put(
|
2022-07-13 10:40:41 +08:00
|
|
|
|
vim_memset(ptr, ' ', (size_t)spaces);
|
|
|
|
|
|
ptr += spaces;
|
|
|
|
|
|
}
|
2022-11-03 15:03:25 +08:00
|
|
|
|
+ else
|
|
|
|
|
|
+ totlen -= spaces; // didn't use these spaces
|
2022-07-13 10:40:41 +08:00
|
|
|
|
}
|
2022-11-03 15:03:25 +08:00
|
|
|
|
|
2022-07-13 10:40:41 +08:00
|
|
|
|
// may insert some spaces after the new text
|
|
|
|
|
|
diff --git a/src/testdir/test_put.vim b/src/testdir/test_put.vim
|
|
|
|
|
|
index 6df04cf..c8d306a 100644
|
|
|
|
|
|
--- a/src/testdir/test_put.vim
|
|
|
|
|
|
+++ b/src/testdir/test_put.vim
|
2022-11-03 15:03:25 +08:00
|
|
|
|
@@ -219,5 +219,17 @@ func Test_put_empty_register()
|
2022-07-13 10:40:41 +08:00
|
|
|
|
bwipe!
|
|
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
|
|
|
|
+" this was putting the end mark after the end of the line
|
|
|
|
|
|
+func Test_put_visual_mode()
|
|
|
|
|
|
+ edit! SomeNewBuffer
|
|
|
|
|
|
+ set selection=exclusive
|
|
|
|
|
|
+ exe "norm o\t"
|
|
|
|
|
|
+ m0
|
|
|
|
|
|
+ sil! norm
p
p
|
|
|
|
|
|
+
|
|
|
|
|
|
+ bwipe!
|
|
|
|
|
|
+ set selection&
|
|
|
|
|
|
+endfunc
|
|
|
|
|
|
+
|
2022-11-03 15:03:25 +08:00
|
|
|
|
|
|
|
|
|
|
" vim: shiftwidth=2 sts=2 expandtab
|
2022-07-13 10:40:41 +08:00
|
|
|
|
--
|
|
|
|
|
|
1.8.3.1
|
|
|
|
|
|
|