tvi: do not copy vi_charlast into itself in vi_findchar() - neatvi - [fork] simple vi-type editor with UTF-8 support
(HTM) git clone git://src.adamsgaard.dk/neatvi
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit a361130de2e06249c9bc838a050f09333b0d762d
(DIR) parent 54a452c55c89f3f3bc1a58741b81f2471c7a9c18
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Wed, 3 Mar 2021 11:27:29 +0330
vi: do not copy vi_charlast into itself in vi_findchar()
Diffstat:
M vi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/vi.c b/vi.c
t@@ -246,7 +246,8 @@ static int vi_nextcol(struct lbuf *lb, int dir, int *row, int *off)
static int vi_findchar(struct lbuf *lb, char *cs, int cmd, int n, int *row, int *off)
{
- strcpy(vi_charlast, cs);
+ if (cs != vi_charlast)
+ strcpy(vi_charlast, cs);
vi_charcmd = cmd;
return lbuf_findchar(lb, cs, cmd, n, row, off);
}