mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-26 00:07:29 +03:00
Write same newlines across operating systems for gradient_test.ans
This commit is contained in:
parent
33650e4dd0
commit
ade8d115cf
@ -95,6 +95,7 @@ def write_ansi_file(file: TextIO) -> None:
|
||||
write('\u001b[0m')
|
||||
|
||||
# Generate and write to a file
|
||||
# Warning: in text mode, any newlines will be converted to the system's line ending, unless `newline` is passed as an argument to `open()`
|
||||
file_path = os.path.join(os.path.dirname(__file__), f'../samples/{box_inner_width}x{box_inner_height}_font_template.ans')
|
||||
file_path = os.path.abspath(file_path)
|
||||
with open(file_path, 'w', encoding='utf-8') as file:
|
||||
|
@ -65,11 +65,11 @@ height = 24
|
||||
# Generate and write the ANSI art to a file
|
||||
file_path = os.path.join(os.path.dirname(__file__), '../samples/gradient_test.ans')
|
||||
file_path = os.path.abspath(file_path)
|
||||
with open(file_path, 'w', encoding='utf-8') as file:
|
||||
with open(file_path, 'w', encoding='utf-8', newline='\n') as file:
|
||||
generate_ansi_art(width, height, file)
|
||||
|
||||
# Print the art to the terminal
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
with open(file_path, 'r', encoding='utf-8', newline='\n') as file:
|
||||
print(file.read())
|
||||
|
||||
# Print the path to the file, and resulting file size
|
||||
|
Loading…
Reference in New Issue
Block a user