1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-26 21:22:00 +03:00

Slight code simplification

This commit is contained in:
Maxime Coste 2020-07-18 13:44:03 +10:00
parent b3025b87d0
commit 7bbc057cd7

View File

@ -262,7 +262,7 @@ void TerminalUI::Screen::output(bool force)
for (auto& change : changes) for (auto& change : changes)
{ {
line += change.keep; line += change.keep;
if (int del = std::max(change.del - change.add, 0); del > 0) if (int del = change.del - change.add; del > 0)
{ {
printf("\033[%dH\033[%dM", line + 1, del); printf("\033[%dH\033[%dM", line + 1, del);
line -= del; line -= del;
@ -276,7 +276,7 @@ void TerminalUI::Screen::output(bool force)
line += change.keep; line += change.keep;
for (int i = 0; i < change.add; ++i) for (int i = 0; i < change.add; ++i)
{ {
if (int add = std::max(0, change.add - change.del); i == 0 and add > 0) if (int add = change.add - change.del; i == 0 and add > 0)
printf("\033[%dH\033[%dL", line + 1, add); printf("\033[%dH\033[%dL", line + 1, add);
else else
printf("\033[%dH", line + 1); printf("\033[%dH", line + 1);