Get rid of QChar::LineSeparator

It was causing troubles while scrolling. Replace it with
\n and hack selection. Simplify the code. Now every line
is a separate block. Prepare for expanding skipped lines.

Change-Id: I8d305681c575abdaaf9cdbf26de864dd3a906d3a
Reviewed-by: David Schulz <david.schulz@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
jkobus
2013-04-09 10:26:31 +02:00
committed by hjk
parent 7051f49a6e
commit 77abd02787
4 changed files with 140 additions and 174 deletions

View File

@@ -3293,8 +3293,10 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
if ((hasMainSelection && i == context.selections.size()-1)
|| (o.format.foreground().style() == Qt::NoBrush
&& o.format.underlineStyle() != QTextCharFormat::NoUnderline
&& o.format.background() == Qt::NoBrush))
prioritySelections.append(o);
&& o.format.background() == Qt::NoBrush)) {
if (selectionVisible(block.blockNumber()))
prioritySelections.append(o);
}
else
selections.append(o);
}
@@ -3484,7 +3486,6 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
int selectionStart = cursor.selectionStart();
int selectionEnd = cursor.selectionEnd();
while (block.isValid() && top <= e->rect().bottom()) {
QTextBlock nextBlock = block.next();
QTextBlock nextVisibleBlock = nextBlock;
@@ -6196,6 +6197,11 @@ int BaseTextEditorWidget::lineNumberDigits() const
return digits;
}
bool BaseTextEditorWidget::selectionVisible(int blockNumber) const
{
return true;
}
void BaseTextEditorWidget::appendMenuActionsFromContext(QMenu *menu, const Core::Id menuContextId)
{
Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(menuContextId);