forked from qt-creator/qt-creator
Terminal: Safety checks
Change-Id: I095ca03dcc7bf943638d7ce785c658c0fed3b2f1 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -14,6 +14,11 @@ CellIterator::CellIterator(const TerminalSurface *surface, QPoint pos)
|
|||||||
, m_surface(surface)
|
, m_surface(surface)
|
||||||
{
|
{
|
||||||
m_pos = (pos.x()) + (pos.y() * surface->liveSize().width());
|
m_pos = (pos.x()) + (pos.y() * surface->liveSize().width());
|
||||||
|
if (m_pos < 0)
|
||||||
|
m_pos = 0;
|
||||||
|
if (m_pos == 0)
|
||||||
|
m_state = State::BEGIN;
|
||||||
|
|
||||||
m_maxpos = surface->fullSize().width() * (surface->fullSize().height()) - 1;
|
m_maxpos = surface->fullSize().width() * (surface->fullSize().height()) - 1;
|
||||||
updateChar();
|
updateChar();
|
||||||
}
|
}
|
||||||
@@ -23,7 +28,7 @@ CellIterator::CellIterator(const TerminalSurface *surface, int pos)
|
|||||||
, m_surface(surface)
|
, m_surface(surface)
|
||||||
{
|
{
|
||||||
m_maxpos = surface->fullSize().width() * (surface->fullSize().height()) - 1;
|
m_maxpos = surface->fullSize().width() * (surface->fullSize().height()) - 1;
|
||||||
m_pos = qMin(m_maxpos + 1, pos);
|
m_pos = qMax(0, qMin(m_maxpos + 1, pos));
|
||||||
if (m_pos == 0) {
|
if (m_pos == 0) {
|
||||||
m_state = State::BEGIN;
|
m_state = State::BEGIN;
|
||||||
} else if (m_pos == m_maxpos + 1) {
|
} else if (m_pos == m_maxpos + 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user