Commit 7bb6e947 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix Screen::moveImage overwriting content

The previous version didn't care about partial images i.e., the a few
lines of the full image. This lead to broken behaviour in apps like VI.
parent f1224716
Pipeline #98050 passed with stage
in 1 minute and 52 seconds
......@@ -1164,8 +1164,8 @@ void Screen::moveImage(int dest, int sourceBegin, int sourceEnd)
const int destY = dest / _columns;
const int srcY = sourceBegin / _columns;
if (dest < sourceBegin) {
std::rotate(_screenLines.begin() + destY, _screenLines.begin() + srcY, _screenLines.end());
std::rotate(_lineProperties.begin() + destY, _lineProperties.begin() + srcY, _lineProperties.end());
std::rotate(_screenLines.begin() + destY, _screenLines.begin() + srcY, _screenLines.begin() + srcY + lines);
std::rotate(_lineProperties.begin() + destY, _lineProperties.begin() + srcY, _lineProperties.begin() + srcY + lines);
} else {
for (int i = lines; i >= 0; --i) {
_screenLines[destY + i] = std::move(_screenLines[srcY + i]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment