Commit 886aef93 authored by mae's avatar mae
Browse files

Merge commit 'origin/2.0'

parents 942611f6 076c0349
...@@ -325,10 +325,11 @@ void BaseTextFind::defineFindScope() ...@@ -325,10 +325,11 @@ void BaseTextFind::defineFindScope()
verticalBlockSelection = m_plaineditor->property("verticalBlockSelection").toInt(); verticalBlockSelection = m_plaineditor->property("verticalBlockSelection").toInt();
if (verticalBlockSelection) { if (verticalBlockSelection) {
int findScopeFromColumn = qMin(m_findScopeStart.positionInBlock()+1, QTextCursor findScopeVisualStart(document()->docHandle(), cursor.selectionStart());
int findScopeFromColumn = qMin(findScopeVisualStart.positionInBlock(),
m_findScopeEnd.positionInBlock()); m_findScopeEnd.positionInBlock());
int findScopeToColumn = findScopeFromColumn + verticalBlockSelection; int findScopeToColumn = findScopeFromColumn + verticalBlockSelection;
m_findScopeStart.setPosition(m_findScopeStart.block().position() + findScopeFromColumn - 1); m_findScopeStart.setPosition(findScopeVisualStart.block().position() + findScopeFromColumn - 1);
m_findScopeEnd.setPosition(m_findScopeEnd.block().position() m_findScopeEnd.setPosition(m_findScopeEnd.block().position()
+ qMin(m_findScopeEnd.block().length()-1, findScopeToColumn)); + qMin(m_findScopeEnd.block().length()-1, findScopeToColumn));
m_findScopeVerticalBlockSelection = verticalBlockSelection; m_findScopeVerticalBlockSelection = verticalBlockSelection;
......
...@@ -2471,7 +2471,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) ...@@ -2471,7 +2471,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i); const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i);
const int selStart = range.cursor.selectionStart() - blpos; const int selStart = range.cursor.selectionStart() - blpos;
const int selEnd = range.cursor.selectionEnd() - blpos; const int selEnd = range.cursor.selectionEnd() - blpos;
if (selStart <= bllen && selEnd >= 0 if (selStart < bllen && selEnd >= 0
&& selEnd >= selStart) { && selEnd >= selStart) {
QTextLayout::FormatRange o; QTextLayout::FormatRange o;
o.start = selStart; o.start = selStart;
......
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