Avoid using the prompt history when the server is locked, and prevent any

input entered from being added to the client's prompt history. From nicm.
This commit is contained in:
Tiago Cunha 2009-04-27 13:56:51 +00:00
parent 058772e4e6
commit c80ad456cc
2 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,7 @@
27 April 2009 27 April 2009
* Avoid using the prompt history when the server is locked, and prevent any
input entered from being added to the client's prompt history.
* New command, confirm-before (alias confirm), which asks for confirmation * New command, confirm-before (alias confirm), which asks for confirmation
before executing a command. Bound "&" and "x" by default to confirm-before before executing a command. Bound "&" and "x" by default to confirm-before
"kill-window" and confirm-before "kill-pane", respectively. "kill-window" and confirm-before "kill-pane", respectively.
@ -1222,7 +1224,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other (including mutt, emacs). No status bar yet and no key remapping or other
customisation. customisation.
$Id: CHANGES,v 1.276 2009-04-27 13:21:15 tcunha Exp $ $Id: CHANGES,v 1.277 2009-04-27 13:56:51 tcunha Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms

View File

@ -1,4 +1,4 @@
/* $Id: status.c,v 1.75 2009-02-13 21:39:45 nicm Exp $ */ /* $Id: status.c,v 1.76 2009-04-27 13:56:51 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -784,6 +784,9 @@ status_prompt_key(struct client *c, int key)
} }
break; break;
case MODEKEYCMD_UP: case MODEKEYCMD_UP:
if (server_locked)
break;
if (ARRAY_LENGTH(&c->prompt_hdata) == 0) if (ARRAY_LENGTH(&c->prompt_hdata) == 0)
break; break;
xfree(c->prompt_buffer); xfree(c->prompt_buffer);
@ -797,6 +800,9 @@ status_prompt_key(struct client *c, int key)
c->flags |= CLIENT_STATUS; c->flags |= CLIENT_STATUS;
break; break;
case MODEKEYCMD_DOWN: case MODEKEYCMD_DOWN:
if (server_locked)
break;
xfree(c->prompt_buffer); xfree(c->prompt_buffer);
if (c->prompt_hindex != 0) { if (c->prompt_hindex != 0) {
@ -849,6 +855,9 @@ status_prompt_key(struct client *c, int key)
void void
status_prompt_add_history(struct client *c) status_prompt_add_history(struct client *c)
{ {
if (server_locked)
return;
if (ARRAY_LENGTH(&c->prompt_hdata) > 0 && if (ARRAY_LENGTH(&c->prompt_hdata) > 0 &&
strcmp(ARRAY_LAST(&c->prompt_hdata), c->prompt_buffer) == 0) strcmp(ARRAY_LAST(&c->prompt_hdata), c->prompt_buffer) == 0)
return; return;