From f8aa5821be6bb802785c5ca7c23c91465cfba4a3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 1 Sep 2009 09:11:05 +0000 Subject: [PATCH] Use "Password:" with no space for password prompts and don't display a *s for the password, like pretty much everything else. From martynas@ with minor tweaks by me. --- server-fn.c | 2 +- status.c | 26 ++++++++++---------------- tmux.c | 2 +- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/server-fn.c b/server-fn.c index 37bf98a4..568751df 100644 --- a/server-fn.c +++ b/server-fn.c @@ -172,7 +172,7 @@ server_lock(void) status_prompt_clear(c); status_prompt_set(c, - "Password: ", server_lock_callback, NULL, c, PROMPT_HIDDEN); + "Password:", server_lock_callback, NULL, c, PROMPT_HIDDEN); server_redraw_client(c); } server_locked = 1; diff --git a/status.c b/status.c index 51c9c64f..e1fede15 100644 --- a/status.c +++ b/status.c @@ -690,7 +690,7 @@ status_prompt_redraw(struct client *c) struct screen_write_ctx ctx; struct session *s = c->session; struct screen old_status; - size_t i, size, left, len, off, n; + size_t i, size, left, len, off; char ch; struct grid_cell gc; @@ -724,13 +724,9 @@ status_prompt_redraw(struct client *c) left--; size = left; } - if (c->prompt_flags & PROMPT_HIDDEN) { - n = strlen(c->prompt_buffer); - if (n > left) - n = left; - for (i = 0; i < n; i++) - screen_write_putc(&ctx, &gc, '*'); - } else { + if (c->prompt_flags & PROMPT_HIDDEN) + size = 0; + else { screen_write_puts(&ctx, &gc, "%.*s", (int) left, c->prompt_buffer + off); } @@ -739,17 +735,15 @@ status_prompt_redraw(struct client *c) screen_write_putc(&ctx, &gc, ' '); /* Draw a fake cursor. */ - screen_write_cursormove(&ctx, len + c->prompt_index - off, 0); - if (c->prompt_index == strlen(c->prompt_buffer)) - ch = ' '; + ch = ' '; + if (c->prompt_flags & PROMPT_HIDDEN) + screen_write_cursormove(&ctx, len, 0); else { - if (c->prompt_flags & PROMPT_HIDDEN) - ch = '*'; - else + screen_write_cursormove(&ctx, + len + c->prompt_index - off, 0); + if (c->prompt_index < strlen(c->prompt_buffer)) ch = c->prompt_buffer[c->prompt_index]; } - if (ch == '\0') - ch = ' '; gc.attr ^= GRID_ATTR_REVERSE; screen_write_putc(&ctx, &gc, ch); } diff --git a/tmux.c b/tmux.c index 103a6bc6..7053201c 100644 --- a/tmux.c +++ b/tmux.c @@ -214,7 +214,7 @@ prepare_unlock(enum msgtype *msg, void **buf, size_t *len, int argc) return (-1); } - if ((pass = getpass("Password: ")) == NULL) + if ((pass = getpass("Password:")) == NULL) return (-1); if (strlen(pass) >= sizeof unlockdata.pass) {