Commit 766b222d authored by David Schulz's avatar David Schulz
Browse files

Editor: Move inFindScope back to exported class.



To allow invoking it from BaseTextFind.

Task-number: QTCREATORBUG-14300
Change-Id: Id9f553d166f7b929e00238327e22d6a915957b77
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 1d3b4abb
...@@ -298,9 +298,6 @@ public: ...@@ -298,9 +298,6 @@ public:
void transformSelection(TransformationMethod method); void transformSelection(TransformationMethod method);
void transformBlockSelection(TransformationMethod method); void transformBlockSelection(TransformationMethod method);
bool inFindScope(const QTextCursor &cursor);
bool inFindScope(int selectionStart, int selectionEnd);
void slotUpdateExtraAreaWidth(); void slotUpdateExtraAreaWidth();
void slotUpdateRequest(const QRect &r, int dy); void slotUpdateRequest(const QRect &r, int dy);
void slotUpdateBlockNotify(const QTextBlock &); void slotUpdateBlockNotify(const QTextBlock &);
...@@ -3143,7 +3140,7 @@ void TextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block, ...@@ -3143,7 +3140,7 @@ void TextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block,
|| (idx + l < text.length() && text.at(idx + l).isLetterOrNumber()))) || (idx + l < text.length() && text.at(idx + l).isLetterOrNumber())))
continue; continue;
if (!inFindScope(blockPosition + idx, blockPosition + idx + l)) if (!q->inFindScope(blockPosition + idx, blockPosition + idx + l))
continue; continue;
const QTextCharFormat &searchResultFormat const QTextCharFormat &searchResultFormat
...@@ -6923,30 +6920,30 @@ void TextBlockSelection::fromPostition(int positionBlock, int positionColumn, ...@@ -6923,30 +6920,30 @@ void TextBlockSelection::fromPostition(int positionBlock, int positionColumn,
this->anchorColumn = anchorColumn; this->anchorColumn = anchorColumn;
} }
bool TextEditorWidgetPrivate::inFindScope(const QTextCursor &cursor) bool TextEditorWidget::inFindScope(const QTextCursor &cursor)
{ {
if (cursor.isNull()) if (cursor.isNull())
return false; return false;
return inFindScope(cursor.selectionStart(), cursor.selectionEnd()); return inFindScope(cursor.selectionStart(), cursor.selectionEnd());
} }
bool TextEditorWidgetPrivate::inFindScope(int selectionStart, int selectionEnd) bool TextEditorWidget::inFindScope(int selectionStart, int selectionEnd)
{ {
if (m_findScopeStart.isNull()) if (d->m_findScopeStart.isNull())
return true; // no scope, everything is included return true; // no scope, everything is included
if (selectionStart < m_findScopeStart.position()) if (selectionStart < d->m_findScopeStart.position())
return false; return false;
if (selectionEnd > m_findScopeEnd.position()) if (selectionEnd > d->m_findScopeEnd.position())
return false; return false;
if (m_findScopeVerticalBlockSelectionFirstColumn < 0) if (d->m_findScopeVerticalBlockSelectionFirstColumn < 0)
return true; return true;
QTextBlock block = q->document()->findBlock(selectionStart); QTextBlock block = document()->findBlock(selectionStart);
if (block != q->document()->findBlock(selectionEnd)) if (block != document()->findBlock(selectionEnd))
return false; return false;
QString text = block.text(); QString text = block.text();
const TabSettings &ts = m_document->tabSettings(); const TabSettings &ts = d->m_document->tabSettings();
int startPosition = ts.positionAtColumn(text, m_findScopeVerticalBlockSelectionFirstColumn); int startPosition = ts.positionAtColumn(text, d->m_findScopeVerticalBlockSelectionFirstColumn);
int endPosition = ts.positionAtColumn(text, m_findScopeVerticalBlockSelectionLastColumn); int endPosition = ts.positionAtColumn(text, d->m_findScopeVerticalBlockSelectionLastColumn);
if (selectionStart - block.position() < startPosition) if (selectionStart - block.position() < startPosition)
return false; return false;
if (selectionEnd - block.position() > endPosition) if (selectionEnd - block.position() > endPosition)
......
...@@ -623,6 +623,9 @@ protected slots: ...@@ -623,6 +623,9 @@ protected slots:
virtual void slotCursorPositionChanged(); // Used in VcsBase virtual void slotCursorPositionChanged(); // Used in VcsBase
virtual void slotCodeStyleSettingsChanged(const QVariant &); // Used in CppEditor virtual void slotCodeStyleSettingsChanged(const QVariant &); // Used in CppEditor
bool inFindScope(const QTextCursor &cursor);
bool inFindScope(int selectionStart, int selectionEnd);
void doFoo(); void doFoo();
private: private:
......
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