summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libunix.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2012-04-14 15:16:19 -0400
committerNeil Moore <neil@s-z.org>2012-04-14 16:20:23 -0400
commitefba5851daec6f274d36d98c15e15af5ff779972 (patch)
tree00c952808f942af41c96105c796e8ce89bdb7657 /crawl-ref/source/libunix.cc
parenteeb1e1692ad1058752337ae828f9e7359f378af7 (diff)
downloadcrawl-ref-efba5851daec6f274d36d98c15e15af5ff779972.tar.gz
crawl-ref-efba5851daec6f274d36d98c15e15af5ff779972.zip
Do not crash when the terminal window is resized.
Apparently initscr() isn't enough to set LINES and COLS: we have to call refresh() as well on a SIGWINCH. Furthermore, if the resize decreased the message window size, we could end up drawing too many lines (from msgwin.show()) before the message window's lines vector is resized. Since we can't do the resize from show() (it is const), handle only the last height() lines. Likewise for message_window::place_cursor(). Fixes #5544.
Diffstat (limited to 'crawl-ref/source/libunix.cc')
-rw-r--r--crawl-ref/source/libunix.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc
index 2461d97e57..9a0bbe57c9 100644
--- a/crawl-ref/source/libunix.cc
+++ b/crawl-ref/source/libunix.cc
@@ -432,6 +432,8 @@ void console_startup(void)
scrollok(stdscr, FALSE);
+ // Must call refresh() for ncurses to update COLS and LINES.
+ refresh();
crawl_view.init_geometry();
set_mouse_enabled(false);