diff options
author | B. Watson <urchlay@slackware.uk> | 2024-01-05 00:59:29 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-01-05 00:59:45 -0500 |
commit | 9d15984ebb9dab26de18a5ed633f23ad869af48f (patch) | |
tree | 62e245ce8d07f36e22d18393d3cc862b1548d783 | |
parent | 6ee03a61e3d3070b9975655ee4fe525543ed979f (diff) | |
download | hcalc-9d15984ebb9dab26de18a5ed633f23ad869af48f.tar.gz |
Allow quit in error state, don't save bad value in config.
-rw-r--r-- | input.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -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); |