From df50dd7353839efb1caafb81fc2bc2a75884dce1 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 16 May 2018 09:04:49 +0200 Subject: [PATCH] HighlightScrollBar: Always show the current line Also when the scrollbar handle occupies the whole scrollbar area. Change-Id: I124950e3f0898f853a187ea393731ddb0800aa99 Reviewed-by: David Schulz --- src/plugins/texteditor/texteditor.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 5a8486116be..ab10ab7d0b1 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -5363,15 +5363,13 @@ void TextEditorWidgetPrivate::updateCurrentLineInScrollbar() { if (m_highlightCurrentLine && m_highlightScrollBarController) { m_highlightScrollBarController->removeHighlights(Constants::SCROLL_BAR_CURRENT_LINE); - if (m_highlightScrollBarController->scrollBar()->maximum() > 0) { - const QTextCursor &tc = q->textCursor(); - if (QTextLayout *layout = tc.block().layout()) { - const int pos = q->textCursor().block().firstLineNumber() + - layout->lineForTextPosition(tc.positionInBlock()).lineNumber(); - m_highlightScrollBarController->addHighlight({Constants::SCROLL_BAR_CURRENT_LINE, pos, - Theme::TextEditor_CurrentLine_ScrollBarColor, - Highlight::HighestPriority}); - } + const QTextCursor &tc = q->textCursor(); + if (QTextLayout *layout = tc.block().layout()) { + const int pos = q->textCursor().block().firstLineNumber() + + layout->lineForTextPosition(tc.positionInBlock()).lineNumber(); + m_highlightScrollBarController->addHighlight({Constants::SCROLL_BAR_CURRENT_LINE, pos, + Theme::TextEditor_CurrentLine_ScrollBarColor, + Highlight::HighestPriority}); } } }