scrollpad: tidy Scrollpad::flush a bit

This commit is contained in:
Andrzej Rybczak
2012-10-06 15:08:24 +02:00
parent 59728381b9
commit 4a1824753c

View File

@@ -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