Menu

#2320 Wrong EOL annotation position

Bug
closed-fixed
nobody
5
2022-03-31
2022-03-09
No

Bug in Scintilla EditView::DrawEOLAnnotationText()

When showing a fold display text the EOL annotation is drawn at the wrong position. The problem is caused if both elements use different fonts (see attached image).

Solution: Use fold display text font (instead of EOL annotation font) to calculate the width of the fold display text.

Bug fix in EditView::DrawEOLAnnotationText():

// replace:
rcSegment.left += (static_cast<int>(
surface->WidthText(fontText, foldDisplayText)) + vsDraw.aveCharWidth);
// by
rcSegment.left += (static_cast<int>(
surface->WidthText(vsDraw.styles[StyleFoldDisplayText].font.get(),foldDisplayText))

+ vsDraw.aveCharWidth);
1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2022-03-09
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,9 +4,13 @@
    
     Solution: Use fold display text font (instead of EOL annotation font) to calculate the width of the fold display text.
    
    -Bug fix in EditView::DrawEOLAnnotationText():
    -replace:
    -rcSegment.left += (static_cast&lt;int&gt;(surface-&gt;WidthText(fontText, foldDisplayText)) + vsDraw.aveCharWidth);
    -by
    -rcSegment.left += (static_cast&lt;int&gt;(surface-&gt;WidthText(vsDraw.styles[StyleFoldDisplayText].font.get(), foldDisplayText)) + vsDraw.aveCharWidth);
    -
    +Bug fix in `EditView::DrawEOLAnnotationText()`:
    +~~~c++
    +// replace:
    +rcSegment.left += (static_cast&lt;int&gt;(
    +surface-&gt;WidthText(fontText, foldDisplayText)) + vsDraw.aveCharWidth);
    +// by
    +rcSegment.left += (static_cast&lt;int&gt;(
    +surface-&gt;WidthText(vsDraw.styles[StyleFoldDisplayText].font.get(),foldDisplayText))
    ++ vsDraw.aveCharWidth);
    +~~~
    
     
  • Neil Hodgson

    Neil Hodgson - 2022-03-10
    • labels: --> scintilla, annotation
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2022-03-10

    Committed fix as [72e879].

     

    Related

    Commit: [72e879]

  • Neil Hodgson

    Neil Hodgson - 2022-03-31
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2022-03-31

    Committed fix as [72e879].

     

    Related

    Commit: [72e879]


Log in to post a comment.

MongoDB Logo MongoDB