diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-03-06 19:03:58 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-03-06 19:03:58 +0100 |
| commit | a10bfed9e5a96b164489b781f2b3a1bdbbe25d8f (patch) | |
| tree | d117398c0d83c7530c815baff93b39a17981ca7e /src | |
| parent | 5ff22d44be75d54bf7f2006a4b527f675ea3c935 (diff) | |
ncurses: fix unicode handling in status line
Diffstat (limited to 'src')
| -rw-r--r-- | src/ncurses.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ncurses.cc b/src/ncurses.cc index d35be0f5..66f58612 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -297,15 +297,20 @@ void NCursesUI::draw_status() addutf8str(stdscr, m_status_line.begin(), m_status_line.end()); else { - auto cursor_it = utf8::advance(m_status_line.begin(), m_status_line.end(), - (int)m_status_cursor); - auto end = m_status_line.end(); + Utf8Iterator begin{m_status_line.begin()}; + Utf8Iterator end{m_status_line.end()}; + Utf8Iterator cursor_it{begin}; + cursor_it.advance(m_status_cursor, end); + addutf8str(stdscr, m_status_line.begin(), cursor_it); set_attribute(A_REVERSE, 1); - addch((cursor_it == end) ? ' ' : utf8::codepoint<Utf8Policy>(cursor_it)); + if (cursor_it == end) + addch(' '); + else + addutf8str(stdscr, cursor_it, cursor_it+1); set_attribute(A_REVERSE, 0); if (cursor_it != end) - addutf8str(stdscr, utf8::next(cursor_it), end); + addutf8str(stdscr, cursor_it+1, end); } } |
