small bug in diff checking for view

This commit is contained in:
John Sennesael 2021-08-17 20:02:37 -05:00
parent 72b9df3052
commit f93b5da62d
2 changed files with 6 additions and 4 deletions

View File

@ -39,7 +39,6 @@ void Application::Run()
Size(m_terminal.Size(STDIN_FILENO), m_bgFillCharacter);
m_terminal.SetOnResize([&](Application&){
const Vector2D newSize = m_terminal.Size(STDIN_FILENO);
ClearScreen();
Size(newSize, m_bgFillCharacter);
OnResize(newSize);
});

View File

@ -42,14 +42,18 @@ void View::Render()
{
const wchar_t newChar = line[x];
bool needUpdate{false};
if (y < m_previousBuffer.size())
if (m_buffer.size() == m_previousBuffer.size())
{
const std::vector<wchar_t>& pline = m_previousBuffer[y];
if (pline.size() >= x)
if (line.size() == pline.size())
{
const wchar_t oldChar = pline[x];
if (newChar != oldChar) needUpdate = true;
}
else
{
needUpdate = true;
}
}
else
{
@ -87,7 +91,6 @@ void View::Size(const Vector2D& s, wchar_t fill)
{
line.resize(s.X(), fill);
}
m_previousBuffer.clear();
}
Vector2D View::Size() const