summaryrefslogtreecommitdiff
path: root/bin/ksh
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2021-03-10 20:06:05 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2021-03-10 20:06:05 +0000
commita3c4462c2ae99fd32d6033dd33aef5e67008f43d (patch)
tree48a2739e7aa3a9db4dd2a63eac1de93eb42803b6 /bin/ksh
parent1439aab7ef28613ada69adbf0d8aabdf74587b30 (diff)
Fix redrawing of a multiline PS1 prompt in vi mode.
From gotroyb127 OK tb@
Diffstat (limited to 'bin/ksh')
-rw-r--r--bin/ksh/vi.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c
index 53be5a76d50..51b7184ff5a 100644
--- a/bin/ksh/vi.c
+++ b/bin/ksh/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.57 2020/09/20 14:40:45 millert Exp $ */
+/* $OpenBSD: vi.c,v 1.58 2021/03/10 20:06:04 millert Exp $ */
/*
* vi command editing
@@ -55,7 +55,7 @@ static int Endword(int);
static int grabhist(int, int);
static int grabsearch(int, int, int, char *);
static void do_clear_screen(void);
-static void redraw_line(int);
+static void redraw_line(int, int);
static void refresh_line(int);
static int outofwin(void);
static void rewindow(void);
@@ -719,7 +719,7 @@ vi_cmd(int argcnt, const char *cmd)
break;
case CTRL('r'):
- redraw_line(1);
+ redraw_line(1, 0);
break;
case '@':
@@ -1737,18 +1737,19 @@ do_clear_screen(void)
neednl = 0;
}
#endif
- redraw_line(neednl);
+ /* Only print the full prompt if we cleared the screen. */
+ redraw_line(neednl, !neednl);
}
static void
-redraw_line(int neednl)
+redraw_line(int neednl, int full)
{
(void) memset(wbuf[win], ' ', wbuf_len);
if (neednl) {
x_putc('\r');
x_putc('\n');
}
- vi_pprompt(0);
+ vi_pprompt(full);
cur_col = pwidth;
morec = ' ';
}
@@ -2109,7 +2110,7 @@ complete_word(int command, int count)
vi_error();
x_print_expansions(nwords, words, is_command);
x_free_words(nwords, words);
- redraw_line(0);
+ redraw_line(0, 0);
return -1;
}
/*
@@ -2183,7 +2184,7 @@ print_expansions(struct edstate *e)
}
x_print_expansions(nwords, words, is_command);
x_free_words(nwords, words);
- redraw_line(0);
+ redraw_line(0, 0);
return 0;
}