From 622893ebf04d00d1930ea68b5dd59182177f68d7 Mon Sep 17 00:00:00 2001 From: trimill Date: Thu, 2 Jan 2025 22:39:29 -0500 Subject: [PATCH] update rustyline --- Cargo.lock | 34 ++++++++-------------------------- talc-bin/Cargo.toml | 2 +- talc-bin/src/helper.rs | 9 ++++++--- talc-lang/Cargo.toml | 2 +- 4 files changed, 16 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2dcd065..c764966 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,12 +41,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "cfg_aliases" version = "0.2.1" @@ -106,7 +100,7 @@ version = "3.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90eeab0aa92f3f9b4e87f258c72b139c207d251f9cbc1080a0086b86a8870dd3" dependencies = [ - "nix 0.29.0", + "nix", "windows-sys 0.59.0", ] @@ -208,18 +202,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "nix" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" -dependencies = [ - "bitflags", - "cfg-if", - "cfg_aliases 0.1.1", - "libc", -] - [[package]] name = "nix" version = "0.29.0" @@ -228,7 +210,7 @@ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ "bitflags", "cfg-if", - "cfg_aliases 0.2.1", + "cfg_aliases", "libc", ] @@ -417,9 +399,9 @@ dependencies = [ [[package]] name = "rustyline" -version = "14.0.0" +version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e8936da37efd9b6d4478277f4b2b9bb5cdb37a113e8d63222e58da647e63" +checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" dependencies = [ "bitflags", "cfg-if", @@ -429,12 +411,12 @@ dependencies = [ "libc", "log", "memchr", - "nix 0.28.0", + "nix", "radix_trie", "unicode-segmentation", "unicode-width", "utf8parse", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -509,9 +491,9 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.14" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "utf8parse" diff --git a/talc-bin/Cargo.toml b/talc-bin/Cargo.toml index 6910760..5b9ada1 100644 --- a/talc-bin/Cargo.toml +++ b/talc-bin/Cargo.toml @@ -14,7 +14,7 @@ path = "src/main.rs" [dependencies] talc-lang = { path = "../talc-lang" } talc-std = { path = "../talc-std" } -rustyline = "14.0" +rustyline = "15.0" clap = { version = "4.5", features = ["std", "help", "usage", "derive", "error-context"], default-features = false } ctrlc = "3.4" lazy_static = "1.5" diff --git a/talc-bin/src/helper.rs b/talc-bin/src/helper.rs index 8efa9ae..d01517a 100644 --- a/talc-bin/src/helper.rs +++ b/talc-bin/src/helper.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, cell::RefCell, rc::Rc}; use rustyline::{ completion::Completer, - highlight::Highlighter, + highlight::{CmdKind, Highlighter}, hint::Hinter, validate::{ValidationContext, ValidationResult, Validator}, Helper, Result, @@ -105,8 +105,11 @@ impl Highlighter for TalcHelper { Cow::Owned(format!("\x1b[37m{hint}\x1b[0m")) } - fn highlight_char(&self, line: &str, _: usize, forced: bool) -> bool { - forced || !line.is_empty() + fn highlight_char(&self, line: &str, _: usize, forced: CmdKind) -> bool { + match forced { + CmdKind::ForcedRefresh => true, + _ => !line.is_empty(), + } } } diff --git a/talc-lang/Cargo.toml b/talc-lang/Cargo.toml index a13d3da..5130336 100644 --- a/talc-lang/Cargo.toml +++ b/talc-lang/Cargo.toml @@ -8,6 +8,6 @@ rust-version = "1.81.0" workspace = true [dependencies] -num = { version = "0.4", features = [] } +num = "0.4" lazy_static = "1.5" unicode-ident = "1.0"