Compile-time option to allow some prompts remember the input

Define EDIT_GETLIN to make the tty, X11, and Qt4 windowports to
remember the input strings for wishing and annotation.
This commit is contained in:
Pasi Kallinen
2018-03-26 22:58:28 +03:00
parent 66e50aeeac
commit 94ad7512a6
23 changed files with 55 additions and 29 deletions

View File

@@ -83,6 +83,9 @@ bool NetHackQtStringRequestor::Get(char* buffer, int maxchar)
resize(fontMetrics().width(prompt.text())*2+50,fontMetrics().height()*4);
}
#ifdef EDIT_GETLIN
input.setText(buffer);
#endif
centerOnMain(this);
show();
input.setFocus();

View File

@@ -1623,7 +1623,11 @@ char *input;
slide left hiding some chars at the beginning of the response but
making room to type more. [Prior to 3.6.1, width wasn't specifiable
and answer box always got sized to match the width of the prompt.] */
#ifdef EDIT_GETLIN
SetDialogResponse(getline_dialog, input, 60); /* set default answer */
#else
SetDialogResponse(getline_dialog, nhStr(""), 60); /* set default answer */
#endif
positionpopup(getline_popup, TRUE); /* center,bottom */
nh_XtPopup(getline_popup, (int) XtGrabExclusive, getline_dialog);

View File

@@ -56,8 +56,13 @@ getlin_hook_proc hook;
cw->flags &= ~WIN_STOP;
ttyDisplay->toplin = 3; /* special prompt state */
ttyDisplay->inread++;
#ifdef EDIT_GETLIN
custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s %s", query, bufp);
bufp = eos(obufp);
#else
custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s ", query);
*obufp = 0;
#endif
for (;;) {
(void) fflush(stdout);
Strcat(strcat(strcpy(toplines, query), " "), obufp);