fix backward deletion off-by-one in non-border case

take #if 0'd back debugging code for a while, until
the next release comes out… you never know…
This commit is contained in:
tg 2006-11-06 19:57:19 +00:00
parent 230d52135d
commit 3d61efea7d
1 changed files with 25 additions and 5 deletions

30
edit.c
View File

@ -5,7 +5,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.56 2006/11/05 21:11:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.57 2006/11/06 19:57:19 tg Exp $");
/* tty driver characters we are interested in */
typedef struct {
@ -56,6 +56,28 @@ static int x_file_glob(int, const char *, int, char ***);
static int x_command_glob(int, const char *, int, char ***);
static int x_locate_word(const char *, int, int, int *, int *);
#if 0
static void D(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
static void
D(const char *fmt, ...)
{
static FILE *_Dfp = NULL;
va_list ap;
if (_Dfp == NULL) {
if ((_Dfp = fopen("/tmp/mksh.dbg", "ab+")) == NULL)
abort();
fprintf(_Dfp, "\n\nOpening from %ld\n", (long)getpid());
}
va_start(ap, fmt);
vfprintf(_Dfp, fmt, ap);
fflush(_Dfp);
}
#else
#define D(x) /* nothing */
#endif
/* +++ generic editing functions +++ */
/* Called from main */
@ -1705,11 +1727,9 @@ x_del_back(int c __attribute__((unused)))
x_e_putc2(7);
return (KSTD);
}
while (i++ < x_arg) {
do {
x_goto(xcp - 1);
if (xcp == xbuf)
break;
}
} while ((++i < x_arg) && (xcp != xbuf));
x_delete(i, false);
return KSTD;
}