aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaximilian Bosch <[email protected]>2021-12-26 14:22:57 +0000
committerMaximilian Bosch <[email protected]>2021-12-30 17:06:49 +0000
commit4fd3ec330a89e4177099c21277d3c12e97ca0c21 (patch)
treea7cf2cb469b8d7b1285910af61472b1ea2bd05a8
parentcb3e69df8b17ffc0cab721e2dcc285731a1c5bc9 (diff)
Update rustyline to v9
Also refresh line always. This isn't a big deal for the small expressions we have here and also fixes a few annoying issues I had with the highlighter.
-rw-r--r--Cargo.lock248
-rw-r--r--Cargo.toml2
-rw-r--r--src/readline.rs7
3 files changed, 222 insertions, 35 deletions
diff --git a/Cargo.lock b/Cargo.lock
index de51705..48a5246 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,7 @@
1# This file is automatically @generated by Cargo. 1# This file is automatically @generated by Cargo.
2# It is not intended for manual editing. 2# It is not intended for manual editing.
3version = 3
4
3[[package]] 5[[package]]
4name = "aho-corasick" 6name = "aho-corasick"
5version = "0.7.10" 7version = "0.7.10"
@@ -55,9 +57,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
55 57
56[[package]] 58[[package]]
57name = "bitflags" 59name = "bitflags"
58version = "1.2.1" 60version = "1.3.2"
59source = "registry+https://github.com/rust-lang/crates.io-index" 61source = "registry+https://github.com/rust-lang/crates.io-index"
60checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 62checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
61 63
62[[package]] 64[[package]]
63name = "blake2b_simd" 65name = "blake2b_simd"
@@ -83,6 +85,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
83checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 85checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
84 86
85[[package]] 87[[package]]
88name = "cfg-if"
89version = "1.0.0"
90source = "registry+https://github.com/rust-lang/crates.io-index"
91checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
92
93[[package]]
86name = "clap" 94name = "clap"
87version = "2.33.0" 95version = "2.33.0"
88source = "registry+https://github.com/rust-lang/crates.io-index" 96source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -98,6 +106,17 @@ dependencies = [
98] 106]
99 107
100[[package]] 108[[package]]
109name = "clipboard-win"
110version = "4.2.2"
111source = "registry+https://github.com/rust-lang/crates.io-index"
112checksum = "3db8340083d28acb43451166543b98c838299b7e0863621be53a338adceea0ed"
113dependencies = [
114 "error-code",
115 "str-buf",
116 "winapi",
117]
118
119[[package]]
101name = "constant_time_eq" 120name = "constant_time_eq"
102version = "0.1.5" 121version = "0.1.5"
103source = "registry+https://github.com/rust-lang/crates.io-index" 122source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -110,7 +129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
110checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" 129checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
111dependencies = [ 130dependencies = [
112 "autocfg", 131 "autocfg",
113 "cfg-if", 132 "cfg-if 0.1.10",
114 "lazy_static", 133 "lazy_static",
115] 134]
116 135
@@ -120,19 +139,18 @@ version = "2.0.2"
120source = "registry+https://github.com/rust-lang/crates.io-index" 139source = "registry+https://github.com/rust-lang/crates.io-index"
121checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c" 140checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c"
122dependencies = [ 141dependencies = [
123 "cfg-if", 142 "cfg-if 0.1.10",
124 "dirs-sys", 143 "dirs-sys",
125] 144]
126 145
127[[package]] 146[[package]]
128name = "dirs" 147name = "dirs-next"
129version = "1.0.5" 148version = "2.0.0"
130source = "registry+https://github.com/rust-lang/crates.io-index" 149source = "registry+https://github.com/rust-lang/crates.io-index"
131checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" 150checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
132dependencies = [ 151dependencies = [
133 "libc", 152 "cfg-if 1.0.0",
134 "redox_users", 153 "dirs-sys-next",
135 "winapi",
136] 154]
137 155
138[[package]] 156[[package]]
@@ -141,13 +159,40 @@ version = "0.3.4"
141source = "registry+https://github.com/rust-lang/crates.io-index" 159source = "registry+https://github.com/rust-lang/crates.io-index"
142checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" 160checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
143dependencies = [ 161dependencies = [
144 "cfg-if", 162 "cfg-if 0.1.10",
163 "libc",
164 "redox_users 0.3.4",
165 "winapi",
166]
167
168[[package]]
169name = "dirs-sys-next"
170version = "0.1.2"
171source = "registry+https://github.com/rust-lang/crates.io-index"
172checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
173dependencies = [
145 "libc", 174 "libc",
146 "redox_users", 175 "redox_users 0.4.0",
147 "winapi", 176 "winapi",
148] 177]
149 178
150[[package]] 179[[package]]
180name = "endian-type"
181version = "0.1.2"
182source = "registry+https://github.com/rust-lang/crates.io-index"
183checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
184
185[[package]]
186name = "error-code"
187version = "2.3.0"
188source = "registry+https://github.com/rust-lang/crates.io-index"
189checksum = "b5115567ac25674e0043e472be13d14e537f37ea8aa4bdc4aef0c89add1db1ff"
190dependencies = [
191 "libc",
192 "str-buf",
193]
194
195[[package]]
151name = "eva" 196name = "eva"
152version = "0.2.7" 197version = "0.2.7"
153dependencies = [ 198dependencies = [
@@ -162,14 +207,36 @@ dependencies = [
162] 207]
163 208
164[[package]] 209[[package]]
210name = "fd-lock"
211version = "3.0.2"
212source = "registry+https://github.com/rust-lang/crates.io-index"
213checksum = "a16910e685088843d53132b04e0f10a571fdb193224fc589685b3ba1ce4cb03d"
214dependencies = [
215 "cfg-if 1.0.0",
216 "libc",
217 "windows-sys",
218]
219
220[[package]]
165name = "getrandom" 221name = "getrandom"
166version = "0.1.14" 222version = "0.1.14"
167source = "registry+https://github.com/rust-lang/crates.io-index" 223source = "registry+https://github.com/rust-lang/crates.io-index"
168checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" 224checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
169dependencies = [ 225dependencies = [
170 "cfg-if", 226 "cfg-if 0.1.10",
227 "libc",
228 "wasi 0.9.0+wasi-snapshot-preview1",
229]
230
231[[package]]
232name = "getrandom"
233version = "0.2.3"
234source = "registry+https://github.com/rust-lang/crates.io-index"
235checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
236dependencies = [
237 "cfg-if 1.0.0",
171 "libc", 238 "libc",
172 "wasi", 239 "wasi 0.10.2+wasi-snapshot-preview1",
173] 240]
174 241
175[[package]] 242[[package]]
@@ -189,9 +256,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
189 256
190[[package]] 257[[package]]
191name = "libc" 258name = "libc"
192version = "0.2.68" 259version = "0.2.112"
193source = "registry+https://github.com/rust-lang/crates.io-index" 260source = "registry+https://github.com/rust-lang/crates.io-index"
194checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" 261checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
195 262
196[[package]] 263[[package]]
197name = "log" 264name = "log"
@@ -199,7 +266,7 @@ version = "0.4.8"
199source = "registry+https://github.com/rust-lang/crates.io-index" 266source = "registry+https://github.com/rust-lang/crates.io-index"
200checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" 267checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
201dependencies = [ 268dependencies = [
202 "cfg-if", 269 "cfg-if 0.1.10",
203] 270]
204 271
205[[package]] 272[[package]]
@@ -209,16 +276,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
209checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" 276checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
210 277
211[[package]] 278[[package]]
279name = "memoffset"
280version = "0.6.5"
281source = "registry+https://github.com/rust-lang/crates.io-index"
282checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
283dependencies = [
284 "autocfg",
285]
286
287[[package]]
288name = "nibble_vec"
289version = "0.1.0"
290source = "registry+https://github.com/rust-lang/crates.io-index"
291checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43"
292dependencies = [
293 "smallvec",
294]
295
296[[package]]
212name = "nix" 297name = "nix"
213version = "0.13.1" 298version = "0.23.1"
214source = "registry+https://github.com/rust-lang/crates.io-index" 299source = "registry+https://github.com/rust-lang/crates.io-index"
215checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" 300checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
216dependencies = [ 301dependencies = [
217 "bitflags", 302 "bitflags",
218 "cc", 303 "cc",
219 "cfg-if", 304 "cfg-if 1.0.0",
220 "libc", 305 "libc",
221 "void", 306 "memoffset",
222] 307]
223 308
224[[package]] 309[[package]]
@@ -305,23 +390,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
305checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" 390checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426"
306 391
307[[package]] 392[[package]]
393name = "radix_trie"
394version = "0.2.1"
395source = "registry+https://github.com/rust-lang/crates.io-index"
396checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd"
397dependencies = [
398 "endian-type",
399 "nibble_vec",
400]
401
402[[package]]
308name = "redox_syscall" 403name = "redox_syscall"
309version = "0.1.56" 404version = "0.1.56"
310source = "registry+https://github.com/rust-lang/crates.io-index" 405source = "registry+https://github.com/rust-lang/crates.io-index"
311checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 406checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
312 407
313[[package]] 408[[package]]
409name = "redox_syscall"
410version = "0.2.10"
411source = "registry+https://github.com/rust-lang/crates.io-index"
412checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
413dependencies = [
414 "bitflags",
415]
416
417[[package]]
314name = "redox_users" 418name = "redox_users"
315version = "0.3.4" 419version = "0.3.4"
316source = "registry+https://github.com/rust-lang/crates.io-index" 420source = "registry+https://github.com/rust-lang/crates.io-index"
317checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" 421checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
318dependencies = [ 422dependencies = [
319 "getrandom", 423 "getrandom 0.1.14",
320 "redox_syscall", 424 "redox_syscall 0.1.56",
321 "rust-argon2", 425 "rust-argon2",
322] 426]
323 427
324[[package]] 428[[package]]
429name = "redox_users"
430version = "0.4.0"
431source = "registry+https://github.com/rust-lang/crates.io-index"
432checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
433dependencies = [
434 "getrandom 0.2.3",
435 "redox_syscall 0.2.10",
436]
437
438[[package]]
325name = "regex" 439name = "regex"
326version = "1.3.6" 440version = "1.3.6"
327source = "registry+https://github.com/rust-lang/crates.io-index" 441source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -353,15 +467,22 @@ dependencies = [
353 467
354[[package]] 468[[package]]
355name = "rustyline" 469name = "rustyline"
356version = "4.1.0" 470version = "9.1.1"
357source = "registry+https://github.com/rust-lang/crates.io-index" 471source = "registry+https://github.com/rust-lang/crates.io-index"
358checksum = "0f47ea1ceb347d2deae482d655dc8eef4bd82363d3329baffa3818bd76fea48b" 472checksum = "6c38cfbd0a4d7df7aab7cf53732d5d43449d0300358fd15cd4e8c8468a956aca"
359dependencies = [ 473dependencies = [
360 "dirs", 474 "bitflags",
475 "cfg-if 1.0.0",
476 "clipboard-win",
477 "dirs-next",
478 "fd-lock",
361 "libc", 479 "libc",
362 "log", 480 "log",
363 "memchr", 481 "memchr",
364 "nix", 482 "nix",
483 "radix_trie",
484 "scopeguard",
485 "smallvec",
365 "unicode-segmentation", 486 "unicode-segmentation",
366 "unicode-width", 487 "unicode-width",
367 "utf8parse", 488 "utf8parse",
@@ -369,6 +490,24 @@ dependencies = [
369] 490]
370 491
371[[package]] 492[[package]]
493name = "scopeguard"
494version = "1.1.0"
495source = "registry+https://github.com/rust-lang/crates.io-index"
496checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
497
498[[package]]
499name = "smallvec"
500version = "1.7.0"
501source = "registry+https://github.com/rust-lang/crates.io-index"
502checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
503
504[[package]]
505name = "str-buf"
506version = "1.0.5"
507source = "registry+https://github.com/rust-lang/crates.io-index"
508checksum = "d44a3643b4ff9caf57abcee9c2c621d6c03d9135e0d8b589bd9afb5992cb176a"
509
510[[package]]
372name = "strsim" 511name = "strsim"
373version = "0.8.0" 512version = "0.8.0"
374source = "registry+https://github.com/rust-lang/crates.io-index" 513source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -416,9 +555,9 @@ checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
416 555
417[[package]] 556[[package]]
418name = "utf8parse" 557name = "utf8parse"
419version = "0.1.1" 558version = "0.2.0"
420source = "registry+https://github.com/rust-lang/crates.io-index" 559source = "registry+https://github.com/rust-lang/crates.io-index"
421checksum = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d" 560checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372"
422 561
423[[package]] 562[[package]]
424name = "vec_map" 563name = "vec_map"
@@ -427,16 +566,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
427checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 566checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
428 567
429[[package]] 568[[package]]
430name = "void" 569name = "wasi"
431version = "1.0.2" 570version = "0.9.0+wasi-snapshot-preview1"
432source = "registry+https://github.com/rust-lang/crates.io-index" 571source = "registry+https://github.com/rust-lang/crates.io-index"
433checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 572checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
434 573
435[[package]] 574[[package]]
436name = "wasi" 575name = "wasi"
437version = "0.9.0+wasi-snapshot-preview1" 576version = "0.10.2+wasi-snapshot-preview1"
438source = "registry+https://github.com/rust-lang/crates.io-index" 577source = "registry+https://github.com/rust-lang/crates.io-index"
439checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 578checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
440 579
441[[package]] 580[[package]]
442name = "winapi" 581name = "winapi"
@@ -459,3 +598,46 @@ name = "winapi-x86_64-pc-windows-gnu"
459version = "0.4.0" 598version = "0.4.0"
460source = "registry+https://github.com/rust-lang/crates.io-index" 599source = "registry+https://github.com/rust-lang/crates.io-index"
461checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 600checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
601
602[[package]]
603name = "windows-sys"
604version = "0.28.0"
605source = "registry+https://github.com/rust-lang/crates.io-index"
606checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6"
607dependencies = [
608 "windows_aarch64_msvc",
609 "windows_i686_gnu",
610 "windows_i686_msvc",
611 "windows_x86_64_gnu",
612 "windows_x86_64_msvc",
613]
614
615[[package]]
616name = "windows_aarch64_msvc"
617version = "0.28.0"
618source = "registry+https://github.com/rust-lang/crates.io-index"
619checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
620
621[[package]]
622name = "windows_i686_gnu"
623version = "0.28.0"
624source = "registry+https://github.com/rust-lang/crates.io-index"
625checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
626
627[[package]]
628name = "windows_i686_msvc"
629version = "0.28.0"
630source = "registry+https://github.com/rust-lang/crates.io-index"
631checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
632
633[[package]]
634name = "windows_x86_64_gnu"
635version = "0.28.0"
636source = "registry+https://github.com/rust-lang/crates.io-index"
637checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
638
639[[package]]
640name = "windows_x86_64_msvc"
641version = "0.28.0"
642source = "registry+https://github.com/rust-lang/crates.io-index"
643checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
diff --git a/Cargo.toml b/Cargo.toml
index 4527862..6ae2e05 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ categories = ["command-line-interface", "science", "parser-implementations"]
12license = "MIT" 12license = "MIT"
13 13
14[dependencies] 14[dependencies]
15rustyline = "4.1.0" 15rustyline = "9.1.1"
16clap = "2.32.0" 16clap = "2.32.0"
17radix_fmt = "1.0.0" 17radix_fmt = "1.0.0"
18lazy_static = "1.3.0" 18lazy_static = "1.3.0"
diff --git a/src/readline.rs b/src/readline.rs
index 2939ee1..f59cd22 100644
--- a/src/readline.rs
+++ b/src/readline.rs
@@ -7,6 +7,7 @@ use rustyline::error::ReadlineError;
7use rustyline::highlight::Highlighter; 7use rustyline::highlight::Highlighter;
8use rustyline::hint::{Hinter, HistoryHinter}; 8use rustyline::hint::{Hinter, HistoryHinter};
9use rustyline::{Context, Editor, Helper}; 9use rustyline::{Context, Editor, Helper};
10use rustyline::validate::Validator;
10 11
11use directories::ProjectDirs; 12use directories::ProjectDirs;
12 13
@@ -75,6 +76,7 @@ impl Highlighter for LineHighlighter {
75} 76}
76 77
77impl Highlighter for RLHelper { 78impl Highlighter for RLHelper {
79 fn highlight_char(&self, _: &str, _: usize) -> bool { true }
78 fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> { 80 fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> {
79 self.highlighter.highlight_hint(hint) 81 self.highlighter.highlight_hint(hint)
80 } 82 }
@@ -96,11 +98,14 @@ impl Completer for RLHelper {
96} 98}
97 99
98impl Hinter for RLHelper { 100impl Hinter for RLHelper {
99 fn hint(&self, line: &str, a: usize, b: &Context) -> Option<String> { 101 type Hint = String;
102 fn hint(&self, line: &str, a: usize, b: &Context) -> Option<Self::Hint> {
100 self.hinter.hint(line, a, b) 103 self.hinter.hint(line, a, b)
101 } 104 }
102} 105}
103 106
107impl Validator for RLHelper {}
108
104impl Helper for RLHelper {} 109impl Helper for RLHelper {}
105 110
106pub fn create_readline() -> Editor<RLHelper> { 111pub fn create_readline() -> Editor<RLHelper> {