parsebindings() vs commas

The set-but-not-used warning for 'ret' revealed an actual bug this
time.  Parsing sysconf cares whether any errors were encountered
when parsing its contents, but BINDINGS=key1:cmd1,key2:cmd2 only
returned the result of the first key in the comma-separated list
because the result from recursive calls was lost to the set-but-
not-used variable.  Just adding use of that variable would have
ended up reporting success if any key bound succesfully rather than
requiring that they all do as sysconf parse handling intends.

Also, binding comma to a command required that it be specified by
its numeric value because parsing via recursion ate up the actual
commas.  Now allow "BINDINGS=,:cmd" or "keyM:cmdM,,:cmdN" or
"BINDINGS=\,:cmd" or "keyM:cmdM,\,:cmdN".

It also recognizes "BINDINGS=',':cmd" and "keyM:cmdM,',':cmdN" but
that yields an invalid key error for "','".  I thought txt2key()
supported that but it doesn't.  I've left this in because the error
about ',' not being recognized as a key seems better than one about
"'" not being a valid key bind and then accidentally binding single
quote via post-comma "':command".
This commit is contained in:
PatR
2022-01-08 12:32:49 -08:00
parent 1a493e12b5
commit 88d2c8ae24
2 changed files with 36 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.630 $ $NHDT-Date: 1629928191 2021/08/25 21:49:51 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.734 $ $NHDT-Date: 1641673963 2022/01/08 20:32:43 $
General Fixes and Modified Features
-----------------------------------
@@ -735,6 +735,9 @@ when one leg is wounded, have ^X report which (already used plural if both)
wand of probing used on steed ('z >') didn't include wounded leg(s) feedback
getting wounded in one leg when the other was already wounded miraculously
healed old leg and kept longer of their recovery timeouts for new one
when parsing config file entry "BINDINGS=key1:cmd1,key2:cmd2,key3:cmd3" allow
keyN to be either a naked comma or backslash+comma instead requiring
that comma's numeric value be used to bind comma to a command
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository