From 9d15984ebb9dab26de18a5ed633f23ad869af48f Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 5 Jan 2024 00:59:29 -0500 Subject: Allow quit in error state, don't save bad value in config. --- input.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/input.c b/input.c index 90b6232..718b7cd 100644 --- a/input.c +++ b/input.c @@ -24,8 +24,8 @@ char input_buf[MAXIN]; int iptr; double value, saved, stored=0; -void paste(); -void copy(); +void paste(void); +void copy(void); void bell(void) { if(!quiet) @@ -85,6 +85,7 @@ show_value() set_string("Err"); bell(); showing_err = 1; + value = 0; /* so it doesn't get saved on exit! */ return; } @@ -237,9 +238,18 @@ key(char c) feclearexcept(FE_ALL_EXCEPT); - if(showing_err && c != 27 && c != 'C') { - bell(); - return; + if(showing_err) { + switch(c) { + /* list the keys that should be still active in error state */ + case 27: + case 'C': + case 'Q': + case 17: + break; + default: + bell(); + return; + } } switch (c) @@ -489,13 +499,13 @@ static char *bmap[] = { }; void -copy() +copy(void) { XSetSelectionOwner(display, XA_PRIMARY, window, event.xbutton.time); } void -paste() +paste(void) { XConvertSelection(display, XA_PRIMARY, XA_STRING, paste_atom, window, event.xbutton.time); -- cgit v1.2.3