diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2012-10-06 15:08:24 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2012-10-06 15:08:24 +0200 |
commit | 4a1824753cf58341a540cf9fd35dc097fc1896fc (patch) | |
tree | 30ade51621071163ecf326b0efa78645c68242ea /src | |
parent | 59728381b945570090a8d101ec6128492c82ab7e (diff) |
scrollpad: tidy Scrollpad::flush a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/scrollpad.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/scrollpad.cpp b/src/scrollpad.cpp index ed69e719..4cf7e16b 100644 --- a/src/scrollpad.cpp +++ b/src/scrollpad.cpp @@ -40,15 +40,11 @@ m_real_height(height) void Scrollpad::flush() { - recreate(m_width, m_height); - auto &w = static_cast<Window &>(*this); const auto &s = m_buffer.str(); const auto &ps = m_buffer.properties(); auto p = ps.begin(); - auto old_p = p; - int x, y; - size_t i = 0, old_i; + size_t i = 0; auto load_properties = [&]() { for (; p != ps.end() && p->position() == i; ++p) @@ -71,10 +67,13 @@ void Scrollpad::flush() auto write_buffer = [&](bool generate_height_only) -> size_t { int new_y; size_t height = 1; + size_t old_i; + auto old_p = p; + int x, y; i = 0; p = ps.begin(); y = getY(); - while (true) + while (i < s.length()) { // write all whitespaces. write_whitespace(); @@ -136,9 +135,6 @@ void Scrollpad::flush() } } - if (i == s.length()) - break; - if (generate_height_only) { // move to the first line, since when we do |