fix issue with line splits inmidst of multibyte characters

This commit is contained in:
tg 2006-11-05 19:15:15 +00:00
parent 6b02a01833
commit 47daa0eadc

16
edit.c
View File

@ -5,7 +5,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.50 2006/11/05 19:12:41 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.51 2006/11/05 19:15:15 tg Exp $");
/* tty driver characters we are interested in */ /* tty driver characters we are interested in */
typedef struct { typedef struct {
@ -3003,20 +3003,16 @@ do_complete(int flags, /* XCF_{COMMAND,FILE,COMMAND_FILE} */
static void static void
x_adjust(void) x_adjust(void)
{ {
// int i;
D(" x_adjust "); D(" x_adjust ");
x_adj_done++; /* flag the fact that we were called. */ x_adj_done++; /* flag the fact that we were called. */
/* /*
* we had a problem if the prompt length > xx_cols / 2 * we had a problem if the prompt length > xx_cols / 2
*/ */
/* xbp = xcp; if ((xbp = xcp - (x_displen / 2)) < xbuf)
for (i = 0; i < (x_displen / 2); ++i) xbp = xbuf;
xbp = utf_backch(xbp); if (Flag(FUTFHACK))
if (xbp < xbuf) while ((xbp > xbuf) && ((*xbp & 0xC0) == 0x80))
xbp = xbuf;*/ --xbp;
if ((xbp = xcp - (x_displen / 2)) < xbuf)
xbp = xbuf;
xlp_valid = false; xlp_valid = false;
D("xbp=%td xcp=%td ", xbp-xbuf, xcp-xbuf); D("xbp=%td xcp=%td ", xbp-xbuf, xcp-xbuf);
x_redraw(xx_cols); x_redraw(xx_cols);