Skip to content

Commit 9176f89

Browse files
authored
Moved hot key handling and clipboard impl to crossterm. (#95)
* Move hot key handling and clipboard impl to crossterm * Add '\r' to error messages that meant to be printed in raw mode In raw mode, the cursor won't go back to line beginning when '\n' is printed. A '\r' would mannually reset the error message. * Try fix Windows build. * Use windows-sys to minimize Windows dependencies. * Reuse windows-sys 0.59.0 as other deps. * Fix Windows syscall convention: > If the function succeeds, the return value is nonzero. * Add `Safety` comment to newly added `unsafe` call. * Replace UNIX `Ctrl+C` handler to use `libc::raise` * Extract `handle_key_press` into a function.
1 parent 2662417 commit 9176f89

File tree

3 files changed

+182
-56
lines changed

3 files changed

+182
-56
lines changed

Cargo.lock

Lines changed: 94 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,17 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
3535
walkdir = "2.4.0"
3636
data-encoding = "2.6.0"
3737
n0-future = "0.1.2"
38-
base64 = { version = "0.22.1", optional = true }
3938
hex = "0.4.3"
39+
crossterm = { version = "0.29.0", features = [
40+
"event-stream",
41+
"osc52",
42+
], optional = true }
43+
44+
[target.'cfg(unix)'.dependencies]
45+
libc = { version = "0.2.174", optional = true }
46+
47+
[target.'cfg(windows)'.dependencies]
48+
windows-sys = { version = "0.59.0", features = ["Win32_System_Console"], optional = true }
4049

4150
[dev-dependencies]
4251
duct = "0.13.6"
@@ -46,7 +55,7 @@ serde_json = "1.0.108"
4655
tempfile = "3.8.1"
4756

4857
[features]
49-
clipboard = ["dep:base64"]
58+
clipboard = ["dep:crossterm", "dep:windows-sys", "dep:libc"]
5059
default = ["clipboard"]
5160

5261
[patch.crates-io]

0 commit comments

Comments
 (0)