Add context menu to text fields and Selectable Text widget (#1815)
- Adds context menu to text input fields - Adds selectable text to context drawer, but only to file name, created/modified/accessed date. I'm sure more places could use the selectable text. - Also pulls the latest changes in Iced and libcosmic that removes "redraw on any message", which means moving the cursor doesn't automatically call a redraw, widgets need to ask for it. I have found all places that previously was working normally because we were redrawing almost unconditionally. But it is possible that a custom widget somewhere still isn't asking for a redraw explicitly when its state changes. So, for QA I'd keep an eye on that. Depends on: - [x] https://github.com/pop-os/libcosmic/pull/1288 - [x] https://github.com/pop-os/iced/pull/378 - [x] https://github.com/pop-os/libcosmic/pull/1384 - [x] https://github.com/pop-os/libcosmic/pull/1388 https://github.com/user-attachments/assets/caf8f940-0793-4665-844a-b6153b35d7bb ___ - [x] I have disclosed use of any AI generated code in my commit messages. - If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR. - In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment. - [x] I understand these changes in full and will be able to respond to review comments. - [x] My change is accurately described in the commit message. - [x] My contribution is tested and working as described. - [x] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.
This commit is contained in:
commit
6e210a3753
2 changed files with 31 additions and 31 deletions
40
Cargo.lock
generated
40
Cargo.lock
generated
|
|
@ -826,7 +826,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "build_helpers"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"cfg_aliases",
|
||||
]
|
||||
|
|
@ -1359,7 +1359,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"atomicwrites",
|
||||
"cosmic-config-derive",
|
||||
|
|
@ -1380,7 +1380,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config-derive"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
|
|
@ -1551,7 +1551,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-theme"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"almost",
|
||||
"configparser",
|
||||
|
|
@ -2871,7 +2871,7 @@ dependencies = [
|
|||
"log",
|
||||
"presser",
|
||||
"thiserror 2.0.19",
|
||||
"windows 0.62.2",
|
||||
"windows 0.56.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3105,7 +3105,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core 0.62.2",
|
||||
"windows-core 0.56.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3120,7 +3120,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"build_helpers",
|
||||
"dnd",
|
||||
|
|
@ -3142,7 +3142,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_accessibility"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_winit",
|
||||
|
|
@ -3151,7 +3151,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"build_helpers",
|
||||
|
|
@ -3177,7 +3177,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_debug"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
|
|
@ -3187,7 +3187,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"iced_core",
|
||||
|
|
@ -3201,7 +3201,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_graphics"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"bytemuck",
|
||||
|
|
@ -3222,7 +3222,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_program"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"iced_graphics",
|
||||
"iced_runtime",
|
||||
|
|
@ -3231,7 +3231,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_renderer"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"iced_graphics",
|
||||
"iced_tiny_skia",
|
||||
|
|
@ -3243,7 +3243,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_runtime"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"build_helpers",
|
||||
"bytes",
|
||||
|
|
@ -3259,7 +3259,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_tiny_skia"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cosmic-text",
|
||||
|
|
@ -3276,7 +3276,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_wgpu"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"as-raw-xcb-connection",
|
||||
"bitflags 2.13.1",
|
||||
|
|
@ -3308,7 +3308,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_widget"
|
||||
version = "0.14.2"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"build_helpers",
|
||||
"cosmic-client-toolkit",
|
||||
|
|
@ -3327,7 +3327,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_winit"
|
||||
version = "0.14.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"build_helpers",
|
||||
"cosmic-client-toolkit",
|
||||
|
|
@ -4449,7 +4449,7 @@ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|||
[[package]]
|
||||
name = "libcosmic"
|
||||
version = "1.0.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#0ca1b784c931c946517379795ce87328c6a902b8"
|
||||
source = "git+https://github.com/pop-os/libcosmic.git#1f8d8786940cc6db59d412153c5a03f69a20375c"
|
||||
dependencies = [
|
||||
"apply",
|
||||
"ashpd 0.12.3",
|
||||
|
|
|
|||
22
src/tab.rs
22
src/tab.rs
|
|
@ -2386,10 +2386,8 @@ impl Item {
|
|||
widget::image(handle.clone()).into()
|
||||
}
|
||||
ItemThumbnail::Svg(handle) => widget::svg(handle.clone()).into(),
|
||||
ItemThumbnail::Text(content) => widget::text_editor(content)
|
||||
.class(cosmic::theme::iced::TextEditor::Custom(Box::new(
|
||||
text_editor_class,
|
||||
)))
|
||||
ItemThumbnail::Text(content) => widget::text_editor::text_editor(content)
|
||||
.style(text_editor_class)
|
||||
.width(THUMBNAIL_SIZE as f32)
|
||||
.height(Length::Fixed(THUMBNAIL_SIZE as f32))
|
||||
.padding(spacing.space_xxs)
|
||||
|
|
@ -2440,7 +2438,7 @@ impl Item {
|
|||
);
|
||||
|
||||
let mut details = widget::column::with_capacity(8).spacing(space_xxxs);
|
||||
details = details.push(widget::text::heading(self.name.clone()));
|
||||
details = details.push(widget::selectable_text::heading(self.name.clone()));
|
||||
details = details.push(widget::text::body(fl!(
|
||||
"type",
|
||||
mime = self.mime.to_string()
|
||||
|
|
@ -2497,21 +2495,21 @@ impl Item {
|
|||
let time_formatter = time_formatter(military_time);
|
||||
|
||||
if let Ok(time) = metadata.created() {
|
||||
details = details.push(widget::text::body(fl!(
|
||||
details = details.push(widget::selectable_text::body(fl!(
|
||||
"item-created",
|
||||
created = format_time(time, &date_time_formatter, &time_formatter).to_string()
|
||||
)));
|
||||
}
|
||||
|
||||
if let Ok(time) = metadata.modified() {
|
||||
details = details.push(widget::text::body(fl!(
|
||||
details = details.push(widget::selectable_text::body(fl!(
|
||||
"item-modified",
|
||||
modified = format_time(time, &date_time_formatter, &time_formatter).to_string()
|
||||
)));
|
||||
}
|
||||
|
||||
if let Ok(time) = metadata.accessed() {
|
||||
details = details.push(widget::text::body(fl!(
|
||||
details = details.push(widget::selectable_text::body(fl!(
|
||||
"item-accessed",
|
||||
accessed = format_time(time, &date_time_formatter, &time_formatter).to_string()
|
||||
)));
|
||||
|
|
@ -5178,9 +5176,11 @@ impl Tab {
|
|||
}
|
||||
ItemThumbnail::Text(text) => {
|
||||
element_opt = Some(
|
||||
widget::container(widget::text_editor(text).padding(space_xxs).class(
|
||||
cosmic::theme::iced::TextEditor::Custom(Box::new(text_editor_class)),
|
||||
))
|
||||
widget::container(
|
||||
widget::text_editor::text_editor(text)
|
||||
.padding(space_xxs)
|
||||
.style(text_editor_class),
|
||||
)
|
||||
.center(Length::Fill)
|
||||
.into(),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue