diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-10-27 15:48:08 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-10-27 15:48:08 +0200 |
| commit | b24a80a3ecacd6676485caf70e6b61839a09ae4e (patch) | |
| tree | 5f6bf06b6a54ed9cfe0485d64f102ee9c610d9cb /src | |
| parent | 031ed91ea61ad750485c4e0e4e211097a34f80e8 (diff) | |
NCurses::draw: maintain current column without using ncurses
Diffstat (limited to 'src')
| -rw-r--r-- | src/ncurses.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ncurses.cc b/src/ncurses.cc index f70de2c2..a7c2a3e5 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -152,6 +152,7 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer, { move((int)line_index, 0); clrtoeol(); + CharCount col_index = 0; for (const DisplayAtom& atom : line) { set_attribute(A_UNDERLINE, atom.attribute & Underline); @@ -162,10 +163,8 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer, set_color(atom.fg_color, atom.bg_color); String content = atom.content.content(); - int y,x; - getyx(stdscr, y,x); if (content[content.length()-1] == '\n' and - content.char_length() - 1 < m_dimensions.column - x) + content.char_length() - 1 < m_dimensions.column - col_index) { addutf8str(Utf8Iterator(content.begin()), Utf8Iterator(content.end())-1); addch(' '); @@ -173,9 +172,10 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer, else { Utf8Iterator begin(content.begin()), end(content.end()); - if (end - begin > m_dimensions.column - x) - end = begin + m_dimensions.column - x; + if (end - begin > m_dimensions.column - col_index) + end = begin + m_dimensions.column - col_index; addutf8str(begin, end); + col_index += end - begin; } } ++line_index; |
