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()