diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-08-02 05:26:41 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-08-02 05:26:41 +0000 |
commit | fdbac35b332ae3e7789e2663d7e3b1144c061207 (patch) | |
tree | 3223258892abf2d17b39793a1ddddc9e46aec8ee | |
parent | 842757dc9684220ced5aef7ed146a4265d0eb37c (diff) | |
download | busybox-w32-fdbac35b332ae3e7789e2663d7e3b1144c061207.tar.gz busybox-w32-fdbac35b332ae3e7789e2663d7e3b1144c061207.tar.bz2 busybox-w32-fdbac35b332ae3e7789e2663d7e3b1144c061207.zip |
Patch from Robert J. Osborne <rj@resourceinternational.com> that fixes
a bug in vi where the beginning of the text space was not checked
before dot is decremented for delete and escape sequences on an empty
file.
-rw-r--r-- | editors/vi.c | 6 | ||||
-rw-r--r-- | vi.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/editors/vi.c b/editors/vi.c index 38aee15d7..8d7506d0f 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | static const char vi_Version[] = | 21 | static const char vi_Version[] = |
22 | "$Id: vi.c,v 1.14 2001/07/31 15:01:12 kraai Exp $"; | 22 | "$Id: vi.c,v 1.15 2001/08/02 05:26:41 andersen Exp $"; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * To compile for standalone use: | 25 | * To compile for standalone use: |
@@ -2640,12 +2640,12 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p' | |||
2640 | cmdcnt = 0; | 2640 | cmdcnt = 0; |
2641 | end_cmd_q(); // stop adding to q | 2641 | end_cmd_q(); // stop adding to q |
2642 | strcpy((char *) status_buffer, " "); // clear the status buffer | 2642 | strcpy((char *) status_buffer, " "); // clear the status buffer |
2643 | if (p[-1] != '\n') { | 2643 | if ((p[-1] != '\n') && (dot>text)) { |
2644 | p--; | 2644 | p--; |
2645 | } | 2645 | } |
2646 | } else if (c == erase_char) { // Is this a BS | 2646 | } else if (c == erase_char) { // Is this a BS |
2647 | // 123456789 | 2647 | // 123456789 |
2648 | if (p[-1] != '\n') { | 2648 | if ((p[-1] != '\n') && (dot>text)) { |
2649 | p--; | 2649 | p--; |
2650 | p = text_hole_delete(p, p); // shrink buffer 1 char | 2650 | p = text_hole_delete(p, p); // shrink buffer 1 char |
2651 | #ifdef BB_FEATURE_VI_DOT_CMD | 2651 | #ifdef BB_FEATURE_VI_DOT_CMD |
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | static const char vi_Version[] = | 21 | static const char vi_Version[] = |
22 | "$Id: vi.c,v 1.14 2001/07/31 15:01:12 kraai Exp $"; | 22 | "$Id: vi.c,v 1.15 2001/08/02 05:26:41 andersen Exp $"; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * To compile for standalone use: | 25 | * To compile for standalone use: |
@@ -2640,12 +2640,12 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p' | |||
2640 | cmdcnt = 0; | 2640 | cmdcnt = 0; |
2641 | end_cmd_q(); // stop adding to q | 2641 | end_cmd_q(); // stop adding to q |
2642 | strcpy((char *) status_buffer, " "); // clear the status buffer | 2642 | strcpy((char *) status_buffer, " "); // clear the status buffer |
2643 | if (p[-1] != '\n') { | 2643 | if ((p[-1] != '\n') && (dot>text)) { |
2644 | p--; | 2644 | p--; |
2645 | } | 2645 | } |
2646 | } else if (c == erase_char) { // Is this a BS | 2646 | } else if (c == erase_char) { // Is this a BS |
2647 | // 123456789 | 2647 | // 123456789 |
2648 | if (p[-1] != '\n') { | 2648 | if ((p[-1] != '\n') && (dot>text)) { |
2649 | p--; | 2649 | p--; |
2650 | p = text_hole_delete(p, p); // shrink buffer 1 char | 2650 | p = text_hole_delete(p, p); // shrink buffer 1 char |
2651 | #ifdef BB_FEATURE_VI_DOT_CMD | 2651 | #ifdef BB_FEATURE_VI_DOT_CMD |