aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorPaul Fox <pgf@brightstareng.com>2005-11-28 18:07:53 +0000
committerPaul Fox <pgf@brightstareng.com>2005-11-28 18:07:53 +0000
commitd957b9537ee2b93af93c92dbb8a2a6cfc3682318 (patch)
tree6666c2de7ccb0bf480435053d9537b747f218f79 /editors
parent5a16a8942706839a57a600b5d11059ddfe2f94cd (diff)
downloadbusybox-d957b9537ee2b93af93c92dbb8a2a6cfc3682318.tar.gz
fix bug #474:
0000474: vi crashes often problem was that the buffer used for "." command ("last_modifying_cmd") wasn't being maintined correctly -- the recording code was walking back over the front of that buffer when a repeatable insert command included backspacing (e.g. "i\b\b\bfoo"). the fix is to simply record the backspaces along with the rest of the command. also, cleaned up start_new_cmd_q() slightly.
Diffstat (limited to 'editors')
-rw-r--r--editors/vi.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/editors/vi.c b/editors/vi.c
index e6c87560d..6689e290b 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1615,16 +1615,6 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p'
if ((p[-1] != '\n') && (dot>text)) {
p--;
p = text_hole_delete(p, p); // shrink buffer 1 char
-#ifdef CONFIG_FEATURE_VI_DOT_CMD
- // also rmove char from last_modifying_cmd
- if (last_modifying_cmd != 0 && strlen((char *) last_modifying_cmd) > 0) {
- Byte *q;
-
- q = last_modifying_cmd;
- q[strlen((char *) q) - 1] = '\0'; // erase BS
- q[strlen((char *) q) - 1] = '\0'; // erase prev char
- }
-#endif /* CONFIG_FEATURE_VI_DOT_CMD */
}
} else {
// insert a char into text[]
@@ -2009,11 +1999,10 @@ static void start_new_cmd_q(Byte c)
memset(last_modifying_cmd, '\0', BUFSIZ); // clear new cmd queue
// if there is a current cmd count put it in the buffer first
if (cmdcnt > 0)
- sprintf((char *) last_modifying_cmd, "%d", cmdcnt);
- // save char c onto queue
- last_modifying_cmd[strlen((char *) last_modifying_cmd)] = c;
+ sprintf((char *) last_modifying_cmd, "%d%c", cmdcnt, c);
+ else // just save char c onto queue
+ last_modifying_cmd[0] = c;
adding2q = 1;
- return;
}
static void end_cmd_q(void)