fix regression wrt. pdksh (introduced between R40e and R40f)
about how and when the display is redrawn by reverting one bool back to an int, as it’s used as a counter (hm, should be an unsigned I guess but…) on the other hand, xlp_valid should’ve been a bool, make it so
This commit is contained in:
		
							
								
								
									
										16
									
								
								edit.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								edit.c
									
									
									
									
									
								
							| @@ -28,7 +28,7 @@ | |||||||
|  |  | ||||||
| #ifndef MKSH_NO_CMDLINE_EDITING | #ifndef MKSH_NO_CMDLINE_EDITING | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.255 2012/10/21 18:33:46 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.256 2012/11/26 22:39:14 tg Exp $"); | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * in later versions we might use libtermcap for this, but since external |  * in later versions we might use libtermcap for this, but since external | ||||||
| @@ -931,14 +931,14 @@ static bool x_adj_ok; | |||||||
|  * we use x_adj_done so that functions can tell |  * we use x_adj_done so that functions can tell | ||||||
|  * whether x_adjust() has been called while they are active. |  * whether x_adjust() has been called while they are active. | ||||||
|  */ |  */ | ||||||
| static bool x_adj_done; | static int x_adj_done;		/* is incremented by x_adjust() */ | ||||||
|  |  | ||||||
| static int x_col; | static int x_col; | ||||||
| static int x_displen; | static int x_displen; | ||||||
| static int x_arg;		/* general purpose arg */ | static int x_arg;		/* general purpose arg */ | ||||||
| static bool x_arg_defaulted;	/* x_arg not explicitly set; defaulted to 1 */ | static bool x_arg_defaulted;	/* x_arg not explicitly set; defaulted to 1 */ | ||||||
|  |  | ||||||
| static int xlp_valid; | static bool xlp_valid;		/* lastvis pointer was recalculated */ | ||||||
|  |  | ||||||
| static char **x_histp;		/* history position */ | static char **x_histp;		/* history position */ | ||||||
| static int x_nextcmd;		/* for newline-and-next */ | static int x_nextcmd;		/* for newline-and-next */ | ||||||
| @@ -1191,7 +1191,7 @@ x_init_prompt(void) | |||||||
| 	if (x_col >= xx_cols) | 	if (x_col >= xx_cols) | ||||||
| 		x_col %= xx_cols; | 		x_col %= xx_cols; | ||||||
| 	x_displen = xx_cols - 2 - x_col; | 	x_displen = xx_cols - 2 - x_col; | ||||||
| 	x_adj_done = false; | 	x_adj_done = 0; | ||||||
|  |  | ||||||
| 	pprompt(prompt, 0); | 	pprompt(prompt, 0); | ||||||
| 	if (x_displen < 1) { | 	if (x_displen < 1) { | ||||||
| @@ -1364,7 +1364,7 @@ static int | |||||||
| x_ins(const char *s) | x_ins(const char *s) | ||||||
| { | { | ||||||
| 	char *cp = xcp; | 	char *cp = xcp; | ||||||
| 	bool adj = x_adj_done; | 	int adj = x_adj_done; | ||||||
|  |  | ||||||
| 	if (x_do_ins(s, strlen(s)) < 0) | 	if (x_do_ins(s, strlen(s)) < 0) | ||||||
| 		return (-1); | 		return (-1); | ||||||
| @@ -1641,7 +1641,7 @@ x_size2(char *cp, char **dcp) | |||||||
| static void | static void | ||||||
| x_zots(char *str) | x_zots(char *str) | ||||||
| { | { | ||||||
| 	bool adj = x_adj_done; | 	int adj = x_adj_done; | ||||||
|  |  | ||||||
| 	x_lastcp(); | 	x_lastcp(); | ||||||
| 	while (*str && str < xlp && adj == x_adj_done) | 	while (*str && str < xlp && adj == x_adj_done) | ||||||
| @@ -2860,7 +2860,7 @@ static void | |||||||
| x_adjust(void) | x_adjust(void) | ||||||
| { | { | ||||||
| 	/* flag the fact that we were called. */ | 	/* flag the fact that we were called. */ | ||||||
| 	x_adj_done = true; | 	x_adj_done++; | ||||||
| 	/* | 	/* | ||||||
| 	 * we had a problem if the prompt length > xx_cols / 2 | 	 * we had a problem if the prompt length > xx_cols / 2 | ||||||
| 	 */ | 	 */ | ||||||
| @@ -2982,7 +2982,7 @@ x_e_putc3(const char **cp) | |||||||
| static void | static void | ||||||
| x_e_puts(const char *s) | x_e_puts(const char *s) | ||||||
| { | { | ||||||
| 	bool adj = x_adj_done; | 	int adj = x_adj_done; | ||||||
|  |  | ||||||
| 	while (*s && adj == x_adj_done) | 	while (*s && adj == x_adj_done) | ||||||
| 		x_e_putc3(&s); | 		x_e_putc3(&s); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user