summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/viewgeom.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2013-07-19 18:43:21 -0400
committerNeil Moore <neil@s-z.org>2013-07-19 18:53:05 -0400
commit5769dcec22a59da68925b1461fa2c512d7572e3f (patch)
tree4d4e09b9a4e407f747a9f4f342c20fce967f660e /crawl-ref/source/viewgeom.cc
parent530eb3813072377b79c26f369cbe1d5295cd10d1 (diff)
downloadcrawl-ref-5769dcec22a59da68925b1461fa2c512d7572e3f.tar.gz
crawl-ref-5769dcec22a59da68925b1461fa2c512d7572e3f.zip
Give a better message when the terminal is too small for the layout.
It was possible to get e.g. "Terminal too small (80,25); need at least (79,24)". Now we have a slightly different message when the problem is the layout rather than the absolute (79,24) limit; and we include the actual required size. The required size reported by this commit isn't perfect because there doesn't seem to be a good way of asking for the true minimum size along a sufficiently-large axis (leftover_x() is zero even though things could be shrunk). We currently report the absolute minimum for such axes, even though the true limit could in fact be somewhere between that and the current size.
Diffstat (limited to 'crawl-ref/source/viewgeom.cc')
-rw-r--r--crawl-ref/source/viewgeom.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/crawl-ref/source/viewgeom.cc b/crawl-ref/source/viewgeom.cc
index 82e0c942fb..587a750839 100644
--- a/crawl-ref/source/viewgeom.cc
+++ b/crawl-ref/source/viewgeom.cc
@@ -370,12 +370,23 @@ void crawl_view_geometry::init_geometry()
const _mlist_col_layout lay_mlist(termsz, hudsz);
#ifndef USE_TILE_LOCAL
- if ((termsz.x < MIN_COLS || termsz.y < MIN_LINES || !lay_inline.valid)
- && !crawl_state.need_save)
+ if (!crawl_state.need_save)
{
- // Terminal too small; exit with an error.
- end(1, false, "Terminal too small (%d,%d); need at least (%d,%d)",
- termsz.x, termsz.y, MIN_COLS, MIN_LINES);
+ if (termsz.x < MIN_COLS || termsz.y < MIN_LINES)
+ {
+ end(1, false, "Terminal too small (%d,%d); need at least (%d,%d)",
+ termsz.x, termsz.y, MIN_COLS, MIN_LINES);
+ }
+ else if (!lay_inline.valid)
+ {
+ const int x_left = lay_inline.leftover_x();
+ const int y_left = lay_inline.leftover_y();
+
+ end(1, false, "Terminal too small (%d,%d); layout needs (%d,%d)",
+ termsz.x, termsz.y,
+ x_left < 0 ? termsz.x - x_left : MIN_COLS,
+ y_left < 0 ? termsz.y - y_left : MIN_LINES);
+ }
}
#endif