Commit e0b4b96a authored by Matan Ziv-Av's avatar Matan Ziv-Av Committed by Tomaz Canabrava
Browse files

Use negative z postion for sixel and iterm2 protocol images

remove all characters covered by the image before placing the image.
parent 77de29be
......@@ -242,6 +242,15 @@ void Screen::eraseChars(int n)
clearImage(loc(_cuX, _cuY), loc(p, _cuY), ' ', false);
}
void Screen::eraseBlock(int y, int x, int height, int width)
{
width = qBound(0, width, _columns - x - 1);
height = qBound(0, height, _lines - y - 1);
for (int row = y; row < y + height; row++) {
clearImage(loc(x, row), loc(x + width - 1, row), ' ', false);
}
}
void Screen::deleteChars(int n)
{
Q_ASSERT(n >= 0);
......@@ -1808,6 +1817,7 @@ int Screen::addPlacement(QPixmap pixmap,
int col,
bool scrolling,
bool moveCursor,
bool leaveText,
int z,
int id,
int pid,
......@@ -1847,6 +1857,9 @@ int Screen::addPlacement(QPixmap pixmap,
p->X = X;
p->Y = Y;
if (!leaveText) {
eraseBlock(row, col, rows, cols);
}
addPlacement(p);
int needScroll = qBound(0, row + rows - _lines + 1, rows);
if (moveCursor && scrolling && needScroll > moveCursor) {
......
......@@ -619,7 +619,8 @@ public:
int col = -1,
bool scrolling = true,
bool moveCursor = true,
int z = 1,
bool leaveText = false,
int z = -1000,
int id = -1,
int pid = -1,
qreal opacity = 1.0,
......@@ -661,6 +662,9 @@ private:
// if resetLineRendition is true, all completely cleared lines will be set to single-width.
void clearImage(int loca, int loce, char c, bool resetLineRendition = true);
// erases a rectangular section of the screen.
void eraseBlock(int y, int x, int height, int width);
// move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'.
// the parameters are specified as offsets from the start of the screen image.
// the loc(x,y) macro can be used to generate these values from a column,line pair.
......
......@@ -1464,8 +1464,20 @@ void Vt102Emulation::processGraphicsToken(int tokenSize)
keys['r'] * _currentScreen->currentTerminalDisplay()->terminalFont()->fontHeight());
}
int rows = -1, cols = -1;
_currentScreen
->addPlacement(pixmap, rows, cols, -1, -1, true, keys['C'] == 0, keys['z'], keys['i'], keys['p'], keys['A'] / 255.0, keys['X'], keys['Y']);
_currentScreen->addPlacement(pixmap,
rows,
cols,
-1,
-1,
true,
keys['C'] == 0,
true,
keys['z'],
keys['i'],
keys['p'],
keys['A'] / 255.0,
keys['X'],
keys['Y']);
if (keys['q'] == 0 && keys['i']) {
QString params = QStringLiteral("i=") + QString::number(keys['i']);
if (keys['I']) {
......@@ -2230,7 +2242,7 @@ void Vt102Emulation::SixelModeDisable()
pixmap = pixmap.scaled(pixmap.width(), m_aspect.first * pixmap.height() / m_aspect.second);
}
int rows = -1, cols = -1;
int needScroll = _currentScreen->addPlacement(pixmap, rows, cols, row, col, m_SixelScrolling, false);
int needScroll = _currentScreen->addPlacement(pixmap, rows, cols, row, col, m_SixelScrolling, false, false);
if (m_SixelScrolling) {
if (rows - needScroll > 0) {
_currentScreen->cursorDown(rows - needScroll);
......
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