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.
This commit is contained in:
parent
842757dc96
commit
fdbac35b33
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static const char vi_Version[] =
|
static const char vi_Version[] =
|
||||||
"$Id: vi.c,v 1.14 2001/07/31 15:01:12 kraai Exp $";
|
"$Id: vi.c,v 1.15 2001/08/02 05:26:41 andersen Exp $";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To compile for standalone use:
|
* To compile for standalone use:
|
||||||
@ -2640,12 +2640,12 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p'
|
|||||||
cmdcnt = 0;
|
cmdcnt = 0;
|
||||||
end_cmd_q(); // stop adding to q
|
end_cmd_q(); // stop adding to q
|
||||||
strcpy((char *) status_buffer, " "); // clear the status buffer
|
strcpy((char *) status_buffer, " "); // clear the status buffer
|
||||||
if (p[-1] != '\n') {
|
if ((p[-1] != '\n') && (dot>text)) {
|
||||||
p--;
|
p--;
|
||||||
}
|
}
|
||||||
} else if (c == erase_char) { // Is this a BS
|
} else if (c == erase_char) { // Is this a BS
|
||||||
// 123456789
|
// 123456789
|
||||||
if (p[-1] != '\n') {
|
if ((p[-1] != '\n') && (dot>text)) {
|
||||||
p--;
|
p--;
|
||||||
p = text_hole_delete(p, p); // shrink buffer 1 char
|
p = text_hole_delete(p, p); // shrink buffer 1 char
|
||||||
#ifdef BB_FEATURE_VI_DOT_CMD
|
#ifdef BB_FEATURE_VI_DOT_CMD
|
||||||
|
6
vi.c
6
vi.c
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static const char vi_Version[] =
|
static const char vi_Version[] =
|
||||||
"$Id: vi.c,v 1.14 2001/07/31 15:01:12 kraai Exp $";
|
"$Id: vi.c,v 1.15 2001/08/02 05:26:41 andersen Exp $";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To compile for standalone use:
|
* To compile for standalone use:
|
||||||
@ -2640,12 +2640,12 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p'
|
|||||||
cmdcnt = 0;
|
cmdcnt = 0;
|
||||||
end_cmd_q(); // stop adding to q
|
end_cmd_q(); // stop adding to q
|
||||||
strcpy((char *) status_buffer, " "); // clear the status buffer
|
strcpy((char *) status_buffer, " "); // clear the status buffer
|
||||||
if (p[-1] != '\n') {
|
if ((p[-1] != '\n') && (dot>text)) {
|
||||||
p--;
|
p--;
|
||||||
}
|
}
|
||||||
} else if (c == erase_char) { // Is this a BS
|
} else if (c == erase_char) { // Is this a BS
|
||||||
// 123456789
|
// 123456789
|
||||||
if (p[-1] != '\n') {
|
if ((p[-1] != '\n') && (dot>text)) {
|
||||||
p--;
|
p--;
|
||||||
p = text_hole_delete(p, p); // shrink buffer 1 char
|
p = text_hole_delete(p, p); // shrink buffer 1 char
|
||||||
#ifdef BB_FEATURE_VI_DOT_CMD
|
#ifdef BB_FEATURE_VI_DOT_CMD
|
||||||
|
Loading…
Reference in New Issue
Block a user