Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Improve text wrapping #75

Merged
merged 3 commits into from
Apr 10, 2024
Merged

Conversation

AtkinsSJ
Copy link
Contributor

@AtkinsSJ AtkinsSJ commented Apr 4, 2024

  • Preserve newlines, and each input line's leading whitespace
  • Skip over ANSI escape sequences when measuring how wide the text is, so those lines don't wrap early

Replaces the naive "split at whitespace and then recombine the parts
with ' '" approach with character-by-character iteration, preserving
the original newlines and line-start whitespace.
These escape sequences don't take up any space, so we don't want to
include their characters when measuring how much will fit on a line.

For now, this only covers the graphics-mode sequences, since those are
the ones we actually use.
@KernelDeimos KernelDeimos merged commit 16ac295 into HeyPuter:trunk Apr 10, 2024
3 checks passed
@AtkinsSJ AtkinsSJ deleted the wrapping-whitespace branch April 10, 2024 14:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants