![]() |
#1 |
Veteran
Join Date: Jun 2007
Posts: 1,372
![]() |
[3.4.0] Bug with parsing empty keymaps
There's a bug in the prefs parsing in 3.4.0 related to keymaps which map a key to (nothing). That is, if you do this:
Code:
1. "Create keymap" 2. Press some key (doesn't matter which, really) 3. Type "$" to terminate the keymap 4. Press "y" to save the keymap Here's a patch which fixes it, can this please be added before 3.5.x (or even 3.4.1 if that ever happens)? Code:
diff --git a/src/prefs.c b/src/prefs.c index 0c486df..116d7e0 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -864,13 +864,15 @@ static enum parser_error parse_prefs_b(struct parser *p) static enum parser_error parse_prefs_a(struct parser *p) { - const char *act; + const char *act = ""; struct prefs_data *d = parser_priv(p); assert(d != NULL); if (d->bypass) return PARSE_ERROR_NONE; - act = parser_getstr(p, "act"); + if (parser_hasval(p, "act")) { + act = parser_getstr(p, "act"); + } keypress_from_text(d->keymap_buffer, N_ELEMENTS(d->keymap_buffer), act); return PARSE_ERROR_NONE; @@ -1022,7 +1024,7 @@ static struct parser *init_parse_prefs(bool user) /* XXX should be split into two kinds of line */ parser_reg(p, "B uint idx str text", parse_prefs_b); /* XXX idx should be {tval,sval} pair! */ - parser_reg(p, "A str act", parse_prefs_a); + parser_reg(p, "A ?str act", parse_prefs_a); parser_reg(p, "C int mode str key", parse_prefs_c); parser_reg(p, "M int type sym attr", parse_prefs_m); parser_reg(p, "V uint idx int k int r int g int b", parse_prefs_v); |
![]() |
![]() |
![]() |
#2 |
Angband Devteam member
|
Excellent spot, thanks - logged as #1683.
__________________
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila |
![]() |
![]() |
![]() |
#3 |
Prophet
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,023
![]() |
Thanks, we'll try to get this in for 3.4.1 We've been fixing some minor bugs behind the scenes, and we'll probably get 3.4.1 out after the competition is over.
|
![]() |
![]() |
![]() |
#4 | |
Veteran
Join Date: Jun 2007
Posts: 1,372
![]() |
Quote:
(Btw, the reason this is quite important to me is that I use empty keymaps to rebind Return/Enter to do nothing so that I can avoid the in-game action menu when going through messages using those keys.) |
|
![]() |
![]() |
![]() |
#5 |
Angband Devteam member
|
Given that we have an FAQ which advises precisely this ("How do I turn off that annoying Enter menu?", or something like that), it's probably a good idea that we un-break it.
__________________
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila |
![]() |
![]() |
![]() |
#6 |
Prophet
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,023
![]() |
I actually could not reproduce the incorrect behavior on the Windows7 build. Nevertheless, I've checked your patch and it works also. So I've sent a pull request for it. Hopefully someone can test it out and we can put it in 3.4.1.
|
![]() |
![]() |
![]() |
#7 |
Veteran
Join Date: Jun 2007
Posts: 1,372
![]() |
Wow. That's weird -- I wouldn't think that this has any sort of platform-dependence... but perhaps there's an extra "\r" in the .pref file (on Windows)? This would probably be enough to convince the parser that there's actual content there?
|
![]() |
![]() |
![]() |
#8 | |
Prophet
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,023
![]() |
Quote:
edit: The nightlies build on rephial should be updated by now as well. Last edited by fizzix; October 6, 2012 at 23:45. |
|
![]() |
![]() |
![]() |
#9 |
Veteran
Join Date: Jun 2007
Posts: 1,372
![]() |
Well, the github patch looks exactly identical to mine and I've been running master + my patch for a few days, so it should be hunky-dory.
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keymaps can't do what I want them to... | Tobias | Vanilla | 1 | August 1, 2011 17:41 |
Bug: cannot stop editing keymaps | jens | Development | 1 | June 20, 2011 17:19 |
Keymaps for the Macro User? | Chud | Vanilla | 2 | June 11, 2011 20:52 |
macros => keymaps | jens | Vanilla | 2 | May 19, 2011 03:43 |
Empty minded monsters are suspectible to the nether attack | Ycombinator | Vanilla | 2 | September 15, 2010 17:56 |