Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add clipboard support for text inputs
Erik Kundt committed 2 years ago
commit 2dfc0a9e4d42bd21ebaa1bedeaf0bca69b3900fb
parent 81966a4aca55a23ec7e272a44a7250e77e82e6a2
4 files changed +386 -3
modified Cargo.lock
@@ -165,6 +165,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"

[[package]]
+
name = "block"
+
version = "0.1.6"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
+

+
[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -199,6 +205,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"

[[package]]
+
name = "bytecount"
+
version = "0.6.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
+

+
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -252,6 +264,48 @@ dependencies = [
]

[[package]]
+
name = "cli-clipboard"
+
version = "0.4.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "04087c1d4a2aa259784a563932aee09cbb0869d490775e051096174b070f3e3d"
+
dependencies = [
+
 "clipboard-win",
+
 "objc",
+
 "objc-foundation",
+
 "objc_id",
+
 "wl-clipboard-rs",
+
 "x11-clipboard",
+
]
+

+
[[package]]
+
name = "clipboard-win"
+
version = "4.5.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362"
+
dependencies = [
+
 "error-code",
+
 "str-buf",
+
 "winapi",
+
]
+

+
[[package]]
+
name = "colorchoice"
+
version = "1.0.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
+

+
[[package]]
+
name = "colored"
+
version = "1.9.4"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355"
+
dependencies = [
+
 "is-terminal",
+
 "lazy_static",
+
 "winapi",
+
]
+

+
[[package]]
name = "const-oid"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -447,6 +501,23 @@ dependencies = [
]

[[package]]
+
name = "derive-new"
+
version = "0.5.9"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535"
+
dependencies = [
+
 "proc-macro2",
+
 "quote",
+
 "syn 1.0.109",
+
]
+

+
[[package]]
+
name = "diff"
+
version = "0.1.13"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
+

+
[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -468,6 +539,12 @@ dependencies = [
]

[[package]]
+
name = "downcast-rs"
+
version = "1.2.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
+

+
[[package]]
name = "dyn-clone"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -576,6 +653,28 @@ dependencies = [
]

[[package]]
+
name = "error-code"
+
version = "2.3.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
+
dependencies = [
+
 "libc",
+
 "str-buf",
+
]
+

+
[[package]]
+
name = "escargot"
+
version = "0.5.8"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "768064bd3a0e2bedcba91dc87ace90beea91acc41b6a01a3ca8e9aa8827461bf"
+
dependencies = [
+
 "log",
+
 "once_cell",
+
 "serde",
+
 "serde_json",
+
]
+

+
[[package]]
name = "fastrand"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -613,6 +712,12 @@ dependencies = [
]

[[package]]
+
name = "fixedbitset"
+
version = "0.4.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
+

+
[[package]]
name = "flate2"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -623,6 +728,12 @@ dependencies = [
]

[[package]]
+
name = "fnv"
+
version = "1.0.7"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+

+
[[package]]
name = "form_urlencoded"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -642,6 +753,16 @@ dependencies = [
]

[[package]]
+
name = "gethostname"
+
version = "0.2.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
+
dependencies = [
+
 "libc",
+
 "winapi",
+
]
+

+
[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -960,12 +1081,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"

[[package]]
+
name = "malloc_buf"
+
version = "0.0.6"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
+
dependencies = [
+
 "libc",
+
]
+

+
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"

[[package]]
+
name = "memoffset"
+
version = "0.6.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
+
dependencies = [
+
 "autocfg",
+
]
+

+
[[package]]
+
name = "minimal-lexical"
+
version = "0.2.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+

+
[[package]]
name = "miniz_oxide"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1007,6 +1152,28 @@ dependencies = [
]

[[package]]
+
name = "nix"
+
version = "0.24.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
+
dependencies = [
+
 "bitflags 1.3.2",
+
 "cfg-if",
+
 "libc",
+
 "memoffset",
+
]
+

+
[[package]]
+
name = "nom"
+
version = "7.1.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+
dependencies = [
+
 "memchr",
+
 "minimal-lexical",
+
]
+

+
[[package]]
name = "nonempty"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1076,6 +1243,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"

[[package]]
+
name = "objc"
+
version = "0.2.7"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
+
dependencies = [
+
 "malloc_buf",
+
]
+

+
[[package]]
+
name = "objc-foundation"
+
version = "0.1.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
+
dependencies = [
+
 "block",
+
 "objc",
+
 "objc_id",
+
]
+

+
[[package]]
+
name = "objc_id"
+
version = "0.1.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
+
dependencies = [
+
 "objc",
+
]
+

+
[[package]]
name = "once_cell"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1088,6 +1284,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"

[[package]]
+
name = "os_pipe"
+
version = "1.1.4"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177"
+
dependencies = [
+
 "libc",
+
 "windows-sys",
+
]
+

+
[[package]]
name = "p256"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1157,6 +1363,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"

[[package]]
+
name = "petgraph"
+
version = "0.6.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4"
+
dependencies = [
+
 "fixedbitset",
+
 "indexmap 1.9.3",
+
]
+

+
[[package]]
name = "phf"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1837,6 +2053,12 @@ dependencies = [
]

[[package]]
+
name = "str-buf"
+
version = "1.0.6"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
+

+
[[package]]
name = "subtle"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2002,6 +2224,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"

[[package]]
+
name = "tree_magic_mini"
+
version = "3.0.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "91adfd0607cacf6e4babdb870e9bec4037c1c4b151cfd279ccefc5e0c7feaa6d"
+
dependencies = [
+
 "bytecount",
+
 "fnv",
+
 "lazy_static",
+
 "nom",
+
 "once_cell",
+
 "petgraph",
+
]
+

+
[[package]]
name = "tui"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2029,8 +2265,9 @@ dependencies = [
[[package]]
name = "tui-realm-textarea"
version = "1.1.1"
-
source = "git+https://github.com/erak/tui-realm-textarea.git?branch=no-borders#07f8344e0d7c6448abb9df96e900bac65b8856ad"
+
source = "git+https://github.com/erak/tui-realm-textarea.git#c34d196cd477254a3b1bca28e6c105ee580b96e2"
dependencies = [
+
 "cli-clipboard",
 "lazy-regex",
 "tui-textarea",
 "tuirealm",
@@ -2212,6 +2449,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"

[[package]]
+
name = "wayland-client"
+
version = "0.29.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715"
+
dependencies = [
+
 "bitflags 1.3.2",
+
 "downcast-rs",
+
 "libc",
+
 "nix",
+
 "wayland-commons",
+
 "wayland-scanner",
+
 "wayland-sys",
+
]
+

+
[[package]]
+
name = "wayland-commons"
+
version = "0.29.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
+
dependencies = [
+
 "nix",
+
 "once_cell",
+
 "smallvec",
+
 "wayland-sys",
+
]
+

+
[[package]]
+
name = "wayland-protocols"
+
version = "0.29.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6"
+
dependencies = [
+
 "bitflags 1.3.2",
+
 "wayland-client",
+
 "wayland-commons",
+
 "wayland-scanner",
+
]
+

+
[[package]]
+
name = "wayland-scanner"
+
version = "0.29.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53"
+
dependencies = [
+
 "proc-macro2",
+
 "quote",
+
 "xml-rs",
+
]
+

+
[[package]]
+
name = "wayland-sys"
+
version = "0.29.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4"
+
dependencies = [
+
 "pkg-config",
+
]
+

+
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2228,6 +2524,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

[[package]]
+
name = "winapi-wsapoll"
+
version = "0.1.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
+
dependencies = [
+
 "winapi",
+
]
+

+
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2309,6 +2614,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

[[package]]
+
name = "wl-clipboard-rs"
+
version = "0.7.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "981a303dfbb75d659f6612d05a14b2e363c103d24f676a2d44a00d18507a1ad9"
+
dependencies = [
+
 "derive-new",
+
 "libc",
+
 "log",
+
 "nix",
+
 "os_pipe",
+
 "tempfile",
+
 "thiserror",
+
 "tree_magic_mini",
+
 "wayland-client",
+
 "wayland-protocols",
+
]
+

+
[[package]]
+
name = "x11-clipboard"
+
version = "0.7.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "980b9aa9226c3b7de8e2adb11bf20124327c054e0e5812d2aac0b5b5a87e7464"
+
dependencies = [
+
 "x11rb",
+
]
+

+
[[package]]
+
name = "x11rb"
+
version = "0.10.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507"
+
dependencies = [
+
 "gethostname",
+
 "nix",
+
 "winapi",
+
 "winapi-wsapoll",
+
 "x11rb-protocol",
+
]
+

+
[[package]]
+
name = "x11rb-protocol"
+
version = "0.10.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67"
+
dependencies = [
+
 "nix",
+
]
+

+
[[package]]
name = "xattr"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2318,6 +2672,27 @@ dependencies = [
]

[[package]]
+
name = "xml-rs"
+
version = "0.8.16"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1"
+

+
[[package]]
+
name = "yaml-rust"
+
version = "0.4.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+
dependencies = [
+
 "linked-hash-map",
+
]
+

+
[[package]]
+
name = "yansi"
+
version = "0.5.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
+

+
[[package]]
name = "zeroize"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
modified Cargo.toml
@@ -22,4 +22,4 @@ timeago = { version = "0.4.1" }
textwrap = { version = "0.16.0" }
tuirealm = { version = "1.8.0", default-features = false, features = [ "with-termion" ] }
tui-realm-stdlib = { version = "1.2.0", default-features = false, features = [ "with-termion" ] }
-
tui-realm-textarea = { git = "https://github.com/erak/tui-realm-textarea.git", branch = "no-borders", default-features = false, features = [ "with-termion" ] }
+
tui-realm-textarea = { git = "https://github.com/erak/tui-realm-textarea.git", default-features = false, features = [ "with-termion", "clipboard" ] }
modified src/app/event.rs
@@ -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
@@ -227,6 +227,13 @@ impl tuirealm::Component<Message, NoUserEvent> for Widget<issue::NewForm> {
                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),
                ..
            }) => {
modified src/ui/widget/common/form.rs
@@ -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()