textual icon indicating copy to clipboard operation
textual copied to clipboard

Allow more easily customisable scrollbar glyphs

Open mon opened this issue 1 year ago • 2 comments
trafficstars

  • [x] Docstrings on all new or modified functions / classes
  • [x] Updated documentation (not needed I think?)
  • [x] Updated CHANGELOG.md (not needed, I don't think it warrants a changelog?)

Closes #4500

This allows a user to easily customise scrollbar display. For example, when using the Consolas font, scrollbars display poorly: cmd_NfNfGUSQfX

By reducing the characters to those supported, the display is more consistent:

ScrollBarRender._vertical_bars = ["▄", "█", " "]

cmd_4MxcLegZxq

By using some lightly shaded characters, the scrollbars gain some flair:

ScrollBarRender._vertical_bars = ["░", "▒", "▓", " "]

cmd_1HZHPAXOts

The blank glyph can also be replaced:

ScrollBarRender._vertical_bars = ["░", "▓", " "]
ScrollBarRender._blank_glyph = "▒"

cmd_HieEhLsuqH

This is easier than replacing the entire ScrollBarRender.render_bar function.

mon avatar May 11 '24 12:05 mon

I try to avoid Windows if I can help it, but unlike classic conhost I think the Windows Terminal has font fallback. That's not any criticism of this PR and you're probably already aware, but just thought I should mention it as there's likely some other glyphs used in Textual which are missing in Consolas.

TomJGooding avatar May 14 '24 18:05 TomJGooding

Yes, I personally use Windows Terminal with a nerd font, so textual apps look great on my machine.

However, I often give TUI tools to people without python, so I compile them to an .exe with pyinstaller. Double clicking that will always open in cmd.exe, and the default font is Consolas.

mon avatar May 15 '24 03:05 mon