From ba244a70a3e4128b65510ab8969afacf194b1f10 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 28 Oct 2012 11:00:23 +0100 Subject: [PATCH] NCurses: fix long lines handling --- src/ncurses.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ncurses.cc b/src/ncurses.cc index 1cbfbf1f..1fdb1202 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -132,6 +132,7 @@ using Utf8Policy = utf8::InvalidBytePolicy::Pass; using Utf8Iterator = utf8::utf8_iterator; void addutf8str(Utf8Iterator begin, Utf8Iterator end) { + assert(begin <= end); while (begin != end) addch(*begin++); } @@ -173,7 +174,7 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer, { Utf8Iterator begin(content.begin()), end(content.end()); if (end - begin > m_dimensions.column - col_index) - end = begin + m_dimensions.column - col_index; + end = begin + (m_dimensions.column - col_index); addutf8str(begin, end); col_index += end - begin; }