From c91cea9dc35de07958a38ab5d13e9805ec5c50ad Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 16 May 2013 22:32:58 +0200 Subject: [PATCH] fix ncurses info box placement --- src/ncurses.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ncurses.cc b/src/ncurses.cc index 83961e95..11f6e340 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -512,7 +512,9 @@ static DisplayCoord compute_pos(const DisplayCoord& anchor, DisplayCoord scrsize = window_size(stdscr); DisplayCoord pos = { anchor.line+1, anchor.column }; if (pos.line + size.line >= scrsize.line) - pos.line = anchor.line - size.line; + pos.line = std::max(0_line, anchor.line - size.line); + if (pos.column + size.column >= scrsize.column) + pos.column = std::max(0_char, anchor.column - size.column+1); if (opt_window_to_avoid) {