From 918e653a0ad799223f2deb10a0d8666757787cde Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Sun, 22 Nov 2026 20:18:58 +0100 Subject: [PATCH] app: wrap the clip view's title instead of letting it widen the panel A clip exported from a recording carries the recording's uuid as its name, long enough to push the title field past the panel and the window. The field now wraps, one to two lines tall, scrolling inside when there is more, and the panel holds its width; the header beside it truncates with an ellipsis as it already did. Return makes a new line in a wrapping field, so saving is the button's job alone. --- app/src/screens/clip.rs | 43 +++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/app/src/screens/clip.rs b/app/src/screens/clip.rs index c1a1bdc..6ce6ffa 100644 --- a/app/src/screens/clip.rs +++ b/app/src/screens/clip.rs @@ -5,8 +5,8 @@ use rune::tok::{radius, space, type_}; use rune::{ - ClipboardContent, Color, El, Player, PlayerState, SurfaceFit, TextEdit, Tx, col, el, row, text, - text_input, + ClipboardContent, Color, El, Player, PlayerState, SurfaceFit, TextEdit, Tx, auto_grow, col, el, + row, text, text_input, }; use crate::app::{App, Screen}; @@ -198,6 +198,7 @@ pub fn view(app: &App, p: Paint) -> El { col() .key("side") .w(300.0) + .shrink() .gap(space::S3) .items_start() .child( @@ -229,18 +230,32 @@ pub fn view(app: &App, p: Paint) -> El { .color(p.muted()), ) .child( - text_input(&view.title, type_::BODY) - .key("title-field") - .single_line() - .placeholder("Clip title", p.muted()) - .on_edit(|app: &mut App| { - &mut app - .clip - .as_mut() - .expect("the field lives on the open clip") - .title - }) - .on_submit(|app: &mut App, _tx: &mut Tx| save_title(app)), + // A file's name can run long: the field wraps instead of widening the + // panel, one to two lines tall, scrolling inside when there is more. + // Return makes a new line here, so the button is what saves the title. + auto_grow( + text_input(&view.title, type_::BODY) + .key("title-field") + .placeholder("Clip title", p.muted()) + .on_edit(|app: &mut App| { + &mut app + .clip + .as_mut() + .expect("the field lives on the open clip") + .title + }), + 1, + 2, + ) + .placeholder("Clip title", p.muted()) + .on_edit(|app: &mut App| { + &mut app + .clip + .as_mut() + .expect("the field lives on the open clip") + .title + }) + .on_submit(|app: &mut App, _tx: &mut Tx| save_title(app)), ) .child( row()