Terminal: Add search

* Adds new search widget to terminal
* Adds new theme color "TerminalFindMatch"
* Fixes ESC key handling in terminal

Fixes: QTCREATORBUG-28946
Change-Id: I7b6057d13902a94a6bcd41dde6cc8ba8418cd585
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-03-24 12:53:21 +01:00
parent 884a1d6f94
commit 9417f8b99e
25 changed files with 686 additions and 143 deletions

View File

@@ -48,10 +48,11 @@ QPoint CellIterator::gridPos() const
return m_surface->posToGrid(m_pos);
}
void CellIterator::updateChar()
bool CellIterator::updateChar()
{
QPoint cell = m_surface->posToGrid(m_pos);
m_char = m_surface->fetchCharAt(cell.x(), cell.y());
return m_char != 0;
}
CellIterator &CellIterator::operator-=(int n)
@@ -63,7 +64,9 @@ CellIterator &CellIterator::operator-=(int n)
throw new std::runtime_error("-= n too big!");
m_pos -= n;
updateChar();
while (!updateChar() && m_pos > 0 && m_skipZeros)
m_pos--;
m_state = State::INSIDE;
@@ -79,10 +82,14 @@ CellIterator &CellIterator::operator+=(int n)
if (n == 0)
return *this;
if (m_pos + n < m_maxpos) {
if (m_pos + n < m_maxpos + 1) {
m_state = State::INSIDE;
m_pos += n;
updateChar();
while (!updateChar() && m_pos < (m_maxpos + 1) && m_skipZeros)
m_pos++;
if (m_pos == m_maxpos + 1)
m_state = State::END;
} else {
*this = m_surface->end();
}