Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sha2 = "0.10"
sled = "0.34"
bincode = "2"
arboard = "3"
base64 = "0.22"

[workspace.package]
description = "An interactive, Rust-powered shell history search tool inspired by hstr"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cargo test
## 🛠 Update the version

```zsh
cargo release 1.4.0 --no-push --no-tag --no-publish --execute
cargo patch --no-push --no-tag --no-publish --execute
cargo minor --no-push --no-tag --no-publish --execute
cargo release major --no-push --no-tag --no-publish --execute
cargo relase patch --no-push --no-tag --no-publish --execute
cargo release minor --no-push --no-tag --no-publish --execute
```
Empty file added clippy.toml
Empty file.
2 changes: 1 addition & 1 deletion rushstr-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rushstr-core"
version = "1.4.1"
version = "1.4.2"
edition = "2024"
description = "An interactive, Rust-powered shell history search tool inspired by hstr"
license = "MIT"
Expand Down
5 changes: 3 additions & 2 deletions rushstr-tui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rushstr-tui"
version = "1.4.1"
version = "1.4.2"
edition = "2024"
description = "An interactive, Rust-powered shell history search tool inspired by hstr"
license = "MIT"
Expand All @@ -13,4 +13,5 @@ crossterm.workspace = true
ratatui.workspace = true
anyhow.workspace = true
arboard.workspace = true
rushstr-core = { path = "../rushstr-core", version = "1.4.1" }
base64.workspace = true
rushstr-core = { path = "../rushstr-core", version = "1.4.2" }
19 changes: 17 additions & 2 deletions rushstr-tui/src/ux/search_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl SearchUI {
},
KeyCode::Char('c') if key.modifiers == KeyModifiers::CONTROL => {
if let Some(cmd) = items.get(ui_state.selected) {
Clipboard::new()?.set_text(cmd.raw_text())?;
copy_to_clipboard(cmd);
}
return Ok(None);
},
Expand Down Expand Up @@ -97,6 +97,21 @@ impl SearchUI {
}
}

/// Copies the raw text of a command to the system clipboard.
///
/// This function first attempts to use the system clipboard via the `arboard`
/// crate.
///
/// # Parameters
/// - `cmd`: A reference to the `HItem` whose raw text will be copied.
#[allow(clippy::collapsible_if)]
fn copy_to_clipboard(cmd: &HItem) {
// Try using system clipboard via arboard
if let Ok(mut clipboard) = Clipboard::new() {
let _ = clipboard.set_text(cmd.raw_text());
}
}

/// Returns the raw text of the currently selected item in the list, if any.
/// Also marks the item as "hit" in the store.
///
Expand Down Expand Up @@ -127,7 +142,7 @@ fn get_selected(items: &[HItem], ui_state: &UiState, store: &Store) -> anyhow::R
/// * `ui_state` - Mutable reference to the UI state.
/// * `char` - The character to append to the input.
fn put_char(ui_state: &mut UiState, char: char) {
if ui_state.search_options.input.len() < 50 {
if ui_state.search_options.input.len() < 150 {
ui_state.search_options.input.push(char);
ui_state.selected = 0;
ui_state.offset = 0;
Expand Down
6 changes: 3 additions & 3 deletions rushstr/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rushstr"
version = "1.4.1"
version = "1.4.2"
edition = "2024"
description = "An interactive, Rust-powered shell history search tool inspired by hstr"
license = "MIT"
Expand All @@ -11,8 +11,8 @@ homepage = "https://github.com/donhk/rushstr"
[dependencies]
anyhow.workspace = true
clap.workspace = true
rushstr-core = { path = "../rushstr-core", version = "1.4.1" }
rushstr-tui = { path = "../rushstr-tui", version = "1.4.1" }
rushstr-core = { path = "../rushstr-core", version = "1.4.2" }
rushstr-tui = { path = "../rushstr-tui", version = "1.4.2" }

[[bin]]
name = "rushstr"
Expand Down