summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobias <tobias>2016-09-02 21:39:51 +0000
committertobias <tobias>2016-09-02 21:39:51 +0000
commita432e5299f093da1d73bca344127d0232906c39e (patch)
tree959475169a3d1c784a5b51a305d28265ebe2bbb0
parentc173d70324703dcc8dc6338ca22ef2d8831dfdd0 (diff)
downloadpatch-a432e5299f093da1d73bca344127d0232906c39e.tar
patch-a432e5299f093da1d73bca344127d0232906c39e.tar.gz
Fix 'c'hange command handling if last line of a file is removed.
If the last line of a file is removed, the line cache is erroneously considered empty, which means that changed lines are added at the top. spotted by and okay otto@
-rw-r--r--ed.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ed.c b/ed.c
index c5f4666..c9aa0b6 100644
--- a/ed.c
+++ b/ed.c
@@ -103,7 +103,8 @@ do_ed_script(void)
cline = nline;
line_count--;
}
- fsm = (fsm == FSM_C) ? FSM_I : FSM_CMD;
+ cline = get_line(first_addr - 1);
+ fsm = (fsm == FSM_C) ? FSM_A : FSM_CMD;
break;
case FSM_S:
cline->subst++;