From 6971bfc3d4570697fa6b29678e501464cc9deddf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 May 2021 20:39:12 +0000 Subject: [PATCH] cargo: bump rustyline from 4.1.0 to 8.0.0 (#2402) --- Cargo.lock | 148 +++++++++++++++++++++--------------------- Cargo.toml | 2 +- examples/repl/main.rs | 17 +++-- 3 files changed, 84 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a920ab79b..a40102a94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,12 +137,6 @@ version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - [[package]] name = "arrayvec" version = "0.5.2" @@ -522,17 +516,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "blake2b_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] - [[package]] name = "block-buffer" version = "0.9.0" @@ -792,12 +775,6 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - [[package]] name = "cookie" version = "0.14.4" @@ -1131,7 +1108,7 @@ dependencies = [ "chrono", "criterion", "deltachat_derive", - "dirs 3.0.2", + "dirs", "email", "encoded-words", "escaper", @@ -1255,17 +1232,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "dirs" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" -dependencies = [ - "libc", - "redox_users 0.3.5", - "winapi", -] - [[package]] name = "dirs" version = "3.0.2" @@ -1275,6 +1241,16 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + [[package]] name = "dirs-sys" version = "0.3.6" @@ -1282,7 +1258,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ "libc", - "redox_users 0.4.0", + "redox_users", + "winapi", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", "winapi", ] @@ -1423,6 +1410,12 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + [[package]] name = "entities" version = "1.0.1" @@ -1554,6 +1547,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "futures" version = "0.3.14" @@ -2268,16 +2271,24 @@ dependencies = [ ] [[package]] -name = "nix" -version = "0.13.1" +name = "nibble_vec" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "nix" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" dependencies = [ "bitflags", "cc", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "void", ] [[package]] @@ -2832,6 +2843,16 @@ dependencies = [ "rusqlite", ] +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + [[package]] name = "rand" version = "0.7.3" @@ -2963,17 +2984,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" -dependencies = [ - "getrandom 0.1.16", - "redox_syscall 0.1.57", - "rust-argon2", -] - [[package]] name = "redox_users" version = "0.4.0" @@ -3098,18 +3108,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "rust-argon2" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" -dependencies = [ - "base64 0.13.0", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils 0.8.3", -] - [[package]] name = "rust-hsluv" version = "0.1.4" @@ -3145,15 +3143,21 @@ dependencies = [ [[package]] name = "rustyline" -version = "4.1.0" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f47ea1ceb347d2deae482d655dc8eef4bd82363d3329baffa3818bd76fea48b" +checksum = "b9e1b597fcd1eeb1d6b25b493538e5aa19629eb08932184b85fef931ba87e893" dependencies = [ - "dirs 1.0.5", + "bitflags", + "cfg-if 1.0.0", + "dirs-next", + "fs2", "libc", "log", "memchr", "nix", + "radix_trie", + "scopeguard", + "smallvec", "unicode-segmentation", "unicode-width", "utf8parse", @@ -3893,9 +3897,9 @@ dependencies = [ [[package]] name = "utf8parse" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d" +checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" [[package]] name = "uuid" @@ -3940,12 +3944,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - [[package]] name = "wait-timeout" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 0c4973571..19bd07f80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ rand = "0.7.0" regex = "1.4.6" rusqlite = "0.25" rust-hsluv = "0.1.4" -rustyline = { version = "4.1.0", optional = true } +rustyline = { version = "8.0.0", optional = true } sanitize-filename = "0.3.0" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } diff --git a/examples/repl/main.rs b/examples/repl/main.rs index ac3b8be50..328389870 100644 --- a/examples/repl/main.rs +++ b/examples/repl/main.rs @@ -26,8 +26,9 @@ use rustyline::config::OutputStreamType; use rustyline::error::ReadlineError; use rustyline::highlight::{Highlighter, MatchingBracketHighlighter}; use rustyline::hint::{Hinter, HistoryHinter}; +use rustyline::validate::Validator; use rustyline::{ - Cmd, CompletionType, Config, Context as RustyContext, EditMode, Editor, Helper, KeyPress, + Cmd, CompletionType, Config, Context as RustyContext, EditMode, Editor, Helper, KeyEvent, }; mod cmdline; @@ -237,7 +238,9 @@ const MISC_COMMANDS: [&str; 10] = [ ]; impl Hinter for DcHelper { - fn hint(&self, line: &str, pos: usize, ctx: &RustyContext<'_>) -> Option { + type Hint = String; + + fn hint(&self, line: &str, pos: usize, ctx: &RustyContext<'_>) -> Option { if !line.is_empty() { for &cmds in &[ &IMEX_COMMANDS[..], @@ -259,11 +262,10 @@ impl Hinter for DcHelper { } static COLORED_PROMPT: &str = "\x1b[1;32m> \x1b[0m"; -static PROMPT: &str = "> "; impl Highlighter for DcHelper { - fn highlight_prompt<'p>(&self, prompt: &'p str) -> Cow<'p, str> { - if prompt == PROMPT { + fn highlight_prompt<'b, 's: 'b, 'p: 'b>(&self, prompt: &'p str, default: bool) -> Cow<'b, str> { + if default { Borrowed(COLORED_PROMPT) } else { Borrowed(prompt) @@ -284,6 +286,7 @@ impl Highlighter for DcHelper { } impl Helper for DcHelper {} +impl Validator for DcHelper {} async fn start(args: Vec) -> Result<(), Error> { if args.len() < 2 { @@ -317,8 +320,8 @@ async fn start(args: Vec) -> Result<(), Error> { }; let mut rl = Editor::with_config(config); rl.set_helper(Some(h)); - rl.bind_sequence(KeyPress::Meta('N'), Cmd::HistorySearchForward); - rl.bind_sequence(KeyPress::Meta('P'), Cmd::HistorySearchBackward); + rl.bind_sequence(KeyEvent::alt('N'), Cmd::HistorySearchForward); + rl.bind_sequence(KeyEvent::alt('P'), Cmd::HistorySearchBackward); if rl.load_history(".dc-history.txt").is_err() { println!("No previous history."); }