Skip to content

Commit

Permalink
fix: selected single line appearance is not consistent (#649)
Browse files Browse the repository at this point in the history
The previous logic added a pen stroke at the top 3 pixels wide, and 5 pixels at the bottom. Probably because the lower pen stroke is misaligned (too far down) and needs a larger stroke width to compensate for this misalignment, which causes part of that stroke (the lower part) to be cut of by the next line (but not if the selection is on the last line).

This causes different effects both at lines selected in the middle of the log as well as the end of the log (last line) in different ways.

It also re-added pen several times after changing the width of the pen, which is simply unnecessary (and may have added to this effect of increasing color intensity in the original version)

The fix simple removes unnecessary lines of code as well as adjusting the position of the lower stroke and removing the previous attempt to compensate for it with stroke width.
  • Loading branch information
secretfork committed Jul 24, 2023
1 parent 88abcec commit 68f1506
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ui/src/abstractlogview.cpp
Expand Up @@ -2611,13 +2611,11 @@ void AbstractLogView::drawTextArea( QPaintDevice* paintDevice )
if ( ( selection_.isLineSelected( lineNumber ) && selection_.isSingleLine() )
|| selection_.getPortionForLine( lineNumber ).isValid() ) {
auto selectionPen = QPen( palette.color( QPalette::Highlight ) );
selectionPen.setWidth( 3 );
selectionPen.setWidth( 1 );
painter->setPen( selectionPen );
painter->drawLine( xPos - ContentMarginWidth + 1, yPos, viewport()->width(), yPos );
selectionPen.setWidth( 5 );
painter->setPen( selectionPen );
painter->drawLine( xPos - ContentMarginWidth + 2, yPos + finalLineHeight,
viewport()->width(), yPos + finalLineHeight );
painter->drawLine( xPos - ContentMarginWidth + 1, yPos + finalLineHeight - 1,
viewport()->width(), yPos + finalLineHeight - 1 );
}

// Then draw the bullet
Expand Down

0 comments on commit 68f1506

Please sign in to comment.