diff --git a/edit.c b/edit.c index 2cb1c4e..d2ac139 100644 --- a/edit.c +++ b/edit.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.153 2009/03/15 16:13:38 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.154 2009/03/15 18:30:39 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -1380,7 +1380,7 @@ x_init_prompt(void) x_col = promptlen(prompt); x_adj_ok = 1; prompt_redraw = 1; - if (x_col > xx_cols) + if (x_col >= xx_cols) x_col %= xx_cols; x_displen = xx_cols - 2 - x_col; x_adj_done = 0; diff --git a/lex.c b/lex.c index 9e48c63..6b99ace 100644 --- a/lex.c +++ b/lex.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.79 2008/12/13 17:02:15 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.80 2009/03/15 18:30:40 tg Exp $"); /* * states while lexing word @@ -95,7 +95,7 @@ static void gethere(bool); static Lex_state *push_state_(State_info *, Lex_state *); static Lex_state *pop_state_(State_info *, Lex_state *); -static int dopprompt(const char *, int, int); +static int dopprompt(const char *, int, bool); static int backslash_skip; static int ignore_backslash_newline; @@ -1304,7 +1304,7 @@ set_prompt(int to, Source *s) } static int -dopprompt(const char *cp, int ntruncate, int doprint) +dopprompt(const char *cp, int ntruncate, bool doprint) { int columns = 0, lines = 0, indelimit = 0; char delimiter = 0; @@ -1348,21 +1348,20 @@ dopprompt(const char *cp, int ntruncate, int doprint) } if (doprint) shf_flush(shl_out); - indelimit = (x_cols * lines + columns); - return indelimit; + return (x_cols * lines + columns); } void pprompt(const char *cp, int ntruncate) { - dopprompt(cp, ntruncate, 1); + dopprompt(cp, ntruncate, true); } int promptlen(const char *cp) { - return (dopprompt(cp, 0, 0)); + return (dopprompt(cp, 0, false)); } /* Read the variable part of a ${...} expression (ie, up to but not including