From 14befc5b5636f84ff5a6d6f3c6e5c078c7a41b34 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 15 Jan 2009 20:44:03 +0100 Subject: [PATCH] fix scrolling if unicode is disabled --- src/helpers.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/helpers.cpp b/src/helpers.cpp index a8ed4b66..2e002690 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -846,14 +846,22 @@ void Scroller(Window &w, const string &string, size_t width, size_t &pos) std::basic_string::const_iterator b = s.begin(), e = s.end(); for (std::basic_string::const_iterator it = b+pos; it != e && len < width; it++) { +# ifdef _UTF8 len += wcwidth(*it); +# else + len++; +# endif w << *it; } if (++pos >= s.length()) pos = 0; for (; len < width; b++) { +# ifdef _UTF8 len += wcwidth(*b); +# else + len++; +# endif w << *b; } }