Qt popup dialog input vs '&'

I'm not sure whether any yn_function() calls include ampersand
in the list of acceptable choices but if any did, the button
for that character would have shown up blank.  (Clicking on it
would have successfully produced '&' as player's input though.)
This commit is contained in:
PatR
2020-10-26 12:44:40 -07:00
parent ec5772d6d2
commit 9c384ba867
2 changed files with 13 additions and 1 deletions

View File

@@ -246,6 +246,17 @@ char NetHackQtYnDialog::Exec()
case '\033': // won't happen; ESC is hidden
button_name = "Esc";
break;
case '&':
// ampersand is used as a hidden quote char to flag
// next character as a keyboard shortcut associated
// with the current action--that's inappropriate here;
// two consecutive ampersands are needed to display
// one in a button label; first check whether caller
// has already done that, skip this one if so
if (i > 0 && ch[i - 1].cell() == QChar('&'))
continue; // next i
button_name = "&&";
break;
}
}
button=new QPushButton(button_name);