fix #K3934 - curses menu bug when entering count
Entering a multi-digit count when selecting from a menu in the curses interface causes the menu to disappear. Report was about putting a large subset of an object stack into a container but the bug affected all menus that accepted counts. curses_get_count() was changed to call core's get_count() quite a while back. get_count() calls mark_synch() when more that one digit is typed or when backspace to remove the first digit occurs. curses_mark_synch() had been a no-op but more recently it was changed to try to make sure that the screen was up to date. But it did that by refreshing the persistent windows, making any temporary popup menu or text window become hidden. Also, the count-in-progress is being sent to the message window with the no-history flag, so refreshing the message window removed that too. Switch curses_mark_synch() to use the basic screen refresh call that doesn't do anything window-specific. This also changes menu count handling to have get_count() echo the number starting with the first digit instead of waiting until the second. If anything in the menu makes it be very wide it can cover up the message window and any count being echoed there won't be visible. I'm not going to try to figure out how to deal with that; it isn't all that different from the old single-digit/unseen-count behavior.
This commit is contained in:
@@ -751,7 +751,11 @@ mark_synch() -- Don't go beyond this point in I/O on any channel until
|
||||
void
|
||||
curses_mark_synch(void)
|
||||
{
|
||||
curses_refresh_nethack_windows();
|
||||
/* full refresh has unintended side-effect of making a menu window
|
||||
that has called core's get_count() to vanish; do a basic screen
|
||||
refresh instead */
|
||||
/*curses_refresh_nethack_windows();*/
|
||||
refresh();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -712,11 +712,11 @@ curses_get_count(int first_digit)
|
||||
curses's message window will display that in count window instead */
|
||||
current_char = get_count(NULL, (char) first_digit,
|
||||
/* 0L => no limit on value unless it wraps
|
||||
to negative */
|
||||
* to negative */
|
||||
0L, ¤t_count,
|
||||
/* default: don't put into message history,
|
||||
don't echo until second digit entered */
|
||||
GC_NOFLAGS);
|
||||
/* don't put into message history, echo full
|
||||
* number rather than waiting until 2nd digit */
|
||||
GC_ECHOFIRST);
|
||||
|
||||
ungetch(current_char);
|
||||
if (current_char == '\033') { /* Cancelled with escape */
|
||||
|
||||
Reference in New Issue
Block a user