on master help sign in
Start swapping from termwiz to crossterm + async.
6905ff0Blaž Hrastnik
Cargo.lock+335−349
@@ -1,14 +1,5 @@
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.
3−[[package]]
4−name = "aho-corasick"
5−version = "0.7.10"
6−source = "registry+https://github.com/rust-lang/crates.io-index"
7−checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
8−dependencies = [
9− "memchr",
10−]
11−
12[[package]]
3[[package]]
13name = "anyhow"
4name = "anyhow"
14version = "1.0.31"
5version = "1.0.31"
@@ -39,9 +30,9 @@ checksum = "e742194e0f43fc932bcb801708c2b279d3ec8f527e3acda05a6a9f342c5ef764"
39dependencies = [
30dependencies = [
40 "argh_shared",
31 "argh_shared",
41 "heck",
32 "heck",
42− "proc-macro2 1.0.13",
33+ "proc-macro2",
43− "quote 1.0.6",
34+ "quote",
44− "syn 1.0.22",
35+ "syn",
45]
36]
46
37
47[[package]]
38[[package]]
@@ -51,16 +42,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
51checksum = "e1ba68f4276a778591e36a0c348a269888f3a177c8d2054969389e3b59611ff5"
42checksum = "e1ba68f4276a778591e36a0c348a269888f3a177c8d2054969389e3b59611ff5"
52
43
53[[package]]
44[[package]]
54−name = "arrayref"
45+name = "async-task"
55−version = "0.3.6"
46+version = "3.0.0"
56−source = "registry+https://github.com/rust-lang/crates.io-index"
57−checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
58−
59−[[package]]
60−name = "arrayvec"
61−version = "0.5.1"
62source = "registry+https://github.com/rust-lang/crates.io-index"
47source = "registry+https://github.com/rust-lang/crates.io-index"
63−checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
48+checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3"
64
49
65[[package]]
50[[package]]
66name = "autocfg"
51name = "autocfg"
@@ -69,108 +54,127 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
69checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
54checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
70
55
71[[package]]
56[[package]]
72−name = "base64"
57+name = "bitflags"
73−version = "0.10.1"
58+version = "1.2.1"
74source = "registry+https://github.com/rust-lang/crates.io-index"
59source = "registry+https://github.com/rust-lang/crates.io-index"
75−checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
60+checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
76−dependencies = [
77− "byteorder",
78−]
79
61
80[[package]]
62[[package]]
81−name = "base64"
63+name = "cc"
82−version = "0.11.0"
64+version = "1.0.54"
83source = "registry+https://github.com/rust-lang/crates.io-index"
65source = "registry+https://github.com/rust-lang/crates.io-index"
84−checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
66+checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
85
67
86[[package]]
68[[package]]
87−name = "bitflags"
69+name = "cfg-if"
88−version = "1.2.1"
70+version = "0.1.9"
89source = "registry+https://github.com/rust-lang/crates.io-index"
71source = "registry+https://github.com/rust-lang/crates.io-index"
90−checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
72+checksum = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
91
73
92[[package]]
74[[package]]
93−name = "blake2b_simd"
75+name = "cloudabi"
94−version = "0.5.10"
76+version = "0.0.3"
95source = "registry+https://github.com/rust-lang/crates.io-index"
77source = "registry+https://github.com/rust-lang/crates.io-index"
96−checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
78+checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
97dependencies = [
79dependencies = [
98− "arrayref",
80+ "bitflags",
99− "arrayvec",
100− "constant_time_eq",
101]
81]
102
82
103[[package]]
83[[package]]
104−name = "byteorder"
84+name = "crossbeam"
105−version = "1.3.4"
106−source = "registry+https://github.com/rust-lang/crates.io-index"
107−checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
108−
109−[[package]]
110−name = "cassowary"
111−version = "0.3.0"
85+version = "0.7.3"
112source = "registry+https://github.com/rust-lang/crates.io-index"
86source = "registry+https://github.com/rust-lang/crates.io-index"
113−checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
87+checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
88+dependencies = [
89+ "cfg-if",
90+ "crossbeam-channel",
91+ "crossbeam-deque",
92+ "crossbeam-epoch",
93+ "crossbeam-queue",
94+ "crossbeam-utils",
95+]
114
96
115[[package]]
97[[package]]
116−name = "cfg-if"
98+name = "crossbeam-channel"
117−version = "0.1.9"
99+version = "0.4.2"
118source = "registry+https://github.com/rust-lang/crates.io-index"
100source = "registry+https://github.com/rust-lang/crates.io-index"
119−checksum = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
101+checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
102+dependencies = [
103+ "crossbeam-utils",
104+ "maybe-uninit",
105+]
120
106
121[[package]]
107[[package]]
122−name = "constant_time_eq"
108+name = "crossbeam-deque"
123−version = "0.1.5"
109+version = "0.7.3"
124source = "registry+https://github.com/rust-lang/crates.io-index"
110source = "registry+https://github.com/rust-lang/crates.io-index"
125−checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
111+checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
112+dependencies = [
113+ "crossbeam-epoch",
114+ "crossbeam-utils",
115+ "maybe-uninit",
116+]
126
117
127[[package]]
118[[package]]
128−name = "crossbeam-utils"
119+name = "crossbeam-epoch"
129−version = "0.7.2"
120+version = "0.8.2"
130source = "registry+https://github.com/rust-lang/crates.io-index"
121source = "registry+https://github.com/rust-lang/crates.io-index"
131−checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
122+checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
132dependencies = [
123dependencies = [
133 "autocfg",
124 "autocfg",
134 "cfg-if",
125 "cfg-if",
126+ "crossbeam-utils",
135 "lazy_static",
127 "lazy_static",
128+ "maybe-uninit",
129+ "memoffset",
130+ "scopeguard",
136]
131]
137
132
138[[package]]
133[[package]]
139−name = "dirs"
134+name = "crossbeam-queue"
140−version = "2.0.2"
135+version = "0.2.1"
141source = "registry+https://github.com/rust-lang/crates.io-index"
136source = "registry+https://github.com/rust-lang/crates.io-index"
142−checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
137+checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
143dependencies = [
138dependencies = [
144 "cfg-if",
139 "cfg-if",
145− "dirs-sys",
140+ "crossbeam-utils",
146]
141]
147
142
148[[package]]
143[[package]]
149−name = "dirs-sys"
144+name = "crossbeam-utils"
150−version = "0.3.4"
145+version = "0.7.2"
151source = "registry+https://github.com/rust-lang/crates.io-index"
146source = "registry+https://github.com/rust-lang/crates.io-index"
152−checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
147+checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
153dependencies = [
148dependencies = [
149+ "autocfg",
154 "cfg-if",
150 "cfg-if",
155− "libc",
151+ "lazy_static",
156− "redox_users",
157− "winapi",
158]
152]
159
153
160[[package]]
154[[package]]
161−name = "filedescriptor"
155+name = "crossterm"
162−version = "0.7.1"
156+version = "0.17.4"
157+source = "git+https://github.com/crossterm-rs/crossterm?branch=mio-update#4ab507dfc41a32dec0d8249f599b02c3a78a83f7"
163dependencies = [
158dependencies = [
164− "anyhow",
159+ "bitflags",
160+ "crossterm_winapi",
161+ "futures",
162+ "lazy_static",
165 "libc",
163 "libc",
164+ "mio",
165+ "parking_lot",
166+ "signal-hook",
166 "winapi",
167 "winapi",
167]
168]
168
169
169[[package]]
170[[package]]
170−name = "fnv"
171+name = "crossterm_winapi"
171−version = "1.0.7"
172+version = "0.6.1"
172source = "registry+https://github.com/rust-lang/crates.io-index"
173source = "registry+https://github.com/rust-lang/crates.io-index"
173−checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
174+checksum = "057b7146d02fb50175fd7dbe5158f6097f33d02831f43b4ee8ae4ddf67b68f5c"
175+dependencies = [
176+ "winapi",
177+]
174
178
175[[package]]
179[[package]]
176name = "futf"
180name = "futf"
@@ -183,14 +187,98 @@ dependencies = [
183]
187]
184
188
185[[package]]
189[[package]]
186−name = "getrandom"
190+name = "futures"
187−version = "0.1.14"
191+version = "0.3.5"
188source = "registry+https://github.com/rust-lang/crates.io-index"
192source = "registry+https://github.com/rust-lang/crates.io-index"
189−checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
193+checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"
190dependencies = [
194dependencies = [
191− "cfg-if",
195+ "futures-channel",
192− "libc",
196+ "futures-core",
193− "wasi",
197+ "futures-executor",
198+ "futures-io",
199+ "futures-sink",
200+ "futures-task",
201+ "futures-util",
202+]
203+
204+[[package]]
205+name = "futures-channel"
206+version = "0.3.5"
207+source = "registry+https://github.com/rust-lang/crates.io-index"
208+checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"
209+dependencies = [
210+ "futures-core",
211+ "futures-sink",
212+]
213+
214+[[package]]
215+name = "futures-core"
216+version = "0.3.5"
217+source = "registry+https://github.com/rust-lang/crates.io-index"
218+checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
219+
220+[[package]]
221+name = "futures-executor"
222+version = "0.3.5"
223+source = "registry+https://github.com/rust-lang/crates.io-index"
224+checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314"
225+dependencies = [
226+ "futures-core",
227+ "futures-task",
228+ "futures-util",
229+]
230+
231+[[package]]
232+name = "futures-io"
233+version = "0.3.5"
234+source = "registry+https://github.com/rust-lang/crates.io-index"
235+checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
236+
237+[[package]]
238+name = "futures-macro"
239+version = "0.3.5"
240+source = "registry+https://github.com/rust-lang/crates.io-index"
241+checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
242+dependencies = [
243+ "proc-macro-hack",
244+ "proc-macro2",
245+ "quote",
246+ "syn",
247+]
248+
249+[[package]]
250+name = "futures-sink"
251+version = "0.3.5"
252+source = "registry+https://github.com/rust-lang/crates.io-index"
253+checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc"
254+
255+[[package]]
256+name = "futures-task"
257+version = "0.3.5"
258+source = "registry+https://github.com/rust-lang/crates.io-index"
259+checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
260+dependencies = [
261+ "once_cell",
262+]
263+
264+[[package]]
265+name = "futures-util"
266+version = "0.3.5"
267+source = "registry+https://github.com/rust-lang/crates.io-index"
268+checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
269+dependencies = [
270+ "futures-channel",
271+ "futures-core",
272+ "futures-io",
273+ "futures-macro",
274+ "futures-sink",
275+ "futures-task",
276+ "memchr",
277+ "pin-project",
278+ "pin-utils",
279+ "proc-macro-hack",
280+ "proc-macro-nested",
281+ "slab",
194]
282]
195
283
196[[package]]
284[[package]]
@@ -208,7 +296,7 @@ version = "0.1.0"
208dependencies = [
296dependencies = [
209 "anyhow",
297 "anyhow",
210 "ropey",
298 "ropey",
211− "smallvec 1.4.0",
299+ "smallvec",
212 "tendril",
300 "tendril",
213]
301]
214
302
@@ -218,8 +306,21 @@ version = "0.1.0"
218dependencies = [
306dependencies = [
219 "anyhow",
307 "anyhow",
220 "argh",
308 "argh",
309+ "crossterm",
310+ "futures",
221 "helix-core",
311 "helix-core",
222− "termwiz",
312+ "num_cpus",
313+ "piper",
314+ "smol",
315+]
316+
317+[[package]]
318+name = "hermit-abi"
319+version = "0.1.13"
320+source = "registry+https://github.com/rust-lang/crates.io-index"
321+checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
322+dependencies = [
323+ "libc",
223]
324]
224
325
225[[package]]
326[[package]]
@@ -234,6 +335,15 @@ version = "0.2.70"
234source = "registry+https://github.com/rust-lang/crates.io-index"
335source = "registry+https://github.com/rust-lang/crates.io-index"
235checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
336checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
236
337
338+[[package]]
339+name = "lock_api"
340+version = "0.3.4"
341+source = "registry+https://github.com/rust-lang/crates.io-index"
342+checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
343+dependencies = [
344+ "scopeguard",
345+]
346+
237[[package]]
347[[package]]
238name = "log"
348name = "log"
239version = "0.4.8"
349version = "0.4.8"
@@ -262,256 +372,199 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
262checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
372checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
263
373
264[[package]]
374[[package]]
265−name = "memmem"
375+name = "memoffset"
266−version = "0.1.1"
376+version = "0.5.4"
267−source = "registry+https://github.com/rust-lang/crates.io-index"
268−checksum = "a64a92489e2744ce060c349162be1c5f33c6969234104dbd99ddb5feb08b8c15"
269−
270−[[package]]
271−name = "new_debug_unreachable"
272−version = "1.0.4"
273−source = "registry+https://github.com/rust-lang/crates.io-index"
274−checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
275−
276−[[package]]
277−name = "nom"
278−version = "5.1.1"
279source = "registry+https://github.com/rust-lang/crates.io-index"
377source = "registry+https://github.com/rust-lang/crates.io-index"
280−checksum = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6"
378+checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8"
281−dependencies = [
282− "memchr",
283− "version_check",
284−]
285−
286−[[package]]
287−name = "num-derive"
288−version = "0.2.5"
289−source = "registry+https://github.com/rust-lang/crates.io-index"
290−checksum = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2"
291−dependencies = [
292− "proc-macro2 0.4.30",
293− "quote 0.6.13",
294− "syn 0.15.44",
295−]
296−
297−[[package]]
298−name = "num-traits"
299−version = "0.2.11"
300−source = "registry+https://github.com/rust-lang/crates.io-index"
301−checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
302dependencies = [
379dependencies = [
303 "autocfg",
380 "autocfg",
304]
381]
305
382
306[[package]]
383[[package]]
307−name = "ordered-float"
384+name = "mio"
308−version = "1.0.2"
385+version = "0.7.0"
309source = "registry+https://github.com/rust-lang/crates.io-index"
386source = "registry+https://github.com/rust-lang/crates.io-index"
310−checksum = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
387+checksum = "6e9971bc8349a361217a8f2a41f5d011274686bd4436465ba51730921039d7fb"
311dependencies = [
388dependencies = [
312− "num-traits",
389+ "lazy_static",
390+ "libc",
391+ "log",
392+ "miow",
393+ "ntapi",
394+ "winapi",
313]
395]
314
396
315[[package]]
397[[package]]
316−name = "phf"
398+name = "miow"
317−version = "0.8.0"
399+version = "0.3.4"
318source = "registry+https://github.com/rust-lang/crates.io-index"
400source = "registry+https://github.com/rust-lang/crates.io-index"
319−checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
401+checksum = "22dfdd1d51b2639a5abd17ed07005c3af05fb7a2a3b1a1d0d7af1000a520c1c7"
320dependencies = [
402dependencies = [
321− "phf_shared",
403+ "socket2",
404+ "winapi",
322]
405]
323
406
324[[package]]
407[[package]]
325−name = "phf_codegen"
408+name = "new_debug_unreachable"
326−version = "0.8.0"
409+version = "1.0.4"
327source = "registry+https://github.com/rust-lang/crates.io-index"
410source = "registry+https://github.com/rust-lang/crates.io-index"
328−checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815"
411+checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
329−dependencies = [
330− "phf_generator",
331− "phf_shared",
332−]
333
412
334[[package]]
413[[package]]
335−name = "phf_generator"
414+name = "nix"
336−version = "0.8.0"
415+version = "0.17.0"
337source = "registry+https://github.com/rust-lang/crates.io-index"
416source = "registry+https://github.com/rust-lang/crates.io-index"
338−checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
417+checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
339dependencies = [
418dependencies = [
340− "phf_shared",
419+ "bitflags",
341− "rand",
420+ "cc",
421+ "cfg-if",
422+ "libc",
423+ "void",
342]
424]
343
425
344[[package]]
426[[package]]
345−name = "phf_shared"
427+name = "ntapi"
346−version = "0.8.0"
428+version = "0.3.4"
347source = "registry+https://github.com/rust-lang/crates.io-index"
429source = "registry+https://github.com/rust-lang/crates.io-index"
348−checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
430+checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2"
349dependencies = [
431dependencies = [
350− "siphasher",
432+ "winapi",
351]
433]
352
434
353[[package]]
435[[package]]
354−name = "ppv-lite86"
436+name = "num_cpus"
355−version = "0.2.8"
437+version = "1.13.0"
356−source = "registry+https://github.com/rust-lang/crates.io-index"
357−checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
358−
359−[[package]]
360−name = "proc-macro2"
361−version = "0.4.30"
362source = "registry+https://github.com/rust-lang/crates.io-index"
438source = "registry+https://github.com/rust-lang/crates.io-index"
363−checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
439+checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
364dependencies = [
440dependencies = [
365− "unicode-xid 0.1.0",
441+ "hermit-abi",
442+ "libc",
366]
443]
367
444
368[[package]]
445[[package]]
369−name = "proc-macro2"
446+name = "once_cell"
370−version = "1.0.13"
447+version = "1.4.0"
371source = "registry+https://github.com/rust-lang/crates.io-index"
448source = "registry+https://github.com/rust-lang/crates.io-index"
372−checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639"
449+checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
373−dependencies = [
374− "unicode-xid 0.2.0",
375−]
376
450
377[[package]]
451[[package]]
378−name = "quote"
452+name = "parking_lot"
379−version = "0.6.13"
453+version = "0.10.2"
380source = "registry+https://github.com/rust-lang/crates.io-index"
454source = "registry+https://github.com/rust-lang/crates.io-index"
381−checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
455+checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
382dependencies = [
456dependencies = [
383− "proc-macro2 0.4.30",
457+ "lock_api",
458+ "parking_lot_core",
384]
459]
385
460
386[[package]]
461[[package]]
387−name = "quote"
462+name = "parking_lot_core"
388−version = "1.0.6"
463+version = "0.7.2"
389source = "registry+https://github.com/rust-lang/crates.io-index"
464source = "registry+https://github.com/rust-lang/crates.io-index"
390−checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
465+checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
391dependencies = [
466dependencies = [
392− "proc-macro2 1.0.13",
467+ "cfg-if",
468+ "cloudabi",
469+ "libc",
470+ "redox_syscall",
471+ "smallvec",
472+ "winapi",
393]
473]
394
474
395[[package]]
475[[package]]
396−name = "rand"
476+name = "pin-project"
397−version = "0.7.3"
477+version = "0.4.17"
398source = "registry+https://github.com/rust-lang/crates.io-index"
478source = "registry+https://github.com/rust-lang/crates.io-index"
399−checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
479+checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791"
400dependencies = [
480dependencies = [
401− "getrandom",
481+ "pin-project-internal",
402− "libc",
403− "rand_chacha",
404− "rand_core",
405− "rand_hc",
406− "rand_pcg",
407]
482]
408
483
409[[package]]
484[[package]]
410−name = "rand_chacha"
485+name = "pin-project-internal"
411−version = "0.2.2"
486+version = "0.4.17"
412source = "registry+https://github.com/rust-lang/crates.io-index"
487source = "registry+https://github.com/rust-lang/crates.io-index"
413−checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
488+checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40"
414dependencies = [
489dependencies = [
415− "ppv-lite86",
490+ "proc-macro2",
416− "rand_core",
491+ "quote",
492+ "syn",
417]
493]
418
494
419[[package]]
495[[package]]
420−name = "rand_core"
496+name = "pin-utils"
421−version = "0.5.1"
497+version = "0.1.0"
422source = "registry+https://github.com/rust-lang/crates.io-index"
498source = "registry+https://github.com/rust-lang/crates.io-index"
423−checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
499+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
424−dependencies = [
425− "getrandom",
426−]
427
500
428[[package]]
501[[package]]
429−name = "rand_hc"
502+name = "piper"
430−version = "0.2.0"
503+version = "0.1.2"
431source = "registry+https://github.com/rust-lang/crates.io-index"
504source = "registry+https://github.com/rust-lang/crates.io-index"
432−checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
505+checksum = "6b0deb65f46e873ba8aa7c6a8dbe3f23cb1bf59c339a81a1d56361dde4d66ac8"
433dependencies = [
506dependencies = [
434− "rand_core",
507+ "crossbeam-utils",
508+ "futures-io",
509+ "futures-sink",
510+ "futures-util",
435]
511]
436
512
437[[package]]
513[[package]]
438−name = "rand_pcg"
514+name = "proc-macro-hack"
439−version = "0.2.1"
515+version = "0.5.16"
440source = "registry+https://github.com/rust-lang/crates.io-index"
516source = "registry+https://github.com/rust-lang/crates.io-index"
441−checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
517+checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
442−dependencies = [
443− "rand_core",
444−]
445
518
446[[package]]
519[[package]]
447−name = "redox_syscall"
520+name = "proc-macro-nested"
448−version = "0.1.56"
521+version = "0.1.4"
449source = "registry+https://github.com/rust-lang/crates.io-index"
522source = "registry+https://github.com/rust-lang/crates.io-index"
450−checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
523+checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
451
524
452[[package]]
525[[package]]
453−name = "redox_users"
526+name = "proc-macro2"
454−version = "0.3.4"
527+version = "1.0.13"
455source = "registry+https://github.com/rust-lang/crates.io-index"
528source = "registry+https://github.com/rust-lang/crates.io-index"
456−checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
529+checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639"
457dependencies = [
530dependencies = [
458− "getrandom",
531+ "unicode-xid",
459− "redox_syscall",
460− "rust-argon2",
461]
532]
462
533
463[[package]]
534[[package]]
464−name = "regex"
535+name = "quote"
465−version = "1.3.7"
536+version = "1.0.6"
466source = "registry+https://github.com/rust-lang/crates.io-index"
537source = "registry+https://github.com/rust-lang/crates.io-index"
467−checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
538+checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
468dependencies = [
539dependencies = [
469− "aho-corasick",
540+ "proc-macro2",
470− "memchr",
471− "regex-syntax",
472− "thread_local",
473]
541]
474
542
475[[package]]
543[[package]]
476−name = "regex-syntax"
544+name = "redox_syscall"
477−version = "0.6.17"
545+version = "0.1.56"
478source = "registry+https://github.com/rust-lang/crates.io-index"
546source = "registry+https://github.com/rust-lang/crates.io-index"
479−checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
547+checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
480
548
481[[package]]
549[[package]]
482name = "ropey"
550name = "ropey"
483version = "1.1.0"
551version = "1.1.0"
484source = "git+https://github.com/cessen/ropey#083c34949274ef9800267e6bc64b76a45e401807"
552source = "git+https://github.com/cessen/ropey#083c34949274ef9800267e6bc64b76a45e401807"
485dependencies = [
553dependencies = [
486− "smallvec 1.4.0",
554+ "smallvec",
487]
555]
488
556
489[[package]]
557[[package]]
490−name = "rust-argon2"
558+name = "scoped-tls-hkt"
491−version = "0.7.0"
559+version = "0.1.2"
492source = "registry+https://github.com/rust-lang/crates.io-index"
560source = "registry+https://github.com/rust-lang/crates.io-index"
493−checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017"
561+checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63"
494−dependencies = [
495− "base64 0.11.0",
496− "blake2b_simd",
497− "constant_time_eq",
498− "crossbeam-utils",
499−]
500−
501−[[package]]
502−name = "semver"
503−version = "0.9.0"
504−source = "registry+https://github.com/rust-lang/crates.io-index"
505−checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
506−dependencies = [
507− "semver-parser",
508−]
509
562
510[[package]]
563[[package]]
511−name = "semver-parser"
564+name = "scopeguard"
512−version = "0.7.0"
565+version = "1.1.0"
513source = "registry+https://github.com/rust-lang/crates.io-index"
566source = "registry+https://github.com/rust-lang/crates.io-index"
514−checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
567+checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
515
568
516[[package]]
569[[package]]
517name = "signal-hook"
570name = "signal-hook"
@@ -520,6 +573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
520checksum = "8ff2db2112d6c761e12522c65f7768548bd6e8cd23d2a9dae162520626629bd6"
573checksum = "8ff2db2112d6c761e12522c65f7768548bd6e8cd23d2a9dae162520626629bd6"
521dependencies = [
574dependencies = [
522 "libc",
575 "libc",
576+ "mio",
523 "signal-hook-registry",
577 "signal-hook-registry",
524]
578]
525
579
@@ -534,35 +588,46 @@ dependencies = [
534]
588]
535
589
536[[package]]
590[[package]]
537−name = "siphasher"
591+name = "slab"
538−version = "0.3.3"
592+version = "0.4.2"
539source = "registry+https://github.com/rust-lang/crates.io-index"
593source = "registry+https://github.com/rust-lang/crates.io-index"
540−checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7"
594+checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
541
595
542[[package]]
596[[package]]
543name = "smallvec"
597name = "smallvec"
544−version = "0.6.13"
598+version = "1.4.0"
545source = "registry+https://github.com/rust-lang/crates.io-index"
599source = "registry+https://github.com/rust-lang/crates.io-index"
546−checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
600+checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
547−dependencies = [
548− "maybe-uninit",
549−]
550
601
551[[package]]
602[[package]]
552−name = "smallvec"
603+name = "smol"
553−version = "1.4.0"
604+version = "0.1.10"
554source = "registry+https://github.com/rust-lang/crates.io-index"
605source = "registry+https://github.com/rust-lang/crates.io-index"
555−checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
606+checksum = "686c634ad1873fffef6aed20f180eede424fbf3bb31802394c90fd7335a661b7"
607+dependencies = [
608+ "async-task",
609+ "crossbeam",
610+ "futures-io",
611+ "futures-util",
612+ "nix",
613+ "once_cell",
614+ "piper",
615+ "scoped-tls-hkt",
616+ "slab",
617+ "socket2",
618+ "wepoll-binding",
619+]
556
620
557[[package]]
621[[package]]
558−name = "syn"
622+name = "socket2"
559−version = "0.15.44"
623+version = "0.3.12"
560source = "registry+https://github.com/rust-lang/crates.io-index"
624source = "registry+https://github.com/rust-lang/crates.io-index"
561−checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
625+checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
562dependencies = [
626dependencies = [
563− "proc-macro2 0.4.30",
627+ "cfg-if",
564− "quote 0.6.13",
628+ "libc",
565− "unicode-xid 0.1.0",
629+ "redox_syscall",
630+ "winapi",
566]
631]
567
632
568[[package]]
633[[package]]
@@ -571,9 +636,9 @@ version = "1.0.22"
571source = "registry+https://github.com/rust-lang/crates.io-index"
636source = "registry+https://github.com/rust-lang/crates.io-index"
572checksum = "1425de3c33b0941002740a420b1a906a350b88d08b82b2c8a01035a3f9447bac"
637checksum = "1425de3c33b0941002740a420b1a906a350b88d08b82b2c8a01035a3f9447bac"
573dependencies = [
638dependencies = [
574− "proc-macro2 1.0.13",
639+ "proc-macro2",
575− "quote 1.0.6",
640+ "quote",
576− "unicode-xid 0.2.0",
641+ "unicode-xid",
577]
642]
578
643
579[[package]]
644[[package]]
@@ -586,85 +651,12 @@ dependencies = [
586 "utf-8",
651 "utf-8",
587]
652]
588
653
589−[[package]]
590−name = "terminfo"
591−version = "0.7.3"
592−source = "registry+https://github.com/rust-lang/crates.io-index"
593−checksum = "76971977e6121664ec1b960d1313aacfa75642adc93b9d4d53b247bd4cb1747e"
594−dependencies = [
595− "dirs",
596− "fnv",
597− "nom",
598− "phf",
599− "phf_codegen",
600−]
601−
602−[[package]]
603−name = "termios"
604−version = "0.3.2"
605−source = "registry+https://github.com/rust-lang/crates.io-index"
606−checksum = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2"
607−dependencies = [
608− "libc",
609−]
610−
611−[[package]]
612−name = "termwiz"
613−version = "0.9.0"
614−dependencies = [
615− "anyhow",
616− "base64 0.10.1",
617− "bitflags",
618− "cassowary",
619− "filedescriptor",
620− "fnv",
621− "lazy_static",
622− "libc",
623− "log",
624− "memmem",
625− "num-derive",
626− "num-traits",
627− "ordered-float",
628− "regex",
629− "semver",
630− "signal-hook",
631− "smallvec 0.6.13",
632− "terminfo",
633− "termios",
634− "unicode-segmentation",
635− "unicode-width",
636− "vtparse",
637− "winapi",
638− "xi-unicode",
639−]
640−
641−[[package]]
642−name = "thread_local"
643−version = "1.0.1"
644−source = "registry+https://github.com/rust-lang/crates.io-index"
645−checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
646−dependencies = [
647− "lazy_static",
648−]
649−
650[[package]]
654[[package]]
651name = "unicode-segmentation"
655name = "unicode-segmentation"
652version = "1.6.0"
656version = "1.6.0"
653source = "registry+https://github.com/rust-lang/crates.io-index"
657source = "registry+https://github.com/rust-lang/crates.io-index"
654checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
658checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
655
659
656−[[package]]
657−name = "unicode-width"
658−version = "0.1.7"
659−source = "registry+https://github.com/rust-lang/crates.io-index"
660−checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
661−
662−[[package]]
663−name = "unicode-xid"
664−version = "0.1.0"
665−source = "registry+https://github.com/rust-lang/crates.io-index"
666−checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
667−
668[[package]]
660[[package]]
669name = "unicode-xid"
661name = "unicode-xid"
670version = "0.2.0"
662version = "0.2.0"
@@ -678,29 +670,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
678checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
670checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
679
671
680[[package]]
672[[package]]
681−name = "utf8parse"
673+name = "void"
682−version = "0.1.1"
674+version = "1.0.2"
683source = "registry+https://github.com/rust-lang/crates.io-index"
675source = "registry+https://github.com/rust-lang/crates.io-index"
684−checksum = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d"
676+checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
685
677
686[[package]]
678[[package]]
687−name = "version_check"
679+name = "wepoll-binding"
688−version = "0.9.1"
680+version = "2.0.2"
689source = "registry+https://github.com/rust-lang/crates.io-index"
681source = "registry+https://github.com/rust-lang/crates.io-index"
690−checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
682+checksum = "374fff4ff9701ff8b6ad0d14bacd3156c44063632d8c136186ff5967d48999a7"
691−
692−[[package]]
693−name = "vtparse"
694−version = "0.2.2"
695dependencies = [
683dependencies = [
696− "utf8parse",
684+ "bitflags",
685+ "wepoll-sys",
697]
686]
698
687
699[[package]]
688[[package]]
700−name = "wasi"
689+name = "wepoll-sys"
701−version = "0.9.0+wasi-snapshot-preview1"
690+version = "2.0.0"
702source = "registry+https://github.com/rust-lang/crates.io-index"
691source = "registry+https://github.com/rust-lang/crates.io-index"
703−checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
692+checksum = "9082a777aed991f6769e2b654aa0cb29f1c3d615daf009829b07b66c7aff6a24"
693+dependencies = [
694+ "cc",
695+]
704
696
705[[package]]
697[[package]]
706name = "winapi"
698name = "winapi"
@@ -723,9 +715,3 @@ name = "winapi-x86_64-pc-windows-gnu"
723version = "0.4.0"
715version = "0.4.0"
724source = "registry+https://github.com/rust-lang/crates.io-index"
716source = "registry+https://github.com/rust-lang/crates.io-index"
725checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
717checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
726−
727−[[package]]
728−name = "xi-unicode"
729−version = "0.2.0"
730−source = "registry+https://github.com/rust-lang/crates.io-index"
731−checksum = "7395cdb9d0a6219fa0ea77d08c946adf9c1984c72fcd443ace30365f3daadef7"
helix-core/src/state.rs+5−1
@@ -18,7 +18,11 @@ impl State {
18
18
19 // TODO: buf/selection accessors
19 // TODO: buf/selection accessors
20
20
21− // update/transact
21+ // update/transact:
22+ // update(desc) => transaction ? transaction.doc() for applied doc
23+ // transaction.apply(doc)
24+ // doc.transact(fn -> ... end)
25+
22 // replaceSelection (transaction that replaces selection)
26 // replaceSelection (transaction that replaces selection)
23 // changeByRange
27 // changeByRange
24 // changes
28 // changes
helix-core/src/transaction.rs+7−26
@@ -1,19 +1,3 @@
1−// pub struct Change {
2−// from: usize,
3−// to: usize,
4−// insert: Option<String>,
5−// }
6−
7−// 40 bytes (8 + 24 + 8) -> strings are really big 24 as String, 16 as &str
8−// pub struct Change {
9−// /// old extent
10−// old_extent: usize,
11−// /// inserted text, new extent equal to insert length
12−// insert: Option<String>,
13−// /// distance from the previous change
14−// distance: usize,
15−// }
16−
17use crate::{Buffer, Rope, Selection, Tendril};
1use crate::{Buffer, Rope, Selection, Tendril};
18
2
19// TODO: divided into three different operations, I sort of like having just
3// TODO: divided into three different operations, I sort of like having just
@@ -33,11 +17,11 @@ pub enum Change {
33 Insert(Tendril),
17 Insert(Tendril),
34}
18}
35
19
36−impl Change {
20+// impl Change {
37− pub fn new(from: usize, to: usize, insert: Option<Tendril>) {
21+// pub fn new(from: usize, to: usize, insert: Option<Tendril>) {
38− // old_extent, new_extent, insert
22+// // old_extent, new_extent, insert
39− }
23+// }
40−}
24+// }
41
25
42#[derive(Copy, Clone, PartialEq, Eq)]
26#[derive(Copy, Clone, PartialEq, Eq)]
43pub enum Assoc {
27pub enum Assoc {
@@ -46,13 +30,8 @@ pub enum Assoc {
46}
30}
47
31
48// ChangeSpec = Change | ChangeSet | Vec<Change>
32// ChangeSpec = Change | ChangeSet | Vec<Change>
49−// ChangeDesc as a ChangeSet without text: can't be applied, cheaper to store.
50−// ChangeSet = ChangeDesc with Text
51#[derive(Debug)]
33#[derive(Debug)]
52pub struct ChangeSet {
34pub struct ChangeSet {
53− // basically Vec<ChangeDesc> where ChangeDesc = (current len, replacement len?)
54− // (0, n>0) for insertion, (n>0, 0) for deletion, (>0, >0) for replacement
55− // sections: Vec<(usize, isize)>,
56 changes: Vec<Change>,
35 changes: Vec<Change>,
57 /// The required document length. Will refuse to apply changes unless it matches.
36 /// The required document length. Will refuse to apply changes unless it matches.
58 len: usize,
37 len: usize,
@@ -341,6 +320,8 @@ pub struct Transaction {
341 // scroll_into_view
320 // scroll_into_view
342}
321}
343
322
323+impl Transaction {}
324+
344#[cfg(test)]
325#[cfg(test)]
345mod test {
326mod test {
346 use super::*;
327 use super::*;
helix-term/Cargo.toml+13−4
@@ -10,13 +10,22 @@ edition = "2018"
10name = "hx"
10name = "hx"
11path = "src/main.rs"
11path = "src/main.rs"
12
12
13−# [[bin]]
13+[[bin]]
14−# name = "line"
14+name = "line"
15−# path = "src/line.rs"
15+path = "src/line.rs"
16
16
17[dependencies]
17[dependencies]
18# termwiz = { git = "https://github.com/wez/wezterm", features = ["widgets"] }
18# termwiz = { git = "https://github.com/wez/wezterm", features = ["widgets"] }
19−termwiz = { path = "../../wezterm/termwiz", default-features = false, features = ["widgets"] }
19+# termwiz = { path = "../../wezterm/termwiz", default-features = false, features = ["widgets"] }
20+
20anyhow = "1.0.31"
21anyhow = "1.0.31"
21argh = "0.1.3"
22argh = "0.1.3"
22helix-core = { path = "../helix-core" }
23helix-core = { path = "../helix-core" }
24+# crossterm = { version = "0.17.5", features = ["event-stream"] }
25+crossterm = { git = "https://github.com/crossterm-rs/crossterm", branch = "mio-update", features = ["event-stream"] }
26+
27+futures = { version = "0.3.5", default-features = false, features = ["std"] }
28+# futures-timer = "3.0.2"
29+smol = "0.1.10"
30+num_cpus = "1.13.0"
31+piper = "0.1.2"
helix-term/src/line.rs+79−93
@@ -1,111 +1,97 @@
1−use termwiz::cell::AttributeChange;
1+//! Demonstrates how to read events asynchronously with async-std.
2−use termwiz::color::{AnsiColor, ColorAttribute, RgbColor};
2+//!
3−use termwiz::lineedit::*;
3+//! cargo run --features="event-stream" --example event-stream-async-std
4
4
5−#[derive(Default)]
5+use std::{
6−struct Host {
6+ io::{stdout, Write},
7− history: BasicHistory,
7+ time::Duration,
8−}
8+};
9
9
10−impl LineEditorHost for Host {
10+use futures::{future::FutureExt, select, StreamExt};
11− // Render the prompt with a darkslateblue background color if
11+use smol::Timer;
12− // the terminal supports true color, otherwise render it with
12+// use futures_timer::Delay;
13− // a navy blue ansi color.
14− fn render_prompt(&self, prompt: &str) -> Vec<OutputElement> {
15− vec![
16− OutputElement::Attribute(AttributeChange::Background(
17− ColorAttribute::TrueColorWithPaletteFallback(
18− RgbColor::from_named("darkslateblue").unwrap(),
19− AnsiColor::Navy.into(),
20− ),
21− )),
22− OutputElement::Text(prompt.to_owned()),
23− ]
24− }
25
13
26− fn history(&mut self) -> &mut dyn History {
14+use crossterm::{
27− &mut self.history
15+ cursor::position,
28− }
16+ event::{DisableMouseCapture, EnableMouseCapture, Event, EventStream, KeyCode},
17+ execute,
18+ terminal::{disable_raw_mode, enable_raw_mode},
19+ Result,
20+};
21+
22+const HELP: &str = r#"EventStream based on futures::Stream with async-std
23+ - Keyboard, mouse and terminal resize events enabled
24+ - Prints "." every second if there's no event
25+ - Hit "c" to print current cursor position
26+ - Use Esc to quit
27+"#;
28+
29+async fn print_events() {
30+ let mut reader = EventStream::new();
29
31
30− /// Demo of the completion API for words starting with "h" or "he"
32+ loop {
31− fn complete(&self, line: &str, cursor_position: usize) -> Vec<CompletionCandidate> {
33+ let mut delay = Timer::after(Duration::from_millis(1_000)).fuse();
32− let mut candidates = vec![];
34+ let mut event = reader.next().fuse();
33− if let Some((range, word)) = word_at_cursor(line, cursor_position) {
35+
34− let words = &["hello", "help", "he-man"];
36+ select! {
35−
37+ _ = delay => { println!(".\r"); },
36− for w in words {
38+ maybe_event = event => {
37− if w.starts_with(word) {
39+ match maybe_event {
38− candidates.push(CompletionCandidate {
40+ Some(Ok(event)) => {
39− range: range.clone(),
41+ println!("Event::{:?}\r", event);
40− text: w.to_string(),
42+
43+ if event == Event::Key(KeyCode::Char('c').into()) {
44+ println!("Cursor position: {:?}\r", position());
45+ }
46+
47+ if event == Event::Key(KeyCode::Esc.into()) {
48+ break;
49+ }
41− });
50+ }
51+ Some(Err(e)) => println!("Error: {:?}\r", e),
52+ None => break,
42 }
53 }
43 }
54 }
44− }
55+ };
45− candidates
46 }
56 }
47}
57}
48
58
49−/// This is a conceptually simple function that computes the bounds
59+fn main() -> Result<()> {
50−/// of the whitespace delimited word at the specified cursor position
60+ println!("{}", HELP);
51−/// in the supplied line string.
52−/// It returns the range and the corresponding slice out of the line.
53−/// This function is sufficient for example purposes; in a real application
54−/// the equivalent function would need to be aware of quoting and other
55−/// application specific context.
56−fn word_at_cursor(line: &str, cursor_position: usize) -> Option<(std::ops::Range<usize>, &str)> {
57− let char_indices: Vec<(usize, char)> = line.char_indices().collect();
58− if char_indices.is_empty() {
59− return None;
60− }
61− let char_position = char_indices
62− .iter()
63− .position(|(idx, _)| *idx == cursor_position)
64− .unwrap_or(char_indices.len());
65−
66− // Look back until we find whitespace
67− let mut start_position = char_position;
68− while start_position > 0
69− && start_position <= char_indices.len()
70− && !char_indices[start_position - 1].1.is_whitespace()
71− {
72− start_position -= 1;
73− }
74
61
75− // Look forwards until we find whitespace
62+ enable_raw_mode()?;
76− let mut end_position = char_position;
63+
77− while end_position < char_indices.len() && !char_indices[end_position].1.is_whitespace() {
64+ let mut stdout = stdout();
78− end_position += 1;
65+ execute!(stdout, EnableMouseCapture)?;
79− }
66+
67+ use std::thread;
68+
69+ // Same number of threads as there are CPU cores.
70+ let num_threads = num_cpus::get().max(1);
80
71
81− if end_position > start_position {
72+ // A channel that sends the shutdown signal.
82− let range = char_indices[start_position].0
73+ let (s, r) = piper::chan::<()>(0);
83− ..char_indices
74+ let mut threads = Vec::new();
84− .get(end_position)
75+
85− .map(|c| c.0 + 1)
76+ // Create an executor thread pool.
86− .unwrap_or(line.len());
77+ for _ in 0..num_threads {
87− Some((range.clone(), &line[range]))
78+ // Spawn an executor thread that waits for the shutdown signal.
88− } else {
79+ let r = r.clone();
89− None
80+ threads.push(thread::spawn(move || smol::run(r.recv())));
90 }
81 }
91−}
92
82
93−fn main() -> anyhow::Result<()> {
83+ // No need to `run()`, now we can just block on the main future.
94− println!("Type `exit` to quit this example, or start a word with `h` and press Tab.");
84+ smol::block_on(print_events());
95− let mut terminal = line_editor_terminal()?;
96− let mut editor = LineEditor::new(&mut terminal);
97
85
98− let mut host = Host::default();
86+ // Send a shutdown signal.
99− loop {
87+ drop(s);
100− if let Some(line) = editor.read_line(&mut host)? {
101− println!("read line: {:?}", line);
102− if line == "exit" {
103− break;
104− }
105
88
106− host.history().add(&line);
89+ // Wait for threads to finish.
107− }
90+ for t in threads {
91+ t.join().unwrap();
108 }
92 }
109
93
110− Ok(())
94+ execute!(stdout, DisableMouseCapture)?;
95+
96+ disable_raw_mode()
111}
97}
helix-term/src/main.rs+4−4
@@ -1,6 +1,6 @@
1−mod editor;
1+// mod editor;
2
2
3−use editor::Editor;
3+// use editor::Editor;
4
4
5use argh::FromArgs;
5use argh::FromArgs;
6use std::{env, path::PathBuf};
6use std::{env, path::PathBuf};
@@ -16,9 +16,9 @@ pub struct Args {
16
16
17fn main() -> Result<(), Error> {
17fn main() -> Result<(), Error> {
18 let args: Args = argh::from_env();
18 let args: Args = argh::from_env();
19− let mut editor = Editor::new(args)?;
19+ // let mut editor = Editor::new(args)?;
20
20
21− editor.run()?;
21+ // editor.run()?;
22
22
23 Ok(())
23 Ok(())
24}
24}