tvi: do nothing in @@, when invoked for the first time - 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 84fad00b295c1fb13ea3baa0c8267b7aa4b035de
(DIR) parent 0d6850fad63e1064e503cda0b3f072e771eeaced
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Fri, 12 Feb 2021 01:14:33 +0330
vi: do nothing in @@, when invoked for the first time
Diffstat:
M vi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/vi.c b/vi.c
t@@ -1026,17 +1026,18 @@ static void vc_repeat(void)
static void vc_execute(void)
{
- static int exec_buf;
+ static int exec_buf = -1;
int lnmode;
int c = vi_read();
- char *buf;
+ char *buf = NULL;
int i;
if (TK_INT(c))
return;
if (c == '@')
c = exec_buf;
exec_buf = c;
- buf = reg_get(exec_buf, &lnmode);
+ if (exec_buf >= 0)
+ buf = reg_get(exec_buf, &lnmode);
if (buf)
for (i = 0; i < MAX(1, vi_arg1); i++)
term_push(buf, strlen(buf));