https://bugs.kde.org/show_bug.cgi?id=492106

            Bug ID: 492106
           Summary: The height of text in LSP plugin popup boxes is not
                    always determined correctly, leading to scrollbars
                    being created when not needed
    Classification: Applications
           Product: kate
           Version: Git
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: adam.m.fontenot+...@gmail.com
  Target Milestone: ---

Created attachment 172896
  --> https://bugs.kde.org/attachment.cgi?id=172896&action=edit
screenshot of the issue

SUMMARY

See screenshot for example. Sometimes the box doesn't set its height correctly,
leading to forced scrollbars.

I think I tracked down at least part of the issue:

The popup box code sizes the box to either 1/3 of the view height, or the
following value, whichever is less:

    const int height = fm.lineSpacing() * (document()->lineCount());

If I'm reading this right it gets the height in pixels of lines in the chosen
font, using the font metrics, and multiplies it by the number of lines in the
document being inserted into the popup.

This doesn't work because the documents displayed in these popups are not plain
text! They're converted from Markdown, so are probably HTML (?), but regardless
they contain elements that have more height than a line of text in the user's
font. For example, a bunch of the responses from rust-analyzer have a
"-----------" horizontal rule, which have slightly larger margins. And Kate
also renders the "#" h1, h2 headers in a much larger font which uses more
space. I'm also not sure how it deals with paragraph breaks - just in general,
the text height of Markdown source isn't a very good predictor of the height of
a rendered document.

This leads to awkwardly needing to scroll to see one or two lines of text at
the bottom of the popup, even though the normal size of a popup would easily
accommodate the text.

Tested against latest Git but also observed with 24.08.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.5-arch1-1 (64-bit)
Graphics Platform: Wayland

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to