feat(gui:list): allow copying package-names#1377
Conversation
Double click them and use CTRL+C to copy Ran cargo fmt
There was a problem hiding this comment.
Pull request overview
Adds support for copying package names from the GUI package list by making the displayed package name selectable/copyable.
Changes:
- Replace the package-name label in each package row with an
icedtext_inputso users can select and copy it. - Add a
Nooprow message and handle it in the list view to ignore edits from thetext_input. - Minor import adjustments to support the new message handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/gui/widgets/package_row.rs |
Makes the package name render as a text_input and introduces Message::Noop. |
src/gui/views/list.rs |
Handles the new Noop message when processing row messages (and adds an extra alias import). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| row![ | ||
| button( | ||
| row![ | ||
| selection_checkbox, | ||
| text(&self.name).width(Length::FillPortion(8)), | ||
| // Allows the packagename text to be copyable | ||
| text_input("", &self.name) | ||
| .on_input(|_| Message::Noop) | ||
| .padding(0) | ||
| .size(14) | ||
| .width(Length::FillPortion(8)), |
There was a problem hiding this comment.
Using a text_input for the package name makes this central area a focusable/interactive widget. In Iced, interactive children typically consume mouse events, so clicking the package name may no longer trigger the row’s outer .on_press(Message::PackagePressed) (regression in selecting/highlighting a row by clicking its name). Consider implementing copy-to-clipboard without replacing the label with an input (e.g., handle Ctrl+C / double-click at the row/list level and write the package name to the clipboard), or otherwise ensure clicks on the name still publish PackagePressed.
| use crate::gui::views::settings::Settings; | ||
| use crate::gui::widgets::modal::Modal; | ||
| use crate::gui::widgets::navigation_menu::ICONS; | ||
| use crate::gui::widgets::package_row::Message as PackageRowMessage; | ||
| use std::path::PathBuf; | ||
|
|
||
| use crate::gui::views::settings::Settings; | ||
| use crate::gui::widgets::modal::Modal; | ||
| use crate::gui::widgets::package_row::{Message as RowMessage, PackageRow}; | ||
| use crate::gui::widgets::text; |
There was a problem hiding this comment.
PackageRowMessage is an alias of the same enum already imported as RowMessage from package_row. Importing both and matching on PackageRowMessage::Noop while using RowMessage::* for the other variants is redundant and makes the match harder to follow; it can be simplified by using a single alias (e.g., RowMessage::Noop) and removing the extra import.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@lawson85 Could you also follow-up with the other Copilot comments? |
Description
I have made it so that you can copy package names, if you select it or double click and use CTRL + C
Related issues
closes #1304
Checklist