fix multiline prompts with "delimiter chars"

(only the last line of the prompt is redrawn, keep this in mind
when doing the ANSI colour game)

TODO:
* maybe go back up one line and redraw whole prompt?
* optionally edit command on multiple lines, bash-like,
  instead of scrolling horizontally
This commit is contained in:
tg 2006-08-01 14:59:51 +00:00
parent a15c5c319a
commit 857fb659bc
2 changed files with 7 additions and 6 deletions

4
edit.c
View File

@ -5,7 +5,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.27 2006/08/01 14:35:43 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.28 2006/08/01 14:59:50 tg Exp $");
/* tty driver characters we are interested in */
typedef struct {
@ -1941,7 +1941,7 @@ x_redraw(int limit)
pprompt(prompt + prompt_skip, x_trunc);
}
if (x_col > xx_cols)
x_col = x_col - (x_col / xx_cols) * xx_cols;
x_col %= xx_cols;
x_displen = xx_cols - 2 - x_col;
if (x_displen < 1) {
x_col = 0;

9
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.17 2006/08/01 14:35:44 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.18 2006/08/01 14:59:51 tg Exp $");
/* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state. */
@ -1106,9 +1106,10 @@ dopprompt(const char *cp, int ntruncate, const char **spp, int doprint)
cp += 2;
}
for (; *cp; cp++) {
if (!indelimit && ntruncate)
--ntruncate;
else if (doprint) {
if (ntruncate) {
if (!(indelimit || (*cp == delimiter)))
--ntruncate;
} else if (doprint) {
shf_puts(cp, shl_out);
doprint = 0;
}