Merge branch 'NetHack-3.6'
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
#define strncasecmp strncmpi
|
||||
#endif
|
||||
|
||||
/* defined in sys/<foo>/<foo>tty.c or cursmain.c as last resort;
|
||||
set up by curses_init_nhwindows() */
|
||||
extern char erase_char, kill_char;
|
||||
|
||||
/*
|
||||
* Note:
|
||||
*
|
||||
@@ -412,7 +416,7 @@ curses_ext_cmd()
|
||||
wmove(extwin, starty, startx + 2);
|
||||
waddstr(extwin, cur_choice);
|
||||
wmove(extwin, starty, (int) strlen(cur_choice) + startx + 2);
|
||||
wprintw(extwin, " ");
|
||||
wclrtoeol(extwin);
|
||||
|
||||
/* if we have an autocomplete command, AND it matches uniquely */
|
||||
if (matches == 1) {
|
||||
@@ -421,12 +425,12 @@ curses_ext_cmd()
|
||||
wprintw(extwin, "%s",
|
||||
extcmdlist[ret].ef_txt + (int) strlen(cur_choice));
|
||||
curses_toggle_color_attr(extwin, NONE, A_UNDERLINE, OFF);
|
||||
mvwprintw(extwin, starty,
|
||||
(int) strlen(extcmdlist[ret].ef_txt) + 2, " ");
|
||||
}
|
||||
|
||||
curs_set(1);
|
||||
wrefresh(extwin);
|
||||
letter = getch();
|
||||
curs_set(0);
|
||||
prompt_width = (int) strlen(cur_choice);
|
||||
matches = 0;
|
||||
|
||||
@@ -448,8 +452,9 @@ curses_ext_cmd()
|
||||
}
|
||||
|
||||
if (letter == '\177') /* DEL/Rubout */
|
||||
letter = '\b';
|
||||
if (letter == '\b' || letter == KEY_BACKSPACE) {
|
||||
letter = '\b';
|
||||
if (letter == '\b' || letter == KEY_BACKSPACE
|
||||
|| (erase_char && letter == (int) (uchar) erase_char)) {
|
||||
if (prompt_width == 0) {
|
||||
ret = -1;
|
||||
break;
|
||||
@@ -458,7 +463,15 @@ curses_ext_cmd()
|
||||
letter = '*';
|
||||
prompt_width--;
|
||||
}
|
||||
|
||||
/* honor kill_char if it's ^U or similar, but not if it's '@' */
|
||||
} else if (kill_char && letter == (int) (uchar) kill_char
|
||||
&& (letter < ' ' || letter >= '\177')) { /*ASCII*/
|
||||
cur_choice[0] = '\0';
|
||||
letter = '*';
|
||||
prompt_width = 0;
|
||||
}
|
||||
|
||||
if (letter != '*' && prompt_width < maxlen) {
|
||||
cur_choice[prompt_width] = letter;
|
||||
cur_choice[prompt_width + 1] = '\0';
|
||||
@@ -486,7 +499,8 @@ curses_ext_cmd()
|
||||
}
|
||||
|
||||
curses_destroy_win(extwin);
|
||||
if (extwin2) curses_destroy_win(extwin2);
|
||||
if (extwin2)
|
||||
curses_destroy_win(extwin2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user