From 8b7cbbdb0f274dd9e0e756cddaf352214fa1d885 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 17 Apr 2025 13:49:45 -0700 Subject: [PATCH] yn_function() band-aid If the yn_function() delivers its impossible about returning a result that isn't considered to be viable, put the prompt into paniclog. The updated comment contains my guess about what it going wrong, and I'm fairly sure it is correct. But I don't know how to fix it unless we change ^A to just repeat the last command without attempting to also repeat whatever followed. At the moment, users will occasionally get strange outcome from ^A. --- src/cmd.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 8273cfade..84fac12f5 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -5307,15 +5307,28 @@ yn_function( } #endif /* should not happen but cq.key has been observed to not obey 'resp'; - do this after dumplog has recorded the potentially bad value */ + it is most likely caused by saving a keystroke that was just used + to answer a context-sensitive prompt, then using the do-again + command with context that has changed */ if (resp && res && !strchr(resp, res)) { /* this probably needs refinement since caller is expecting something within 'resp' and ESC won't be (it could be present, but as a flag for unshown possibilities rather than as acceptable input) */ int altres = def ? def : '\033'; - impossible("yn_function() returned '%s'; using '%s' instead", - visctrl(res), visctrl(altres)); + if (!gi.in_doagain || wizard) { +/*TEMP*/ xint8 fuzzing = iflags.debug_fuzzer; + char dbg_buf[BUFSZ]; + + Snprintf(dbg_buf, sizeof dbg_buf, "%s [%s] (%s)", + query, resp ? resp : "", def ? visctrl(def) : ""); + paniclog("yn debug", dbg_buf); +/*TEMP*/ /* don't let this known problem kill the fuzzer */ +/*TEMP*/ iflags.debug_fuzzer = fuzzer_impossible_continue; + impossible("yn_function() returned '%s'; using '%s' instead", + visctrl(res), visctrl(altres)); +/*TEMP*/ iflags.debug_fuzzer = fuzzing; + } res = altres; } /* in case we're called via getdir() which sets input_state */