diff -Naurd ../nethack-3.4.0/win/tty/getline.c ./win/tty/getline.c --- ../nethack-3.4.0/win/tty/getline.c Wed Mar 20 23:44:18 2002 +++ ./win/tty/getline.c Mon Feb 24 15:25:05 2003 @@ -6,6 +6,10 @@ #ifdef TTY_GRAPHICS +#if !defined(MAC) +#define NEWAUTOCOMP +#endif + #include "wintty.h" #include "func_tab.h" @@ -59,7 +63,9 @@ Sprintf(toplines, "%s ", query); Strcat(toplines, obufp); if((c = Getchar()) == EOF) { +#ifndef NEWAUTOCOMP *bufp = 0; +#endif /* not NEWAUTOCOMP */ break; } if(c == '\033') { @@ -72,7 +78,7 @@ *bufp = 0; } if(c == '\020') { /* ctrl-P */ - if (iflags.prevmsg_window) { + if (iflags.prevmsg_window != 's') { int sav = ttyDisplay->inread; ttyDisplay->inread = 0; (void) tty_doprev_message(); @@ -90,7 +96,7 @@ doprev = 1; continue; } - } else if (doprev && !iflags.prevmsg_window) { + } else if (doprev && iflags.prevmsg_window == 's') { tty_clear_nhwindow(WIN_MESSAGE); cw->maxcol = cw->maxrow; doprev = 0; @@ -101,34 +107,68 @@ } if(c == erase_char || c == '\b') { if(bufp != obufp) { +#ifdef NEWAUTOCOMP + char *i; + +#endif /* NEWAUTOCOMP */ bufp--; +#ifndef NEWAUTOCOMP putsyms("\b \b");/* putsym converts \b */ +#else /* NEWAUTOCOMP */ + putsyms("\b"); + for (i = bufp; *i; ++i) putsyms(" "); + for (; i > bufp; --i) putsyms("\b"); + *bufp = 0; +#endif /* NEWAUTOCOMP */ } else tty_nhbell(); #if defined(apollo) } else if(c == '\n' || c == '\r') { #else } else if(c == '\n') { #endif +#ifndef NEWAUTOCOMP *bufp = 0; +#endif /* not NEWAUTOCOMP */ break; } else if(' ' <= (unsigned char) c && c != '\177' && (bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO)) { /* avoid isprint() - some people don't have it ' ' is not always a printing char */ +#ifdef NEWAUTOCOMP + char *i = eos(bufp); + +#endif /* NEWAUTOCOMP */ *bufp = c; bufp[1] = 0; putsyms(bufp); bufp++; if (hook && (*hook)(obufp)) { putsyms(bufp); +#ifndef NEWAUTOCOMP bufp = eos(bufp); +#else /* NEWAUTOCOMP */ + /* pointer and cursor left where they were */ + for (i = bufp; *i; ++i) putsyms("\b"); + } else if (i > bufp) { + char *s = i; + + /* erase rest of prior guess */ + for (; i > bufp; --i) putsyms(" "); + for (; s > bufp; --s) putsyms("\b"); +#endif /* NEWAUTOCOMP */ } } else if(c == kill_char || c == '\177') { /* Robert Viduya */ /* this test last - @ might be the kill_char */ +#ifndef NEWAUTOCOMP while(bufp != obufp) { bufp--; putsyms("\b \b"); } +#else /* NEWAUTOCOMP */ + for (; *bufp; ++bufp) putsyms(" "); + for (; bufp != obufp; --bufp) putsyms("\b \b"); + *bufp = 0; +#endif /* NEWAUTOCOMP */ } else tty_nhbell(); } @@ -214,6 +254,7 @@ #else hooked_tty_getlin("#", buf, ext_cmd_getlin_hook); #endif + (void) mungspaces(buf); if (buf[0] == 0 || buf[0] == '\033') return -1; for (i = 0; extcmdlist[i].ef_txt != (char *)0; i++) diff -Naurd ../nethack-3.4.0/win/tty/topl.c ./win/tty/topl.c --- ../nethack-3.4.0/win/tty/topl.c Wed Mar 20 23:44:19 2002 +++ ./win/tty/topl.c Mon Feb 24 15:25:05 2003 @@ -28,34 +28,91 @@ winid prevmsg_win; int i; + if ((iflags.prevmsg_window != 's') && !ttyDisplay->inread) { /* not single */ + if(iflags.prevmsg_window == 'f') { /* full */ + prevmsg_win = create_nhwindow(NHW_MENU); + putstr(prevmsg_win, 0, "Message History"); + putstr(prevmsg_win, 0, ""); + cw->maxcol = cw->maxrow; + i = cw->maxcol; + do { + if(cw->data[i] && strcmp(cw->data[i], "") ) + putstr(prevmsg_win, 0, cw->data[i]); + i = (i + 1) % cw->rows; + } while (i != cw->maxcol); + putstr(prevmsg_win, 0, toplines); + display_nhwindow(prevmsg_win, TRUE); + destroy_nhwindow(prevmsg_win); + } else if (iflags.prevmsg_window == 'c') { /* combination */ + do { + morc = 0; + if (cw->maxcol == cw->maxrow) { + ttyDisplay->dismiss_more = C('p'); /* allowed at --More-- */ + redotoplin(toplines); + cw->maxcol--; + if (cw->maxcol < 0) cw->maxcol = cw->rows-1; + if (!cw->data[cw->maxcol]) + cw->maxcol = cw->maxrow; + } else if (cw->maxcol == (cw->maxrow - 1)){ + ttyDisplay->dismiss_more = C('p'); /* allowed at --More-- */ + redotoplin(cw->data[cw->maxcol]); + cw->maxcol--; + if (cw->maxcol < 0) cw->maxcol = cw->rows-1; + if (!cw->data[cw->maxcol]) + cw->maxcol = cw->maxrow; + } else { + prevmsg_win = create_nhwindow(NHW_MENU); + putstr(prevmsg_win, 0, "Message History"); + putstr(prevmsg_win, 0, ""); + cw->maxcol = cw->maxrow; + i = cw->maxcol; + do { + if(cw->data[i] && strcmp(cw->data[i], "") ) + putstr(prevmsg_win, 0, cw->data[i]); + i = (i + 1) % cw->rows; + } while (i != cw->maxcol); + putstr(prevmsg_win, 0, toplines); + display_nhwindow(prevmsg_win, TRUE); + destroy_nhwindow(prevmsg_win); + } - if (iflags.prevmsg_window && !ttyDisplay->inread) { - prevmsg_win = create_nhwindow(NHW_MENU); - putstr(prevmsg_win, 0, "Message History"); - putstr(prevmsg_win, 0, ""); - i = cw->maxcol; - do { - if(cw->data[i] && strcmp(cw->data[i], "") ) - putstr(prevmsg_win, 0, cw->data[i]); - i = (i + 1) % cw->rows; - } while (i != cw->maxcol); - putstr(prevmsg_win, 0, toplines); - display_nhwindow(prevmsg_win, TRUE); - destroy_nhwindow(prevmsg_win); - } else { - ttyDisplay->dismiss_more = C('p'); /* allowed at --More-- */ - do { - morc = 0; - if (cw->maxcol == cw->maxrow) - redotoplin(toplines); - else if (cw->data[cw->maxcol]) - redotoplin(cw->data[cw->maxcol]); - cw->maxcol--; - if (cw->maxcol < 0) cw->maxcol = cw->rows-1; - if (!cw->data[cw->maxcol]) - cw->maxcol = cw->maxrow; - } while (morc == C('p')); - ttyDisplay->dismiss_more = 0; + } while (morc == C('p')); + ttyDisplay->dismiss_more = 0; + } else { /* reversed */ + morc = 0; + prevmsg_win = create_nhwindow(NHW_MENU); + putstr(prevmsg_win, 0, "Message History"); + putstr(prevmsg_win, 0, ""); + putstr(prevmsg_win, 0, toplines); + cw->maxcol=cw->maxrow-1; + if(cw->maxcol < 0) cw->maxcol = cw->rows-1; + do { + putstr(prevmsg_win, 0, cw->data[cw->maxcol]); + cw->maxcol--; + if (cw->maxcol < 0) cw->maxcol = cw->rows-1; + if (!cw->data[cw->maxcol]) + cw->maxcol = cw->maxrow; + } while (cw->maxcol != cw->maxrow); + + display_nhwindow(prevmsg_win, TRUE); + destroy_nhwindow(prevmsg_win); + cw->maxcol = cw->maxrow; + ttyDisplay->dismiss_more = 0; + } + } else if(iflags.prevmsg_window == 's') { /* single */ + ttyDisplay->dismiss_more = C('p'); /* allowed at --More-- */ + do { + morc = 0; + if (cw->maxcol == cw->maxrow) + redotoplin(toplines); + else if (cw->data[cw->maxcol]) + redotoplin(cw->data[cw->maxcol]); + cw->maxcol--; + if (cw->maxcol < 0) cw->maxcol = cw->rows-1; + if (!cw->data[cw->maxcol]) + cw->maxcol = cw->maxrow; + } while (morc == C('p')); + ttyDisplay->dismiss_more = 0; } return 0; } @@ -165,8 +222,7 @@ /* If there is room on the line, print message on same line */ /* But messages like "You die..." deserve their own line */ n0 = strlen(bp); - if( (ttyDisplay->toplin == 1 || - (cw->flags & WIN_STOP && iflags.prevmsg_window)) && + if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP)) && cw->cury == 0 && n0 + (int)strlen(toplines) + 3 < CO-8 && /* room for --More-- */ (notdied = strncmp(bp, "You die", 7))) { @@ -176,7 +232,7 @@ if(!(cw->flags & WIN_STOP)) addtopl(bp); return; - } else if (!(cw->flags & WIN_STOP && !iflags.prevmsg_window)) { + } else if (!(cw->flags & WIN_STOP)) { if(ttyDisplay->toplin == 1) more(); else if(cw->cury) { /* for when flags.toplin == 2 && cury > 1 */ docorner(1, cw->cury+1); /* reset cury = 0 if redraw screen */ @@ -299,7 +355,7 @@ do { /* loop until we get valid input */ q = lowc(readchar()); if (q == '\020') { /* ctrl-P */ - if (iflags.prevmsg_window) { + if (iflags.prevmsg_window != 's') { int sav = ttyDisplay->inread; ttyDisplay->inread = 0; (void) tty_doprev_message(); diff -Naurd ../nethack-3.4.0/win/tty/wintty.c ./win/tty/wintty.c --- ../nethack-3.4.0/win/tty/wintty.c Wed Mar 20 23:44:19 2002 +++ ./win/tty/wintty.c Mon Feb 24 15:25:05 2003 @@ -38,8 +38,6 @@ # endif #endif -#define DEBUG - extern char mapped_menu_cmds[]; /* from options.c */ /* Interface definition, for windows.c */ @@ -1148,7 +1152,10 @@ for (i = 0; i < SIZE(gcnt); i++) gcnt[i] = 0; for (n = 0, curr = cw->mlist; curr; curr = curr->next) - if (curr->gselector) ++n, ++gcnt[GSELIDX(curr->gselector)]; + if (curr->gselector && curr->gselector != curr->selector) { + ++n; + ++gcnt[GSELIDX(curr->gselector)]; + } if (n > 0) /* at least one group accelerator found */ for (rp = gacc, curr = cw->mlist; curr; curr = curr->next) @@ -1740,8 +1747,7 @@ } if(str == (const char*)0 || - ( (cw->flags & WIN_CANCELLED) && - (cw->type != NHW_MESSAGE || !iflags.prevmsg_window) )) + ((cw->flags & WIN_CANCELLED) && (cw->type != NHW_MESSAGE))) return; if(cw->type != NHW_MESSAGE) str = compress_str(str); @@ -2432,8 +2441,16 @@ #endif g_putch(ch); /* print the character */ - if (reverse_on) + if (reverse_on) { term_end_attr(ATR_INVERSE); +#ifdef TEXTCOLOR + /* turn off color as well, ATR_INVERSE may have done this already */ + if(ttyDisplay->color != NO_COLOR) { + term_end_color(); + ttyDisplay->color = NO_COLOR; + } +#endif + } wins[window]->curx++; /* one character over */ ttyDisplay->curx++; /* the real cursor moved too */