Two things: 1. This patch causes the window placement of the main window to be written to the registry, and to be restored upon the next start of the program. I had to move the creation of the main window to init_nhwindows, as the registry is not read until then. 2. Implement support for wc_popup_dialog (or rather, support for not having popup windows.) It asks getlin questions and get_ext_cmd on the message window, much like the TTY port does it. The get_ext_cmd procedure is almost but not quite the same as the one for TTY, and I think it is better: It autocompletes the extended command you type, but if you keep on typing it doesn't add those letters after the completed command, but just keeps track of how many (correct) characters you typed. If you type a different character than the autocompleted command has, it shows you what you typed again. If you press backspace, it deletes the characters you typed, and if autocompletion is no longer possible, it removes the autocompleted part. The effect of this is that you can type as many letters as you want when typing an extended command, as long as it is enough to identify one command; and you only have to delete the characters you actually typed if you made a mistake. I think autocompletion is a lot less obtrusive this way. Some notes about the patch: - Both mswin_getlin and mswin_get_ext_cmd now have two versions, with and without a popup. - yn_question was changed so that it displays a caret, which is a lot nicer IMHO. - I had to implement a new NetHack Windows Message parameter, "MSNH_MSG_CARET", to make it possible to show and hide the caret in the message window. Normally the caret is created and destroyed by the window that owns it, but in NetHack the input focus is always on the main window, while the caret is in the message window, which happens to be the only one that knows how large the caret should be. - mswin_putstr_ex's last parameter changed from boolean to int; the semantics are enhanced so that a negative last parameter means "delete that many characters from the input line". The string to be deleted is passed in as well, although it is currently not used. - A rather large chunk of code finds out where the last string that was displayed on the message window ended. This is necessary to place the caret at the right spot. The caret is always positioned there, even if it is hidden or non-existing. - mswin_get_nh_event was changed to actually process and empty the message queue, and called from mswin_putstr_ex to make sure the message window is updated before the next step is done. Without this, the caret is positioned before the last message is painted, which makes its x-position after the last character of the previous line.
1.4 KiB
1.4 KiB