Qt message [un]highlighting

The Qt interface highlights the last message issued (using a
mechanism for selection, as if for copy+paste or similar operation)
but it was staying highlighted until another message was eventually
given.  Having an old message seem to stick around is annoying and
is particularly bad when the message is a prompt.  If the player's
answer doesn't cause a message to be shown then it seems as if the
prompt is still pending.

This removes the highlighting (by bulk unselecting) once the player
gives another input keystroke or mouse click.

It would be much better if the selecting/highlighting was for all
messages issued since last time highlighting was cleared.  Figuring
out how to do that correctly is more effort than I want to expend.
This commit is contained in:
PatR
2020-08-30 22:50:02 -07:00
parent 3cd21e1d4f
commit 1f953fa959
7 changed files with 76 additions and 28 deletions

View File

@@ -471,7 +471,7 @@ void NetHackQtBind::qt_raw_print_bold(const char *str)
int NetHackQtBind::qt_nhgetch()
{
if (main)
main->fadeHighlighting();
main->fadeHighlighting(true);
// Process events until a key arrives.
//
@@ -479,19 +479,28 @@ int NetHackQtBind::qt_nhgetch()
qApp->exec();
}
// after getting a key rather than before
if (main)
main->fadeHighlighting(false);
return keybuffer.GetAscii();
}
int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod)
{
if (main)
main->fadeHighlighting();
main->fadeHighlighting(true);
// Process events until a key or map-click arrives.
//
while (keybuffer.Empty() && clickbuffer.Empty()) {
qApp->exec();
}
// after getting a key or click rather than before
if (main)
main->fadeHighlighting(false);
if (!keybuffer.Empty()) {
return keybuffer.GetAscii();
} else {