Ideas for better handling of long preformatted text lines #184
Labels
enhancement
New feature or request
gemini-text
This issue is related to the gemini text format
html
This issue is related to html display
The problem
When viewing some pages (e.g gemini://random-projects.net/blog/2021-03-03-distributed-trust.gemini) the preformatted text can sometimes exceed the window/screen width and become unreadable:
(That's an example of it exceeding window width, but it actually exceeds my screen's width too)
Of course, according to the spec, we aren't supposed to do any line wrapping or anything to preformatted text. Instead the spec encourages an alternative approach - scroll bars:
Currently, horizontal scrollbars on the KristallTextBrowser widget are actually disabled (as of #153, see this which I forgot to mention in that PR's description). I chose to disable it because since the text-width stuff (#149) was introduced, if a horizontal scrollbar was visible it would allow a user to "scroll the left/right margins" of the document, which looked really strange and most people would consider it a bug.
I should add that since the text-width stuff was added (before scrollbar was disabled), a horizontal scrollbar would show if there was any preformatted text lines longer than the max text width. The below diagram demonstrates that:
In current kristall builds, a curious user will be able to realise that the horizontal scrollbar is in fact just "hidden", because it is actually still possible to scroll horizontally in pages with long preformatted lines, by selecting some text and moving the mouse to the left/right edge of the KristallTextBrowser widget (it demonstrates the "left/right margin scrolling" I discussed above)
Potential solutions
There are two potential ways I can think think of to solve this:
The lagrange method
Lagrange tries to solve this same problem by reducing the font size of long preformatted lines:
(note how the first preformatted text is normal size, and the long line is smaller)
The two problems with this method are obviously:
The other "embedded scrollbars" method
The other method which I think would be ideal is to create a seperate scrollbar for these long preformatted blocks, like demonstrated below (mocked up in GIMP, so it doesn't look super-pretty)
However, it might be really tricky to embed one of these into a QTextDocument. I have no idea if it's even possible.
Just some ideas to think about 😉
The text was updated successfully, but these errors were encountered: