tty statuslines:3

Implement the 'statuslines' option for tty.  2 and 3 line status are
similar to curses.  Tty's version doesn't include insertion of extra
spaces for enhanced readability, or ignoring 'showexp' when space is
needed for other fields, or right justifying 'score' and suppressing
it when there isn't room for the entire number.  It continues to have
abbreviated condition and encumbrance descriptions that curses lacks
which get used when the normal ones take up too much space.

'statuslines' can be set with 'O' so it is feasible to switch back
and forth between 2 and 3 lines on the fly.  But only if the display
is at least 25 lines (actually ROWNO+4) or else CLIPPING is enabled
at build time.

This fixes the bug where after resorting to abbreviated condition
values it sometimes (always?) wouldn't switch back after more room
became available.  Abbreviated encumbrance values had problems too
(lack of leading space and not changing value if encumbrance changed
to anything other than unencumbered) and this fixes that as well.
This commit is contained in:
PatR
2019-03-29 04:21:18 -07:00
parent 0597eeebe9
commit d1dade164e
7 changed files with 412 additions and 329 deletions

View File

@@ -1,4 +1,4 @@
.\" $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.301 $ $NHDT-Date: 1553480404 2019/03/25 02:20:04 $
.\" $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.302 $ $NHDT-Date: 1553858473 2019/03/29 11:21:13 $
.\"
.\" This is an excerpt from the 'roff' man page from the 'groff' package.
.\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines.
@@ -3657,7 +3657,7 @@ up (default yes).
.lp statuslines
Number of lines for traditional below-the-map status display.
Acceptable values are 2 and 3 (default is 2).
Curses interface only.
Curses and tty interfaces only.
.lp "term_cols\ \ \fIand\fP"
.lp term_rows
Curses interface only.

View File

@@ -4057,7 +4057,7 @@ it starts up (default yes).
\item[\ib{statuslines}]
Number of lines for traditional below-the-map status display.
Acceptable values are 2 and 3 (default is 2).
Curses interface only.
Curses and tty interfaces only.
%.lp
\item[\ib{term\verb+_+cols}\ \ {\it and}]"
%.lp

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.286 $ $NHDT-Date: 1553787633 2019/03/28 15:40:33 $
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.287 $ $NHDT-Date: 1553858472 2019/03/29 11:21:12 $
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,
@@ -653,6 +653,8 @@ curses: status display substantially revamped for both horizontal (via
'align_status:bottom' or 'top') and vertical (via 'align_status:left'
or 'right'); 3-line horizontal layout (via 'statuslines:3') added
curses: support msg_window:full; default is still msg_window:reversed
tty: support statuslines:3 and dynamically switching between 2 and 3 with 'O'
(requires a display with at least 25 lines or that CLIPPING be enabled)
NetHack Community Patches (or Variation) Included

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.h $NHDT-Date: 1549327485 2019/02/05 00:44:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.32 $ */
/* NetHack 3.6 wintty.h $NHDT-Date: 1553858470 2019/03/29 11:21:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ */
/* Copyright (c) David Cohrs, 1991,1992 */
/* NetHack may be freely redistributed. See license for details. */
@@ -79,7 +79,7 @@ struct tty_status_fields {
boolean valid;
boolean dirty;
boolean redraw;
boolean last_on_row;
boolean _not_used; /* was 'last_in_row' */
};
#endif
@@ -151,6 +151,7 @@ E void NDECL(cl_eos);
* a color or whatever. wintty.c should concern itself with WHERE to put
* stuff in a window.
*/
E int FDECL(term_attr_fixup, (int));
E void FDECL(term_start_attr, (int attr));
E void FDECL(term_end_attr, (int attr));
E void NDECL(term_start_raw_bold);
@@ -182,6 +183,7 @@ E void FDECL(win_tty_init, (int));
/* external declarations */
E void FDECL(tty_init_nhwindows, (int *, char **));
E void FDECL(tty_preference_update, (const char *));
E void NDECL(tty_player_selection);
E void NDECL(tty_askname);
E void NDECL(tty_get_nh_event);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1553480404 2019/03/25 02:20:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.360 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1553858470 2019/03/29 11:21:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.361 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -385,20 +385,23 @@ static struct Comp_Opt {
#ifdef MSDOS
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE },
#endif
#ifdef STATUS_HILITES
{ "statushilites",
#ifdef STATUS_HILITES
"0=no status highlighting, N=show highlights for N turns",
20, SET_IN_GAME },
20, SET_IN_GAME
#else
{ "statushilites", "highlight control", 20, SET_IN_FILE },
"highlight control", 20, SET_IN_FILE
#endif
#ifdef CURSES_GRAPHICS
},
{ "statuslines",
#ifdef CURSES_GRAPHICS
"2 or 3 lines for horizonal (bottom or top) status display",
20, SET_IN_GAME }, /*WC2*/
20, SET_IN_GAME
#else
{ "statuslines", "2 or 3 lines for status display", 20, SET_IN_FILE },
"2 or 3 lines for status display",
20, SET_IN_FILE
#endif
}, /*WC2*/
{ "symset", "load a set of display symbols from the symbols file", 70,
SET_IN_GAME },
{ "roguesymset",
@@ -3703,6 +3706,7 @@ boolean tinitial, tfrom_file;
}
return retval;
}
#endif /* CURSES_GRAPHICS */
/* WINCAP2
* statuslines:n */
@@ -3728,7 +3732,6 @@ boolean tinitial, tfrom_file;
}
return retval;
}
#endif /* CURSES_GRAPHICS */
/* menustyle:traditional or combination or full or partial */
fullname = "menustyle";
@@ -5739,8 +5742,9 @@ char *buf;
iflags.hilite_delta, iflags.hilite_delta);
#endif
} else if (!strcmp(optname,"statuslines")) {
Strcpy(buf, (WINDOWPORT("curses")
&& iflags.wc2_statuslines < 3) ? "2" : "3");
if (wc2_supported(optname))
Strcpy(buf, (iflags.wc2_statuslines < 3) ? "2" : "3");
/* else default to "unknown" */
} else if (!strcmp(optname, "suppress_alert")) {
if (flags.suppress_alert == 0L)
Strcpy(buf, none);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 termcap.c $NHDT-Date: 1456907853 2016/03/02 08:37:33 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.24 $ */
/* NetHack 3.6 termcap.c $NHDT-Date: 1553858473 2019/03/29 11:21:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.29 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1206,12 +1206,37 @@ int n;
return nulstr;
}
/* suppress nonfunctional highlights so render_status() might be able to
optimize more; keep this in sync with s_atr2str() */
int
term_attr_fixup(msk)
int msk;
{
/* underline is converted to bold if its start sequence isn't available */
if ((msk & (1 << ATR_ULINE)) && !nh_US) {
msk |= (1 << ATR_BOLD);
msk &= ~(1 << ATR_ULINE);
}
/* blink is converted to bold unconditionally [why?] */
if (msk & (1 << ATR_BLINK)) {
msk |= (1 << ATR_BOLD);
msk &= ~(1 << ATR_BLINK);
}
/* dim is ignored */
if (msk & (1 << ATR_DIM))
msk &= ~(1 << ATR_DIM);
return msk;
}
void
term_start_attr(attr)
int attr;
{
if (attr) {
xputs(s_atr2str(attr));
const char *astr = s_atr2str(attr);
if (*astr)
xputs(s_atr2str(attr));
}
}
@@ -1220,7 +1245,10 @@ term_end_attr(attr)
int attr;
{
if (attr) {
xputs(e_atr2str(attr));
const char *astr = e_atr2str(attr);
if (*astr)
xputs(e_atr2str(attr));
}
}
@@ -1248,7 +1276,8 @@ void
term_start_color(color)
int color;
{
xputs(hilites[color]);
if (color < CLR_MAX)
xputs(hilites[color]);
}
/* not to be confused with has_colors() in unixtty.c */

File diff suppressed because it is too large Load Diff