Before, a Selection object was considered a cursor if it was in
`textbox_mode` and its size was 1x1. Explicit is better than implicit.
However, it's still ugly since `textbox_mode` is still True for cursors,
which are not really textboxes... which are not really selections.
Originally the File menu was getting the default focus, though this was
not useful because the menus are not keyboard accessible yet, but when I
made the menu items not accept focus, the auto focus behavior became to
focus the CharInput, causing `pytest -k test_paint_app` to fail.
No focus makes more sense than the File menu item or the CharInput.
The line endings of *.txt files are currently managed by git,
as specified in `.gitattributes`, which means they're checked out as
CRLF on Windows. I could either change the test to replace CRLF with LF
in the expected file content, or change `.gitattributes`, or change the
file saving itself to save different line endings per platform, and
the latter feels a bit better to me. Eventually it would be good to
support different line endings per file as well as different encodings,
with some auto-detection and a way to override the settings and reload.
I added another ANSI art sample, which now shows up in the gallery app's
snapshot, invalidating the test. Maybe I should stop adding sample art.
Or better yet, I should create a separate folder with just two files
so that I can add sample art freely without breaking the tests:
- one file that's small and centered
- one file that's large with scrollbars
`pytest --snapshot-update`
I reworked this so it edits the image directly, creating undo states
immediately when you type instead of when the textbox is later melded.
Now it can edit a different cell without complicating the code, as the
edits are done directly within the cursor movement code instead of
later when the 1x1 textbox is melded into the canvas.
This file was being automatically executed on (unrelated) file changes,
via this command line:
.venv\Scripts\python.exe -m pytest -p vscode_pytest --collect-only