From 9154deaefa2092ab9bdadb0d7a4612d6abde1335 Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 15 Jan 1995 06:18:29 +0000 Subject: [PATCH] Stay on the correct line at the end of a substitute command. From Andrew Moore. --- bin/ed/sub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/ed/sub.c b/bin/ed/sub.c index 22ccd4518c1a..501201deb8a4 100644 --- a/bin/ed/sub.c +++ b/bin/ed/sub.c @@ -122,6 +122,7 @@ search_and_replace(pat, gflag, kth) char *txt; char *eot; long lc; + long xa = current_addr; int nsubs = 0; line_t *lp; int len; @@ -152,8 +153,10 @@ search_and_replace(pat, gflag, kth) } while (txt != eot); SPL0(); nsubs++; + xa = current_addr; } } + current_addr = xa; if (nsubs == 0 && !(gflag & GLB)) { sprintf(errmsg, "no match"); return ERR;