]> granicus.if.org Git - nethack/commit
curses status display
authorPatR <rankin@nethack.org>
Mon, 25 Mar 2019 23:54:51 +0000 (16:54 -0700)
committerPatR <rankin@nethack.org>
Mon, 25 Mar 2019 23:54:51 +0000 (16:54 -0700)
commit382286cb9930f95445d2b1b521dbcbc72a20f5c6
treeaac3a990c8d88e44e2d88acefb47d743fc43d22e
parent2960042a9f39c957be21037a5fb085e2b785ad6e
curses status display

I noticed a couple of things wrong--that I was fairly sure that I
had working correctly before--and after fixing the second one, the
first has mysteriously disappeared.

First problem, which may or may not still be a problem:  extra spaces
were being removed from the second line of 2-line status even though
there were still 4 or 5 available spaces to the right of the status
conditions.  It was behaving as if it thought the line was narrower
than actual size, or conversely, that the sum of the widths of the
fields plus the extra spaces was bigger than it actually was.

Second problem, fixed here.  The code to put '+' in the far right
column of the last status line when there is at least one condition
all the way off the display wasn't working right when windowborders
were displayed.  That's down to curses wrapping to the next line but
user can't see it due to the window border overwriting.  Single char
overflow stayed on same line, but two or more wrapped and then the
'x' coordinate didn't match tests for 'too wide'.  Perform explicit
truncation instead of leaving that up to curses.  Also truncate
encumbrance when warranted since it's feasible for it to overflow.
Anyone using a display narrower than 80 columns might still run
into odd status behavior because other fields than conditions and
encumbrance could go past the end of line.  But they shouldn't be
wasting screen real estate with windowborders, and without borders,
curses will keep the cursor in the bottom right corner when the
program tries to go past, which should keep things reasonably sane.
win/curses/cursstat.c