mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-29 06:20:28 +08:00
Add clipboard support for text inputs
This commit is contained in:
+8
-1
@@ -14,7 +14,7 @@ use radicle_tui::ui::widget::{issue, patch};
|
||||
|
||||
use radicle_tui::ui::widget::Widget;
|
||||
|
||||
use super::{IssueCid, IssueMessage, Message, PatchMessage, PopupMessage, IssueCobMessage};
|
||||
use super::{IssueCid, IssueCobMessage, IssueMessage, Message, PatchMessage, PopupMessage};
|
||||
|
||||
/// Since the framework does not know the type of messages that are being
|
||||
/// passed around in the app, the following handlers need to be implemented for
|
||||
@@ -226,6 +226,13 @@ impl tuirealm::Component<Message, NoUserEvent> for Widget<issue::NewForm> {
|
||||
self.perform(Cmd::Type(ch.to_ascii_uppercase()));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('v'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
}) => {
|
||||
self.perform(Cmd::Custom(TextInput::CMD_PASTE));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Char(ch),
|
||||
..
|
||||
|
||||
@@ -21,6 +21,7 @@ pub struct TextInput {
|
||||
impl TextInput {
|
||||
pub const PROP_MULTILINE: &str = "multiline";
|
||||
pub const CMD_NEWLINE: &str = tui_realm_textarea::TEXTAREA_CMD_NEWLINE;
|
||||
pub const CMD_PASTE: &str = tui_realm_textarea::TEXTAREA_CMD_PASTE;
|
||||
|
||||
pub fn new(theme: Theme, title: &str) -> Self {
|
||||
let input = TextArea::default()
|
||||
|
||||
Reference in New Issue
Block a user