aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-01-05 00:59:29 -0500
committerB. Watson <urchlay@slackware.uk>2024-01-05 00:59:45 -0500
commit9d15984ebb9dab26de18a5ed633f23ad869af48f (patch)
tree62e245ce8d07f36e22d18393d3cc862b1548d783
parent6ee03a61e3d3070b9975655ee4fe525543ed979f (diff)
downloadhcalc-9d15984ebb9dab26de18a5ed633f23ad869af48f.tar.gz
Allow quit in error state, don't save bad value in config.
-rw-r--r--input.c24
1 files 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);