curses vs extended commands
Extend the earlier support for Delete/Rubout in getline() to the text entry for extended commands. In other words, treat <delete> and <backspace> as synonyms in both places. Some reformatting too, but only in a couple of the files.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.270 $ $NHDT-Date: 1551920371 2019/03/07 00:59:31 $
|
||||
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.271 $ $NHDT-Date: 1552254771 2019/03/10 21:52:51 $
|
||||
|
||||
This fixes36.2 file is here to capture information about updates in the 3.6.x
|
||||
lineage following the release of 3.6.1 in April 2018. Please note, however,
|
||||
@@ -477,6 +477,7 @@ curses: if the interface code ran out of memory, it would crash rather than
|
||||
curses: when getting multi-character responses from player, support <delete>
|
||||
as well as <backspace> to remove last character entered; also, return
|
||||
<escape> to core if ESC is typed when there is no input entered
|
||||
curses: extend preceding <delete> support to typing of extended command names
|
||||
vms: add compile of isaac64.c to Makefile.src and vmsbuild.com
|
||||
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@ static int menu_max_height(void);
|
||||
static nhmenu *nhmenus = NULL; /* NetHack menu array */
|
||||
|
||||
|
||||
/* Get a line of text from the player, such as asking for a character name or a wish */
|
||||
/* Get a line of text from the player, such as asking for a character name
|
||||
or a wish */
|
||||
|
||||
void
|
||||
curses_line_input_dialog(const char *prompt, char *answer, int buffer)
|
||||
@@ -333,7 +334,7 @@ curses_ext_cmd()
|
||||
if (iflags.extmenu) {
|
||||
return extcmd_via_menu();
|
||||
}
|
||||
|
||||
|
||||
startx = 0;
|
||||
starty = 0;
|
||||
if (iflags.wc_popup_dialog) { /* Prompt in popup window */
|
||||
@@ -341,9 +342,9 @@ curses_ext_cmd()
|
||||
extwin2 = curses_create_window(25, 1, UP);
|
||||
wrefresh(extwin2);
|
||||
/* create window inside window to prevent overwriting of border */
|
||||
getbegyx(extwin2,y0,x0);
|
||||
getmaxyx(extwin2,h,w);
|
||||
extwin = newwin(1, w-2, y0+1, x0+1);
|
||||
getbegyx(extwin2, y0, x0);
|
||||
getmaxyx(extwin2, h, w);
|
||||
extwin = newwin(1, w - 2, y0 + 1, x0 + 1);
|
||||
if (w - 4 < maxlen) maxlen = w - 4;
|
||||
} else {
|
||||
curses_get_window_xy(MESSAGE_WIN, &winx, &winy);
|
||||
@@ -355,8 +356,9 @@ curses_ext_cmd()
|
||||
}
|
||||
|
||||
winy += messageh - 1;
|
||||
extwin = newwin(1, messagew-2, winy, winx);
|
||||
if (messagew - 4 < maxlen) maxlen = messagew - 4;
|
||||
extwin = newwin(1, messagew - 2, winy, winx);
|
||||
if (messagew - 4 < maxlen)
|
||||
maxlen = messagew - 4;
|
||||
pline("#");
|
||||
}
|
||||
|
||||
@@ -390,7 +392,7 @@ curses_ext_cmd()
|
||||
break;
|
||||
}
|
||||
|
||||
if ((letter == '\r') || (letter == '\n')) {
|
||||
if (letter == '\r' || letter == '\n') {
|
||||
if (ret == -1) {
|
||||
for (count = 0; extcmdlist[count].ef_txt; count++) {
|
||||
if (!strcasecmp(cur_choice, extcmdlist[count].ef_txt)) {
|
||||
@@ -402,7 +404,9 @@ curses_ext_cmd()
|
||||
break;
|
||||
}
|
||||
|
||||
if ((letter == '\b') || (letter == KEY_BACKSPACE)) {
|
||||
if (letter == '\177') /* DEL/Rubout */
|
||||
letter = '\b';
|
||||
if (letter == '\b' || letter == KEY_BACKSPACE) {
|
||||
if (prompt_width == 0) {
|
||||
ret = -1;
|
||||
break;
|
||||
@@ -749,10 +753,9 @@ menu_get_accel(boolean first)
|
||||
|
||||
ret = next_letter;
|
||||
|
||||
if (((next_letter < 'z') && (next_letter >= 'a')) || ((next_letter < 'Z')
|
||||
&& (next_letter >=
|
||||
'A')) ||
|
||||
((next_letter < '9') && (next_letter >= '0'))) {
|
||||
if ((next_letter < 'z' && next_letter >= 'a')
|
||||
|| (next_letter < 'Z' && next_letter >= 'A')
|
||||
|| (next_letter < '9' && next_letter >= '0')) {
|
||||
next_letter++;
|
||||
} else if (next_letter == 'z') {
|
||||
next_letter = 'A';
|
||||
@@ -789,8 +792,8 @@ menu_is_multipage(nhmenu *menu, int width, int height)
|
||||
menu_item_ptr->num_lines = num_lines;
|
||||
curline += num_lines;
|
||||
menu_item_ptr = menu_item_ptr->next_item;
|
||||
if ((curline > height) || ((curline > height - 2) &&
|
||||
(height == menu_max_height()))) {
|
||||
if (curline > height
|
||||
|| (curline > height - 2 && height == menu_max_height())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -895,7 +898,7 @@ menu_win_size(nhmenu *menu)
|
||||
menu_item_ptr = menu_item_ptr->next_item;
|
||||
}
|
||||
|
||||
/* If the widest entry is smaller than maxwidth, reduce maxwidth accordingly */
|
||||
/* If widest entry is smaller than maxwidth, reduce maxwidth accordingly */
|
||||
if (maxentrywidth < maxwidth) {
|
||||
maxwidth = maxentrywidth;
|
||||
}
|
||||
@@ -922,7 +925,7 @@ menu_win_size(nhmenu *menu)
|
||||
if (lastline < maxheight) {
|
||||
maxheight = lastline;
|
||||
}
|
||||
} else { /* If multipage, make sure we have enough width for page footer */
|
||||
} else { /* If multipage, make sure we have enough width for page footer */
|
||||
|
||||
if (width < 20) {
|
||||
width = 20;
|
||||
@@ -1218,8 +1221,8 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
|
||||
menu_item_ptr = menu->entries;
|
||||
|
||||
while (menu_item_ptr != NULL) {
|
||||
if ((menu_item_ptr->identifier.a_void != NULL) &&
|
||||
(strstri(menu_item_ptr->str, search_key))) {
|
||||
if (menu_item_ptr->identifier.a_void != NULL
|
||||
&& strstri(menu_item_ptr->str, search_key)) {
|
||||
if (how == PICK_ONE) {
|
||||
menu_clear_selections(menu);
|
||||
menu_select_deselect(win, menu_item_ptr, SELECT);
|
||||
@@ -1247,12 +1250,11 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
|
||||
menu_item_ptr = menu->entries;
|
||||
while (menu_item_ptr != NULL) {
|
||||
if (menu_item_ptr->identifier.a_void != NULL) {
|
||||
if (((curletter == menu_item_ptr->accelerator) &&
|
||||
((curpage == menu_item_ptr->page_num) ||
|
||||
(!menu->reuse_accels))) || ((menu_item_ptr->group_accel)
|
||||
&& (curletter ==
|
||||
menu_item_ptr->
|
||||
group_accel))) {
|
||||
if ((curletter == menu_item_ptr->accelerator
|
||||
&& (curpage == menu_item_ptr->page_num
|
||||
|| !menu->reuse_accels))
|
||||
|| (menu_item_ptr->group_accel
|
||||
&& curletter == menu_item_ptr->group_accel)) {
|
||||
if (curpage != menu_item_ptr->page_num) {
|
||||
curpage = menu_item_ptr->page_num;
|
||||
menu_display_page(menu, win, curpage);
|
||||
@@ -1266,7 +1268,7 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
|
||||
num_selected = 1;
|
||||
dismiss = TRUE;
|
||||
break;
|
||||
} else if ((how == PICK_ANY) && (curletter == count_letter)) {
|
||||
} else if (how == PICK_ANY && curletter == count_letter) {
|
||||
menu_select_deselect(win, menu_item_ptr, SELECT);
|
||||
menu_item_ptr->count = count;
|
||||
count = 0;
|
||||
@@ -1280,7 +1282,7 @@ menu_get_selections(WINDOW * win, nhmenu *menu, int how)
|
||||
}
|
||||
}
|
||||
|
||||
if ((how == PICK_ANY) && (num_selected != -1)) {
|
||||
if (how == PICK_ANY && num_selected != -1) {
|
||||
num_selected = 0;
|
||||
menu_item_ptr = menu->entries;
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@ struct window_procs curses_procs = {
|
||||
/*
|
||||
* Global variables for curses interface
|
||||
*/
|
||||
|
||||
|
||||
int term_rows, term_cols; /* size of underlying terminal */
|
||||
int orig_cursor; /* Preserve initial cursor state */
|
||||
int orig_cursor; /* Preserve initial cursor state */
|
||||
WINDOW *base_term; /* underlying terminal window */
|
||||
boolean counting; /* Count window is active */
|
||||
WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */
|
||||
@@ -96,7 +96,7 @@ WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */
|
||||
the inventory window. */
|
||||
static int inv_update = 0;
|
||||
|
||||
/*
|
||||
/*
|
||||
init_nhwindows(int* argcp, char** argv)
|
||||
-- Initialize the windows used by NetHack. This can also
|
||||
create the standard windows listed at the top, but does
|
||||
@@ -264,7 +264,7 @@ curses_resume_nhwindows()
|
||||
curses_refresh_nethack_windows();
|
||||
}
|
||||
|
||||
/* Create a window of type "type" which can be
|
||||
/* Create a window of type "type" which can be
|
||||
NHW_MESSAGE (top line)
|
||||
NHW_STATUS (bottom lines)
|
||||
NHW_MAP (main dungeon)
|
||||
@@ -307,6 +307,7 @@ void
|
||||
curses_display_nhwindow(winid wid, BOOLEAN_P block)
|
||||
{
|
||||
menu_item *selected = NULL;
|
||||
|
||||
if (curses_is_menu(wid) || curses_is_text(wid)) {
|
||||
curses_end_menu(wid, "");
|
||||
curses_select_menu(wid, PICK_NONE, &selected);
|
||||
@@ -314,9 +315,9 @@ curses_display_nhwindow(winid wid, BOOLEAN_P block)
|
||||
}
|
||||
|
||||
/* don't overwrite the splash screen first time through */
|
||||
if (!iflags.window_inited && wid == MAP_WIN)
|
||||
if (!iflags.window_inited && wid == MAP_WIN) {
|
||||
iflags.window_inited = TRUE;
|
||||
else {
|
||||
} else {
|
||||
/* actually display the window */
|
||||
wnoutrefresh(curses_get_nhwin(wid));
|
||||
/* flush pending writes from other windows too */
|
||||
@@ -332,7 +333,7 @@ curses_display_nhwindow(winid wid, BOOLEAN_P block)
|
||||
}
|
||||
|
||||
|
||||
/* Destroy will dismiss the window if the window has not
|
||||
/* Destroy will dismiss the window if the window has not
|
||||
* already been dismissed.
|
||||
*/
|
||||
void
|
||||
@@ -586,7 +587,7 @@ print_glyph(window, x, y, glyph, bkglyph)
|
||||
port wants (symbol, font, color, attributes, ...there's
|
||||
a 1-1 map between glyphs and distinct things on the map).
|
||||
bkglyph is to render the background behind the glyph.
|
||||
It's not used here.
|
||||
It's not used here.
|
||||
*/
|
||||
void
|
||||
curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
|
||||
@@ -679,8 +680,8 @@ int nh_poskey(int *x, int *y, int *mod)
|
||||
a position in the MAP window is returned in x, y and mod.
|
||||
mod may be one of
|
||||
|
||||
CLICK_1 -- mouse click type 1
|
||||
CLICK_2 -- mouse click type 2
|
||||
CLICK_1 -- mouse click type 1
|
||||
CLICK_2 -- mouse click type 2
|
||||
|
||||
The different click types can map to whatever the
|
||||
hardware supports. If no mouse is supported, this
|
||||
@@ -841,14 +842,14 @@ preference_update(preference)
|
||||
port of that change. If your window-port is capable of
|
||||
dynamically adjusting to the change then it should do so.
|
||||
Your window-port will only be notified of a particular
|
||||
change if it indicated that it wants to be by setting the
|
||||
change if it indicated that it wants to be by setting the
|
||||
corresponding bit in the wincap mask.
|
||||
*/
|
||||
void
|
||||
curses_preference_update(const char *pref)
|
||||
{
|
||||
if ((strcmp(pref, "align_status") == 0) ||
|
||||
(strcmp(pref, "align_message") == 0)) {
|
||||
if (!strcmp(pref, "align_status")
|
||||
|| !strcmp(pref, "align_message")) {
|
||||
curses_create_main_windows();
|
||||
curses_last_messages();
|
||||
doredraw();
|
||||
|
||||
Reference in New Issue
Block a user