Skip to content

Commit

Permalink
fix: fix crash in scrollbar updates
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Jul 30, 2023
1 parent 1eae8f5 commit 8a5eff0
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/ui/src/abstractlogview.cpp
Expand Up @@ -2260,19 +2260,18 @@ void AbstractLogView::updateScrollBars()
const auto wrappedLinesScrollAdjust = ( getNbVisibleLines() - visibleWrappedLines ).get();

verticalScrollBar()->setRange(
0, static_cast<int>( qMin( logData_->getNbLine().get() - getNbVisibleLines().get()
+ LinesCount::UnderlyingType{ 1 }
+ wrappedLinesScrollAdjust,
maxValue<LinesCount>().get() ) ) );
0, static_cast<int>( std::min( logData_->getNbLine().get() - getNbVisibleLines().get()
+ LinesCount::UnderlyingType{ 1 }
+ wrappedLinesScrollAdjust,
maxValue<LinesCount>().get() ) ) );
}

const int hScrollMaxValue
= useTextWrap_
? 0
: std::max( 0, type_safe::narrow_cast<int>( logData_->getMaxLength().get()
- getNbVisibleCols().get() + 1 ) );
int64_t hScrollMaxValue = 0;
if ( !useTextWrap_ && logData_->getMaxLength().get() >= getNbVisibleCols().get() ) {
hScrollMaxValue = logData_->getMaxLength().get() - getNbVisibleCols().get() + 1;
}

horizontalScrollBar()->setRange( 0, hScrollMaxValue );
horizontalScrollBar()->setRange( 0, type_safe::narrow_cast<int>( hScrollMaxValue ) );
horizontalScrollBar()->setPageStep(
type_safe::narrow_cast<int>( getNbVisibleCols().get() * 7 / 8 ) );
}
Expand Down

0 comments on commit 8a5eff0

Please sign in to comment.