summaryrefslogtreecommitdiffstats
path: root/src/register.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-12 17:43:05 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-12 17:43:05 +0100
commit424ec1f235a53131042aed94d30f6e2528e551d9 (patch)
treeacb863e4fea054f85e288966d89fc2952a7fdbdc /src/register.c
parent4f32c83a775a195ae7e1545b2840fb773f93414f (diff)
patch 9.1.0021: i_CTRL-R- doesn't work for multibyte chars in Replace modev9.1.0021
Problem: i_CTRL-R- doesn't work for multibyte chars in Replace mode, Coverity complains missing return value for u_save_cursor() Solution: Use mb_charlen() and del_chars() instead, handle failure mode for u_save_cursor() correctly (@zeertzjq) closes: #13846 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/register.c')
-rw-r--r--src/register.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/register.c b/src/register.c
index f381e303be..8a4ae67489 100644
--- a/src/register.c
+++ b/src/register.c
@@ -832,8 +832,9 @@ insert_reg(
if ((State & REPLACE_FLAG) != 0)
{
pos_T curpos;
- u_save_cursor();
- del_bytes((long)STRLEN(y_current->y_array[0]), TRUE, FALSE);
+ if (u_save_cursor() == FAIL)
+ return FAIL;
+ del_chars((long)mb_charlen(y_current->y_array[0]), TRUE);
curpos = curwin->w_cursor;
if (oneright() == FAIL)
// hit end of line, need to put forward (after the current position)