iris: add positioned text overflow
This commit is contained in:
1 parent
cb5f11d21a
commit
1f0a7b5f94
22 files changed
+771
-43
No files matched your search
@@ -53,7 +53,7 @@ where
|
||||
let field = wtext("")
|
||||
.editable(EditMode::MultiLine)
|
||||
.text_align(Align::LEFT)
|
||||
.wrap(true)
|
||||
.overflow(TextOverflow::Wrap)
|
||||
.size(18)
|
||||
.color(theme.text.clone())
|
||||
.attr::<Selectable>(())
|
||||
|
||||
+7
-3
@@ -197,7 +197,11 @@ where
|
||||
let field = wtext(rendered.text)
|
||||
.spans(rendered.spans)
|
||||
.text_align(Align::LEFT)
|
||||
.wrap(!verbatim)
|
||||
.overflow(if verbatim {
|
||||
TextOverflow::Visible
|
||||
} else {
|
||||
TextOverflow::Wrap
|
||||
})
|
||||
.family(if verbatim { MONOSPACE } else { SANS_SERIF })
|
||||
.size(BASE_SIZE)
|
||||
.color(match frame {
|
||||
@@ -218,8 +222,8 @@ where
|
||||
.unwrap_or(SelectionInput::Tapped);
|
||||
// Panning or selecting across a link must not open it.
|
||||
if outcome == SelectionInput::Tapped {
|
||||
let byte = field.selection(rsc).byte_at(pos, size);
|
||||
let url = tap_links.url_at(byte);
|
||||
let byte = field.selection(rsc).source_byte_at(pos, size);
|
||||
let url = byte.and_then(|byte| tap_links.url_at(byte));
|
||||
if let Some(url) = url {
|
||||
log::info!("iris link: opening {url}");
|
||||
<Rsc::State as OpenUrl>::open_url(ctx.state, &url);
|
||||
|
||||
+1
-2
@@ -87,7 +87,7 @@ fn raw_block<Rsc: HasEvents>(rsc: &mut Rsc, body: TextBuilder<Rsc>, theme: &Them
|
||||
where
|
||||
Rsc::State: FocusHost,
|
||||
{
|
||||
let field = body.family(MONOSPACE).size(BODY_SIZE).wrap(false).add(rsc);
|
||||
let field = body.family(MONOSPACE).size(BODY_SIZE).add(rsc);
|
||||
field
|
||||
.scrollable(Axis::X, Pin::Start)
|
||||
.pad(dp(RAW_PAD_DP))
|
||||
@@ -281,7 +281,6 @@ where
|
||||
}
|
||||
(false, Some(title)) => header.push(
|
||||
text(title.to_string(), BODY_SIZE, shared.theme.muted.clone())
|
||||
.wrap(false)
|
||||
.masked()
|
||||
.width(rest(1))
|
||||
.add_strong(rsc)
|
||||
|
||||
Reference in new issue
Block a user