fix NCurses info box, avoid trailing space on each lines
This commit is contained in:
parent
b2dffbabb6
commit
23f43376df
|
@ -492,7 +492,7 @@ static DisplayCoord compute_needed_size(const String& str)
|
||||||
if (begin+1 == end)
|
if (begin+1 == end)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
res.column = std::max(res.column, line_len+1);
|
res.column = std::max(res.column, line_len);
|
||||||
line_len = 0;
|
line_len = 0;
|
||||||
++res.line;
|
++res.line;
|
||||||
}
|
}
|
||||||
|
@ -550,9 +550,17 @@ void NCursesUI::info_show(const String& content, DisplayCoord anchor,
|
||||||
(int)pos.line, (int)pos.column);
|
(int)pos.line, (int)pos.column);
|
||||||
|
|
||||||
wbkgd(m_info_win, COLOR_PAIR(get_color_pair(colors)));
|
wbkgd(m_info_win, COLOR_PAIR(get_color_pair(colors)));
|
||||||
wmove(m_info_win, 0, 0);
|
int line = 0;
|
||||||
addutf8str(m_info_win, Utf8Iterator(content.begin()),
|
auto it = content.begin(), end = content.end();
|
||||||
Utf8Iterator(content.end()));
|
while (true)
|
||||||
|
{
|
||||||
|
wmove(m_info_win, line++, 0);
|
||||||
|
auto eol = std::find_if(it, end, [](char c) { return c == '\n'; });
|
||||||
|
addutf8str(m_info_win, Utf8Iterator(it), Utf8Iterator(eol));
|
||||||
|
if (eol == end)
|
||||||
|
break;
|
||||||
|
it = eol + 1;
|
||||||
|
}
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user