It turns out the background rects can span multiple cells, so I have to
pivot strategy here.
Instead of removing any outliers, remove any containers, i.e. rects that
visually (not structurally) contain other rects.
This doesn't yet fill in multiple cells when a rect is spanned.
- DRY: Make decode_based_on_file_extension use format_from_extension.
- If you try to load .html, .htm, .svg, (or ._rich_console_markup) file,
show an error instead of loading as text. The text would be much
larger than a document you saved in this format, and it wouldn't give
you what you expect, unless you're wanting to load an arbitrary text
file for viewing, and for some reason choose this program to do it.
Within the span of like a day I forgot that FIGlet fonts can be
proportional and came back to this code and was confused why charWidth
needs to be a dictionary. Well it doesn't NEED to be, it could be
implemented differently, for instance by fixing the height first,
it wouldn't need to calculate a number of spaces for the blank lines —
but how it's implemented, the width fixup could be disabled, and the
height fixup would still work. So even though the code would be a little
simpler, I'm not sure it would be better that way.
I created the workspace in order to be able to quickly search within
the textual library as easily as my own code, but now that I'm using
a virtual environment, I can search within all my dependencies easily,
and they're lower priority, being in a subfolder, which is what I want.
It was annoying when typing "README" and the top result being
"richreadme.md" from textual. So this is a much improved situation!