summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-09-23 00:43:40 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-09-23 00:43:40 +0100
commit6ec693d598da1b2c7aaa4530644dc55a2f5ab8e1 (patch)
treef317535274924658bf168c86d3b41ab021578820
parenteed3e5459d71a2f3907a50e3cdcab2ef89de5075 (diff)
Cleanup compute_needed_size implementation
-rw-r--r--src/ncurses_ui.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc
index e63c6bc1..cdcf5d50 100644
--- a/src/ncurses_ui.cc
+++ b/src/ncurses_ui.cc
@@ -721,17 +721,15 @@ void NCursesUI::menu_hide()
static CharCoord compute_needed_size(StringView str)
{
- using Utf8Iterator = utf8::iterator<const char*, utf8::InvalidPolicy::Pass>;
-
CharCoord res{1,0};
CharCount line_len = 0;
- for (Utf8Iterator begin{str.begin()}, end{str.end()};
- begin != end; ++begin)
+ for (auto it = str.begin(), end = str.end();
+ it != end; it = utf8::next(it, end))
{
- if (*begin == '\n')
+ if (*it == '\n')
{
// ignore last '\n', no need to show an empty line
- if (begin+1 == end)
+ if (it+1 == end)
break;
res.column = max(res.column, line_len);