From 747981d0c5e69fa60952e977d1576d96aaaef58d Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 15 Jun 2019 07:18:47 -0700 Subject: [PATCH 1/2] take two: tty bug with long 'autodescribe' text Messages on tty which bypass message history weren't handling long lines properly. If the text wrapped to line 2, that continuation portion was left on the screen after whatever operation that put it here was finished. (To reproduce: assign a long name to a monster with a long type name so that the combined length exceeds the display width, then move the cursor over it with ';' or '/' while autodescribe is On.) This time prompting isn't adversely affected. --- doc/fixes36.3 | 5 ++++- win/tty/topl.c | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index c7c3be730..e9c64571c 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.54 $ $NHDT-Date: 1560600663 2019/06/15 12:11:03 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.55 $ $NHDT-Date: 1560608320 2019/06/15 14:18:40 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -132,6 +132,9 @@ tty: re-do one optimization used when status conditions have all been removed and remove another that tried to check whether condition text to be displayed next was the same as the existing value; sometimes new status condition wouldn't be shown unless a screen redraw was forced +tty: take two, if/when autodecribe feedback wraps past top line, clear + continuation lines and redraw map if needed when top line is cleared + ['exposed by git' section has an entry for reversal of 'take one'] Windows: some startup error messages were not being delivered successfully diff --git a/win/tty/topl.c b/win/tty/topl.c index ba21797a7..62fb3eb53 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 topl.c $NHDT-Date: 1560600658 2019/06/15 12:10:58 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.46 $ */ +/* NetHack 3.6 topl.c $NHDT-Date: 1560608320 2019/06/15 14:18:40 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.47 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -151,15 +151,16 @@ const char *str; struct WinDesc *cw = wins[WIN_MESSAGE]; if (!(cw->flags & WIN_STOP)) { + if (ttyDisplay->cury && ttyDisplay->toplin == 2) + tty_clear_nhwindow(WIN_MESSAGE); + cw->curx = cw->cury = 0; home(); cl_end(); addtopl(str); -#if 0 /* this doesn't work as intended; it disrupts multi-line prompts */ if (ttyDisplay->cury && ttyDisplay->toplin != 3) - more(); -#endif + ttyDisplay->toplin = 2; } } From 820320ba55a4db0dd6f962f416231393dd1fbf0f Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 15 Jun 2019 08:19:32 -0700 Subject: [PATCH 2/2] EDIT_GETLIN when naming monsters and objects Like #annotate, #name monster, #name individual object, and #name object type are places where it makes some sense to have an existing name be the default for the new name, in case taking off from the end and/or adding to the end is more convenient than retyping everything. When there is an existing name used as default, clearing that default and hitting is not enough to remove the name, you still need to 'assign a new name' of to do that. --- doc/fixes36.3 | 4 +++- src/do_name.c | 29 +++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index e9c64571c..1dc12edd1 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.55 $ $NHDT-Date: 1560608320 2019/06/15 14:18:40 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.56 $ $NHDT-Date: 1560611967 2019/06/15 15:19:27 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -100,6 +100,8 @@ Platform- and/or Interface-Specific Fixes or Features EDIT_GETLIN: wizard mode 'monpolycontrol' was using the getlin() answer buffer to format the coordinate portion of the "change @ into what kind of monster?" prompt, resulting in "" as default answer +EDIT_GETLIN: when naming an object or a monster use the existing name, if + there is one, as the default answer curses: very tall menus tried to use selector characters a-z, A-Z, and 0-9, but 0-9 should be reserved for counts and if the display was tall enough for more than 62 entries, arbitrary ASCII punctuation got used diff --git a/src/do_name.c b/src/do_name.c index 5d048e23d..999fe2055 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_name.c $NHDT-Date: 1560387831 2019/06/13 01:03:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.148 $ */ +/* NetHack 3.6 do_name.c $NHDT-Date: 1560611967 2019/06/15 15:19:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1159,6 +1159,11 @@ do_mname() Sprintf(qbuf, "What do you want to call %s?", distant_monnam(mtmp, ARTICLE_THE, monnambuf)); buf[0] = '\0'; +#ifdef EDIT_GETLIN + /* if there's an existing name, make it be the default answer */ + if (has_mname(mtmp)) + Strcpy(buf, MNAME(mtmp)); +#endif getlin(qbuf, buf); if (!*buf || *buf == '\033') return; @@ -1171,6 +1176,9 @@ do_mname() * * Don't say the name is being rejected if it happens to match * the existing name. + * + * TODO: should have an alternate message when the attempt is to + * remove existing name without assigning a new one. */ if ((mtmp->data->geno & G_UNIQ) && !mtmp->ispriest) { if (!alreadynamed(mtmp, monnambuf, buf)) @@ -1199,7 +1207,7 @@ void do_oname(obj) register struct obj *obj; { - char *bufp, buf[BUFSZ] = DUMMY, bufcpy[BUFSZ], qbuf[QBUFSZ]; + char *bufp, buf[BUFSZ], bufcpy[BUFSZ], qbuf[QBUFSZ]; const char *aname; short objtyp; @@ -1212,6 +1220,12 @@ register struct obj *obj; Sprintf(qbuf, "What do you want to name %s ", is_plural(obj) ? "these" : "this"); (void) safe_qbuf(qbuf, qbuf, "?", obj, xname, simpleonames, "item"); + buf[0] = '\0'; +#ifdef EDIT_GETLIN + /* if there's an existing name, make it be the default answer */ + if (has_oname(obj)) + Strcpy(buf, ONAME(obj)); +#endif getlin(qbuf, buf); if (!*buf || *buf == '\033') return; @@ -1454,7 +1468,7 @@ void docall(obj) struct obj *obj; { - char buf[BUFSZ] = DUMMY, qbuf[QBUFSZ]; + char buf[BUFSZ], qbuf[QBUFSZ]; char **str1; if (!obj->dknown) @@ -1467,12 +1481,19 @@ struct obj *obj; else (void) safe_qbuf(qbuf, "Call ", ":", obj, docall_xname, simpleonames, "thing"); + /* pointer to old name */ + str1 = &(objects[obj->otyp].oc_uname); + buf[0] = '\0'; +#ifdef EDIT_GETLIN + /* if there's an existing name, make it be the default answer */ + if (*str1) + Strcpy(buf, *str1); +#endif getlin(qbuf, buf); if (!*buf || *buf == '\033') return; /* clear old name */ - str1 = &(objects[obj->otyp].oc_uname); if (*str1) free((genericptr_t) *str1);