commit 30711833a0a517b84dd5c0e49e2bb522e3d652ad
parent 53afdf5cd33868ac4b6bc9afc24b5a4cee0ca0ad
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 13 Dec 2015 18:27:38 +0100
call subst() only after checking the syntax of the cmd
It is better don't call to subst() until we are sure
that the syntax of the command is valid, because in other
case we can do modifications to the buffer that we
have to undo because the user mistook with the syntax
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ed.c b/ed.c
@@ -973,11 +973,10 @@ subline(int num, int nth)
}
static void
-subst(void)
+subst(int nth)
{
- int nth, i;
+ int i;
- nth = getnth();
for (i = line1; i <= line2; i = nextln(i))
subline(i, nth);
}
@@ -1072,8 +1071,9 @@ repeat:
c = input();
compile(c);
getrhs(c);
- subst();
+ num = getnth();
chkprint(1);
+ subst(num);
break;
case 'i':
if (nlines > 1)