Compare commits

...
1 Commits
Author SHA1 Message Date
Hunter Bown 458d7e6f2b fix: Composer: more room to edit pasted text before sending (#7049)
Produced by CodeWhale running in a Boat VM. Untested.
2026-10-24 22:29:51 -07:00
4 changed files with 29 additions and 14 deletions

No files matched your search

+12 -4
View File
@@ -69,16 +69,24 @@ mod tests {
}
#[test]
fn content_growth_expands_up_to_the_density_cap() {
fn content_growth_expands_past_the_density_cap_up_to_available_room() {
// Six content rows + border fits under the Comfortable cap of 9.
let height = desired_height(6, 0, 12, ComposerDensity::Comfortable, false);
assert_eq!(height, 7, "typed content must grow the composer: {height}");
// Past the cap the density setting wins, not the content.
// Past the cap the content wins, bounded by the room on offer.
let capped = desired_height(20, 0, 30, ComposerDensity::Comfortable, false);
assert_eq!(capped, 9, "Comfortable caps total rows at 9");
assert_eq!(
capped, 21,
"long content grows past the density cap: {capped}"
);
let spacious = desired_height(20, 0, 30, ComposerDensity::Spacious, false);
assert_eq!(spacious, 12, "Spacious caps total rows at 12");
assert_eq!(
spacious, 21,
"long content grows past the density cap: {spacious}"
);
let bounded = desired_height(20, 0, 12, ComposerDensity::Comfortable, false);
assert_eq!(bounded, 12, "growth stops at the available room: {bounded}");
}
#[test]
+2 -1
View File
@@ -1582,7 +1582,8 @@ pub(crate) fn render(f: &mut Frame, app: &mut App, _config: &Config) -> Option<(
.saturating_add(info_height)
.saturating_add(top_work_strip_height),
)
.max(MIN_COMPOSER_HEIGHT);
.max(MIN_COMPOSER_HEIGHT)
.min((body_height / 2).max(MIN_COMPOSER_HEIGHT));
let composer_height = if !pet_main && mini && !mini_cfg.keep_input {
0
} else {
+8 -5
View File
@@ -1480,8 +1480,7 @@ impl Renderable for ComposerWidget<'_> {
self.render_plan(area, buf);
}
fn desired_height(&self, width: u16) -> u16 {
self.frame()
.desired_height(width, self.max_height.min(self.max_height_cap()))
self.frame().desired_height(width, self.max_height)
}
#[cfg(test)]
fn cursor_pos(&self, area: Rect) -> Option<(u16, u16)> {
@@ -5746,11 +5745,15 @@ mod tests {
assert_eq!(measure(&app), (n + 2, n), "{n} typed lines");
}
// Past the cap the density setting wins, not the content.
// Past the cap the content wins, bounded by the room the layout
// offered (AVAILABLE): 40 input rows + 2 borders, capped at 24.
app.clear_input();
app.insert_str(&vec!["over"; 40].join("\n"));
let cap = composer_max_height(ComposerDensity::Comfortable);
assert_eq!(measure(&app), (cap, cap - 2), "content beyond the cap");
assert_eq!(
measure(&app),
(AVAILABLE, AVAILABLE - 2),
"long draft grows past the cap"
);
// Submitting returns the composer to its stable density floor.
assert!(app.submit_input().is_some());
+7 -4
View File
@@ -194,10 +194,13 @@ pub fn native_composer_height(
} else {
usize::from(available >= 2)
};
rows.max(floor)
.saturating_add(menu)
.saturating_add(border)
.clamp(1, usize::from(available.min(density.max_rows()))) as u16
let desired = rows.max(floor).saturating_add(menu).saturating_add(border);
let cap = if desired > usize::from(density.max_rows()) {
usize::from(available)
} else {
usize::from(available).min(usize::from(density.max_rows()))
};
desired.clamp(1, cap) as u16
}
/// Display width after the kit's control/bidi guard; raw source scalars remain