summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-09-01 09:11:06 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-09-01 09:11:06 +0000
commit3c72b221f38793115feebc4d9b966955647044c4 (patch)
tree33b06505c33e5254aae090fd369b900ef794648a
parentcfcd09edfc7c43bfe81a718f966345d66782c9ed (diff)
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.
-rw-r--r--usr.bin/tmux/server-fn.c4
-rw-r--r--usr.bin/tmux/status.c28
-rw-r--r--usr.bin/tmux/tmux.c4
3 files changed, 15 insertions, 21 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index e407c83f8f6..1b75175178e 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.15 2009/08/31 20:46:19 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.16 2009/09/01 09:11:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 5afb11e1ee1..d601e282b9a 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.28 2009/08/31 20:46:19 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.29 2009/09/01 09:11:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 805438b064f..bc80f830e50 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.37 2009/09/01 09:00:54 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.38 2009/09/01 09:11:05 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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) {