Save plain text with CRLF on Windows, fixing round-trip tests

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.
This commit is contained in:
Isaiah Odhner 2024-11-05 06:57:29 -05:00
parent 0a0d509cd2
commit 4387c07e7b
2 changed files with 5 additions and 1 deletions

View File

@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Focus is reset when pressing <kbd>Esc</kbd>. This is important to avoid getting stuck with the character input field focused, in order to use free typing mode, or move the selection with the arrow keys, or copy the selection with <kbd>Ctrl+C</kbd>. (The character input field is where it shows the currently selected colors.)
- Text cursor now blinks.
### Changed
- Plain text files (`.txt`) are now saved with CRLF line endings on Windows.
### Fixed
- Fixed errors when interacting with the command palette (opened by clicking the paint icon in the top left).

View File

@ -320,7 +320,7 @@ class AnsiArtDocument:
for y in range(self.height):
for x in range(self.width):
text += self.ch[y][x]
text += "\n"
text += os.linesep
return text
def get_rich_console_markup(self) -> str: