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:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user