1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-08 00:15:50 +03:00

fix(wrap): drop phantom whitespace rows for inputs that exactly fill a row

Word-wrap previously emitted a phantom whitespace-only row when a word
exactly filled a row and the input continued (e.g. "abcde fghij" at
width 5 wrapped to 3 rows instead of 2). Separator whitespace that does
not fit the remaining space is now handled like ratatui's WordWrapper
(trim: false): whitespace filling the remaining cells is dropped,
whitespace after an exactly full row is dropped one grapheme at a time,
and any leftover whitespace leads the next row.

wrapped_rows now keeps byte-accurate column bookkeeping so screen_map
round-trips hold for all visible positions; positions inside dropped
whitespace have no screen representation and are treated as such.

Verified differentially against ratatui 0.30's WordWrapper (a faithful
reference port cross-checked against the real Paragraph renderer):
row counts now match for single- and multi-space separators, trailing
whitespace, CJK and mixed-width inputs.
Этот коммит содержится в:
Gleb Tv
2026-08-19 13:36:28 +03:00
родитель 0b93c88729
Коммит 6aa9ec0b87
3 изменённых файлов: 311 добавлений и 8 удалений

2
Cargo.lock сгенерированный
Просмотреть файл

@@ -1871,7 +1871,7 @@ dependencies = [
[[package]]
name = "tui-textarea-2"
version = "0.12.1"
version = "0.12.2"
dependencies = [
"arbitrary",
"crossterm 0.28.1",