| 955 | } |
| 956 | |
| 957 | void NetHackQtBind::qt_getlin(const char *prompt, char *line) |
| 958 | { |
| 959 | NetHackQtStringRequestor requestor(mainWidget(),prompt); |
| 960 | if (!requestor.Get(line, BUFSZ, 40)) { |
| 961 | Strcpy(line, "\033"); |
| 962 | // discard any input that Get() might have left pending |
| 963 | keybuffer.Drain(); |
| 964 | } |
| 965 | |
| 966 | // add the prompt with appended response to the message window |
| 967 | char buf[BUFSZ + 20], *q; /* +20: plenty of extra room for visctrl() */ |
| 968 | copynchars(buf, prompt, BUFSZ - 1); |
| 969 | q = eos(buf); |
| 970 | *q++ = ' '; /* guaranteed to fit; temporary lack of terminator is ok */ |
| 971 | |
| 972 | if (line[0] == '\033') { |
| 973 | Strcpy(q, "ESC"); |
| 974 | } else if (line[0] == ' ' && !line[1]) { |
| 975 | Strcpy(q, "SPC"); |
| 976 | } else { |
| 977 | /* buf[] has more than enough room to hold one extra visctrl() |
| 978 | in case q is at the last viable slot and *p yields "M-^c" */ |
| 979 | for (char *p = line; *p && q < &buf[BUFSZ - 1]; ++p, q = eos(q)) |
| 980 | Strcpy(q, visctrl(*p)); |
| 981 | } |
| 982 | if (q > &buf[BUFSZ - 1]) |
| 983 | q = &buf[BUFSZ - 1]; |
| 984 | *q = '\0'; |
| 985 | |
| 986 | NetHackQtBind::qt_putstr(WIN_MESSAGE, ATR_BOLD, buf); |
| 987 | // unhighlight the prompt; does not erase the multi-line message window |
| 988 | NetHackQtBind::qt_clear_nhwindow(WIN_MESSAGE); |
| 989 | } |
| 990 | |
| 991 | // User has typed '#' to begin entering an extended command; core calls us. |
| 992 | int NetHackQtBind::qt_get_ext_cmd() |
nothing calls this directly
no test coverage detected