forked from qt-creator/qt-creator
Fixed find scope
There was an off-by-one error for the normal find scope. Improved look by ignoring the left side.
This commit is contained in:
@@ -329,7 +329,7 @@ void BaseTextFind::defineFindScope()
|
|||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) {
|
if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) {
|
||||||
d->m_findScopeStart = QTextCursor(document()->docHandle(), qMax(0, cursor.selectionStart()-1));
|
d->m_findScopeStart = QTextCursor(document()->docHandle(), qMax(0, cursor.selectionStart()));
|
||||||
d->m_findScopeEnd = QTextCursor(document()->docHandle(), cursor.selectionEnd());
|
d->m_findScopeEnd = QTextCursor(document()->docHandle(), cursor.selectionEnd());
|
||||||
d->m_findScopeVerticalBlockSelectionFirstColumn = -1;
|
d->m_findScopeVerticalBlockSelectionFirstColumn = -1;
|
||||||
d->m_findScopeVerticalBlockSelectionLastColumn = -1;
|
d->m_findScopeVerticalBlockSelectionLastColumn = -1;
|
||||||
@@ -344,7 +344,7 @@ void BaseTextFind::defineFindScope()
|
|||||||
emit findScopeChanged(d->m_findScopeStart, d->m_findScopeEnd,
|
emit findScopeChanged(d->m_findScopeStart, d->m_findScopeEnd,
|
||||||
d->m_findScopeVerticalBlockSelectionFirstColumn,
|
d->m_findScopeVerticalBlockSelectionFirstColumn,
|
||||||
d->m_findScopeVerticalBlockSelectionLastColumn);
|
d->m_findScopeVerticalBlockSelectionLastColumn);
|
||||||
cursor.setPosition(d->m_findScopeStart.position()+1);
|
cursor.setPosition(d->m_findScopeStart.position());
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
} else {
|
} else {
|
||||||
clearFindScope();
|
clearFindScope();
|
||||||
|
|||||||
@@ -171,10 +171,10 @@ QPainterPath TextEditorOverlay::createSelectionPath(const QTextCursor &begin, co
|
|||||||
inSelection = true;
|
inSelection = true;
|
||||||
firstOrLastBlock = true;
|
firstOrLastBlock = true;
|
||||||
} else {
|
} else {
|
||||||
while (beginChar < block.length() && document->characterAt(block.position() + beginChar).isSpace())
|
// while (beginChar < block.length() && document->characterAt(block.position() + beginChar).isSpace())
|
||||||
++beginChar;
|
// ++beginChar;
|
||||||
if (beginChar == block.length())
|
// if (beginChar == block.length())
|
||||||
beginChar = 0;
|
// beginChar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastLine = blockLayout->lineCount()-1;
|
int lastLine = blockLayout->lineCount()-1;
|
||||||
|
|||||||
Reference in New Issue
Block a user