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.
This commit is contained in:
vhaudiquet committed 2026-11-22 20:18:58 +01:00
1 parent 9ce2b75568
commit 918e653a0a
1 file changed
+29 -14
+29 -14
View File
@@ -5,8 +5,8 @@
use rune::tok::{radius, space, type_}; use rune::tok::{radius, space, type_};
use rune::{ use rune::{
ClipboardContent, Color, El, Player, PlayerState, SurfaceFit, TextEdit, Tx, col, el, row, text, ClipboardContent, Color, El, Player, PlayerState, SurfaceFit, TextEdit, Tx, auto_grow, col, el,
text_input, row, text, text_input,
}; };
use crate::app::{App, Screen}; use crate::app::{App, Screen};
@@ -198,6 +198,7 @@ pub fn view(app: &App, p: Paint) -> El {
col() col()
.key("side") .key("side")
.w(300.0) .w(300.0)
.shrink()
.gap(space::S3) .gap(space::S3)
.items_start() .items_start()
.child( .child(
@@ -229,18 +230,32 @@ pub fn view(app: &App, p: Paint) -> El {
.color(p.muted()), .color(p.muted()),
) )
.child( .child(
text_input(&view.title, type_::BODY) // A file's name can run long: the field wraps instead of widening the
.key("title-field") // panel, one to two lines tall, scrolling inside when there is more.
.single_line() // Return makes a new line here, so the button is what saves the title.
.placeholder("Clip title", p.muted()) auto_grow(
.on_edit(|app: &mut App| { text_input(&view.title, type_::BODY)
&mut app .key("title-field")
.clip .placeholder("Clip title", p.muted())
.as_mut() .on_edit(|app: &mut App| {
.expect("the field lives on the open clip") &mut app
.title .clip
}) .as_mut()
.on_submit(|app: &mut App, _tx: &mut Tx| save_title(app)), .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( .child(
row() row()