mirror of
https://github.com/1j01/textual-paint.git
synced 2024-09-11 15:56:03 +03:00
Fix extraneous white cell at top left when loading ANSI files
This commit is contained in:
parent
ba7f8e6a0a
commit
1ab1dfb037
@ -137,7 +137,6 @@ cat file.ans
|
||||
- Some languages don't display correctly.
|
||||
- Large files can make the program very slow, as can magnifying the canvas.
|
||||
- The program sometimes crashes or freezes randomly, and there's no auto-save feature.
|
||||
- Saving/loading an ANSI file ends up with a white cell at the top left, which pushes the top row to the right. The top right cell gets pushed off and deleted.
|
||||
- Saved ANSI files are unnecessarily large, because they include escape sequences for every cell, even if the colors match the previous cell.
|
||||
- When finalizing a selection that is partially outside the document bounds to the top or to the left, it gets cut off.
|
||||
|
||||
|
6
paint.py
6
paint.py
@ -551,7 +551,11 @@ class AnsiArtDocument:
|
||||
# TODO: use Rich API to render ANSI to a virtual screen,
|
||||
# and remove dependency on stransi
|
||||
ansi = stransi.Ansi(text)
|
||||
document = AnsiArtDocument(1, 1)
|
||||
|
||||
# Initial document is zero wide to avoid an extraneous character at (0,0),
|
||||
# but needs one row to avoid IndexError.
|
||||
document = AnsiArtDocument(0, 1)
|
||||
# Ultimately, the minimum size is 1x1.
|
||||
width = 1
|
||||
height = 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user