fix off-by-one calculation mistake making PS1 ending in newline double it
This commit is contained in:
parent
7c040d98f9
commit
22f1fb6cd6
4
edit.c
4
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;
|
||||
|
13
lex.c
13
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user