Add word wrapping and cursor mapping utilities to core library; integrate advanced text input support in TUI. Update dependencies accordingly.

This commit is contained in:
2025-09-28 01:47:50 +02:00
parent 6ddc66d864
commit ccf9349f99
11 changed files with 754 additions and 96 deletions

View File

@@ -49,11 +49,11 @@ impl MessageFormatter {
// 2) Collapse: remove whitespace-only lines; keep exactly one '\n' between content lines
let mut content = normalized
.split('\n')
.map(|l| l.trim_end()) // trim trailing spaces per line
.filter(|l| !l.trim().is_empty()) // drop blank/whitespace-only lines
.map(|l| l.trim_end()) // trim trailing spaces per line
.filter(|l| !l.trim().is_empty()) // drop blank/whitespace-only lines
.collect::<Vec<_>>()
.join("\n")
.trim() // trim leading/trailing whitespace
.trim() // trim leading/trailing whitespace
.to_string();
if content.is_empty() && self.preserve_empty_lines {
@@ -73,8 +73,12 @@ impl MessageFormatter {
.collect();
// 5) Belt & suspenders: remove leading/trailing blanks if any survived
while lines.first().map_or(false, |s| s.trim().is_empty()) { lines.remove(0); }
while lines.last().map_or(false, |s| s.trim().is_empty()) { lines.pop(); }
while lines.first().map_or(false, |s| s.trim().is_empty()) {
lines.remove(0);
}
while lines.last().map_or(false, |s| s.trim().is_empty()) {
lines.pop();
}
lines
}