on master help sign in
Start swapping from termwiz to crossterm + async.
commit6905ff03c29c9fc020a6333adf9e9d5004c3f3c5 authorBlaž Hrastnik <blaz@mxxn.io> dateThu 28 May 2020, 17:47 (6 years ago) parent1984410
6 files changed+443−477
Cargo.lock+335−349 helix-core/src/state.rs+5−1 helix-core/src/transaction.rs+7−26 helix-term/Cargo.toml+13−4 helix-term/src/line.rs+79−93 helix-term/src/main.rs+4−4
Cargo.lock+335−349
@@ -1,14 +1,5 @@
11# This file is automatically @generated by Cargo.
22# 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−
123[[package]]
134name = "anyhow"
145version = "1.0.31"
@@ -39,9 +30,9 @@ checksum = "e742194e0f43fc932bcb801708c2b279d3ec8f527e3acda05a6a9f342c5ef764"
3930dependencies = [
4031 "argh_shared",
4132 "heck",
42− "proc-macro2 1.0.13",
43− "quote 1.0.6",
44− "syn 1.0.22",
33+ "proc-macro2",
34+ "quote",
35+ "syn",
4536]
4637
4738[[package]]
@@ -51,16 +42,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
5142checksum = "e1ba68f4276a778591e36a0c348a269888f3a177c8d2054969389e3b59611ff5"
5243
5344[[package]]
54−name = "arrayref"
55−version = "0.3.6"
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"
45+name = "async-task"
46+version = "3.0.0"
6247source = "registry+https://github.com/rust-lang/crates.io-index"
63−checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
48+checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3"
6449
6550[[package]]
6651name = "autocfg"
@@ -69,108 +54,127 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
6954checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
7055
7156[[package]]
72−name = "base64"
73−version = "0.10.1"
57+name = "bitflags"
58+version = "1.2.1"
7459source = "registry+https://github.com/rust-lang/crates.io-index"
75−checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
76−dependencies = [
77− "byteorder",
78−]
60+checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
7961
8062[[package]]
81−name = "base64"
82−version = "0.11.0"
63+name = "cc"
64+version = "1.0.54"
8365source = "registry+https://github.com/rust-lang/crates.io-index"
84−checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
66+checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
8567
8668[[package]]
87−name = "bitflags"
88−version = "1.2.1"
69+name = "cfg-if"
70+version = "0.1.9"
8971source = "registry+https://github.com/rust-lang/crates.io-index"
90−checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
72+checksum = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
9173
9274[[package]]
93−name = "blake2b_simd"
94−version = "0.5.10"
75+name = "cloudabi"
76+version = "0.0.3"
9577source = "registry+https://github.com/rust-lang/crates.io-index"
96−checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
78+checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
9779dependencies = [
98− "arrayref",
99− "arrayvec",
100− "constant_time_eq",
80+ "bitflags",
10181]
10282
10383[[package]]
104−name = "byteorder"
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"
84+name = "crossbeam"
85+version = "0.7.3"
11286source = "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+]
11496
11597[[package]]
116−name = "cfg-if"
117−version = "0.1.9"
98+name = "crossbeam-channel"
99+version = "0.4.2"
118100source = "registry+https://github.com/rust-lang/crates.io-index"
119−checksum = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
101+checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061"
102+dependencies = [
103+ "crossbeam-utils",
104+ "maybe-uninit",
105+]
120106
121107[[package]]
122−name = "constant_time_eq"
123−version = "0.1.5"
108+name = "crossbeam-deque"
109+version = "0.7.3"
124110source = "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+]
126117
127118[[package]]
128−name = "crossbeam-utils"
129−version = "0.7.2"
119+name = "crossbeam-epoch"
120+version = "0.8.2"
130121source = "registry+https://github.com/rust-lang/crates.io-index"
131−checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
122+checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
132123dependencies = [
133124 "autocfg",
134125 "cfg-if",
126+ "crossbeam-utils",
135127 "lazy_static",
128+ "maybe-uninit",
129+ "memoffset",
130+ "scopeguard",
136131]
137132
138133[[package]]
139−name = "dirs"
140−version = "2.0.2"
134+name = "crossbeam-queue"
135+version = "0.2.1"
141136source = "registry+https://github.com/rust-lang/crates.io-index"
142−checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
137+checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
143138dependencies = [
144139 "cfg-if",
145− "dirs-sys",
140+ "crossbeam-utils",
146141]
147142
148143[[package]]
149−name = "dirs-sys"
150−version = "0.3.4"
144+name = "crossbeam-utils"
145+version = "0.7.2"
151146source = "registry+https://github.com/rust-lang/crates.io-index"
152−checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
147+checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
153148dependencies = [
149+ "autocfg",
154150 "cfg-if",
155− "libc",
156− "redox_users",
157− "winapi",
151+ "lazy_static",
158152]
159153
160154[[package]]
161−name = "filedescriptor"
162−version = "0.7.1"
155+name = "crossterm"
156+version = "0.17.4"
157+source = "git+https://github.com/crossterm-rs/crossterm?branch=mio-update#4ab507dfc41a32dec0d8249f599b02c3a78a83f7"
163158dependencies = [
164− "anyhow",
159+ "bitflags",
160+ "crossterm_winapi",
161+ "futures",
162+ "lazy_static",
165163 "libc",
164+ "mio",
165+ "parking_lot",
166+ "signal-hook",
166167 "winapi",
167168]
168169
169170[[package]]
170−name = "fnv"
171−version = "1.0.7"
171+name = "crossterm_winapi"
172+version = "0.6.1"
172173source = "registry+https://github.com/rust-lang/crates.io-index"
173−checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
174+checksum = "057b7146d02fb50175fd7dbe5158f6097f33d02831f43b4ee8ae4ddf67b68f5c"
175+dependencies = [
176+ "winapi",
177+]
174178
175179[[package]]
176180name = "futf"
@@ -183,14 +187,98 @@ dependencies = [
183187]
184188
185189[[package]]
186−name = "getrandom"
187−version = "0.1.14"
190+name = "futures"
191+version = "0.3.5"
188192source = "registry+https://github.com/rust-lang/crates.io-index"
189−checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
193+checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"
190194dependencies = [
191− "cfg-if",
192− "libc",
193− "wasi",
195+ "futures-channel",
196+ "futures-core",
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",
194282]
195283
196284[[package]]
@@ -208,7 +296,7 @@ version = "0.1.0"
208296dependencies = [
209297 "anyhow",
210298 "ropey",
211− "smallvec 1.4.0",
299+ "smallvec",
212300 "tendril",
213301]
214302
@@ -218,8 +306,21 @@ version = "0.1.0"
218306dependencies = [
219307 "anyhow",
220308 "argh",
309+ "crossterm",
310+ "futures",
221311 "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",
223324]
224325
225326[[package]]
@@ -234,6 +335,15 @@ version = "0.2.70"
234335source = "registry+https://github.com/rust-lang/crates.io-index"
235336checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
236337
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+
237347[[package]]
238348name = "log"
239349version = "0.4.8"
@@ -262,256 +372,199 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
262372checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
263373
264374[[package]]
265−name = "memmem"
266−version = "0.1.1"
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"
375+name = "memoffset"
376+version = "0.5.4"
279377source = "registry+https://github.com/rust-lang/crates.io-index"
280−checksum = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6"
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"
378+checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8"
302379dependencies = [
303380 "autocfg",
304381]
305382
306383[[package]]
307−name = "ordered-float"
308−version = "1.0.2"
384+name = "mio"
385+version = "0.7.0"
309386source = "registry+https://github.com/rust-lang/crates.io-index"
310−checksum = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
387+checksum = "6e9971bc8349a361217a8f2a41f5d011274686bd4436465ba51730921039d7fb"
311388dependencies = [
312− "num-traits",
389+ "lazy_static",
390+ "libc",
391+ "log",
392+ "miow",
393+ "ntapi",
394+ "winapi",
313395]
314396
315397[[package]]
316−name = "phf"
317−version = "0.8.0"
398+name = "miow"
399+version = "0.3.4"
318400source = "registry+https://github.com/rust-lang/crates.io-index"
319−checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
401+checksum = "22dfdd1d51b2639a5abd17ed07005c3af05fb7a2a3b1a1d0d7af1000a520c1c7"
320402dependencies = [
321− "phf_shared",
403+ "socket2",
404+ "winapi",
322405]
323406
324407[[package]]
325−name = "phf_codegen"
326−version = "0.8.0"
408+name = "new_debug_unreachable"
409+version = "1.0.4"
327410source = "registry+https://github.com/rust-lang/crates.io-index"
328−checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815"
329−dependencies = [
330− "phf_generator",
331− "phf_shared",
332−]
411+checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
333412
334413[[package]]
335−name = "phf_generator"
336−version = "0.8.0"
414+name = "nix"
415+version = "0.17.0"
337416source = "registry+https://github.com/rust-lang/crates.io-index"
338−checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
417+checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
339418dependencies = [
340− "phf_shared",
341− "rand",
419+ "bitflags",
420+ "cc",
421+ "cfg-if",
422+ "libc",
423+ "void",
342424]
343425
344426[[package]]
345−name = "phf_shared"
346−version = "0.8.0"
427+name = "ntapi"
428+version = "0.3.4"
347429source = "registry+https://github.com/rust-lang/crates.io-index"
348−checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
430+checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2"
349431dependencies = [
350− "siphasher",
432+ "winapi",
351433]
352434
353435[[package]]
354−name = "ppv-lite86"
355−version = "0.2.8"
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"
436+name = "num_cpus"
437+version = "1.13.0"
362438source = "registry+https://github.com/rust-lang/crates.io-index"
363−checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
439+checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
364440dependencies = [
365− "unicode-xid 0.1.0",
441+ "hermit-abi",
442+ "libc",
366443]
367444
368445[[package]]
369−name = "proc-macro2"
370−version = "1.0.13"
446+name = "once_cell"
447+version = "1.4.0"
371448source = "registry+https://github.com/rust-lang/crates.io-index"
372−checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639"
373−dependencies = [
374− "unicode-xid 0.2.0",
375−]
449+checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
376450
377451[[package]]
378−name = "quote"
379−version = "0.6.13"
452+name = "parking_lot"
453+version = "0.10.2"
380454source = "registry+https://github.com/rust-lang/crates.io-index"
381−checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
455+checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
382456dependencies = [
383− "proc-macro2 0.4.30",
457+ "lock_api",
458+ "parking_lot_core",
384459]
385460
386461[[package]]
387−name = "quote"
388−version = "1.0.6"
462+name = "parking_lot_core"
463+version = "0.7.2"
389464source = "registry+https://github.com/rust-lang/crates.io-index"
390−checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
465+checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
391466dependencies = [
392− "proc-macro2 1.0.13",
467+ "cfg-if",
468+ "cloudabi",
469+ "libc",
470+ "redox_syscall",
471+ "smallvec",
472+ "winapi",
393473]
394474
395475[[package]]
396−name = "rand"
397−version = "0.7.3"
476+name = "pin-project"
477+version = "0.4.17"
398478source = "registry+https://github.com/rust-lang/crates.io-index"
399−checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
479+checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791"
400480dependencies = [
401− "getrandom",
402− "libc",
403− "rand_chacha",
404− "rand_core",
405− "rand_hc",
406− "rand_pcg",
481+ "pin-project-internal",
407482]
408483
409484[[package]]
410−name = "rand_chacha"
411−version = "0.2.2"
485+name = "pin-project-internal"
486+version = "0.4.17"
412487source = "registry+https://github.com/rust-lang/crates.io-index"
413−checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
488+checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40"
414489dependencies = [
415− "ppv-lite86",
416− "rand_core",
490+ "proc-macro2",
491+ "quote",
492+ "syn",
417493]
418494
419495[[package]]
420−name = "rand_core"
421−version = "0.5.1"
496+name = "pin-utils"
497+version = "0.1.0"
422498source = "registry+https://github.com/rust-lang/crates.io-index"
423−checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
424−dependencies = [
425− "getrandom",
426−]
499+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
427500
428501[[package]]
429−name = "rand_hc"
430−version = "0.2.0"
502+name = "piper"
503+version = "0.1.2"
431504source = "registry+https://github.com/rust-lang/crates.io-index"
432−checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
505+checksum = "6b0deb65f46e873ba8aa7c6a8dbe3f23cb1bf59c339a81a1d56361dde4d66ac8"
433506dependencies = [
434− "rand_core",
507+ "crossbeam-utils",
508+ "futures-io",
509+ "futures-sink",
510+ "futures-util",
435511]
436512
437513[[package]]
438−name = "rand_pcg"
439−version = "0.2.1"
514+name = "proc-macro-hack"
515+version = "0.5.16"
440516source = "registry+https://github.com/rust-lang/crates.io-index"
441−checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
442−dependencies = [
443− "rand_core",
444−]
517+checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
445518
446519[[package]]
447−name = "redox_syscall"
448−version = "0.1.56"
520+name = "proc-macro-nested"
521+version = "0.1.4"
449522source = "registry+https://github.com/rust-lang/crates.io-index"
450−checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
523+checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
451524
452525[[package]]
453−name = "redox_users"
454−version = "0.3.4"
526+name = "proc-macro2"
527+version = "1.0.13"
455528source = "registry+https://github.com/rust-lang/crates.io-index"
456−checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
529+checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639"
457530dependencies = [
458− "getrandom",
459− "redox_syscall",
460− "rust-argon2",
531+ "unicode-xid",
461532]
462533
463534[[package]]
464−name = "regex"
465−version = "1.3.7"
535+name = "quote"
536+version = "1.0.6"
466537source = "registry+https://github.com/rust-lang/crates.io-index"
467−checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
538+checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
468539dependencies = [
469− "aho-corasick",
470− "memchr",
471− "regex-syntax",
472− "thread_local",
540+ "proc-macro2",
473541]
474542
475543[[package]]
476−name = "regex-syntax"
477−version = "0.6.17"
544+name = "redox_syscall"
545+version = "0.1.56"
478546source = "registry+https://github.com/rust-lang/crates.io-index"
479−checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
547+checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
480548
481549[[package]]
482550name = "ropey"
483551version = "1.1.0"
484552source = "git+https://github.com/cessen/ropey#083c34949274ef9800267e6bc64b76a45e401807"
485553dependencies = [
486− "smallvec 1.4.0",
554+ "smallvec",
487555]
488556
489557[[package]]
490−name = "rust-argon2"
491−version = "0.7.0"
558+name = "scoped-tls-hkt"
559+version = "0.1.2"
492560source = "registry+https://github.com/rust-lang/crates.io-index"
493−checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017"
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−]
561+checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63"
509562
510563[[package]]
511−name = "semver-parser"
512−version = "0.7.0"
564+name = "scopeguard"
565+version = "1.1.0"
513566source = "registry+https://github.com/rust-lang/crates.io-index"
514−checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
567+checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
515568
516569[[package]]
517570name = "signal-hook"
@@ -520,6 +573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
520573checksum = "8ff2db2112d6c761e12522c65f7768548bd6e8cd23d2a9dae162520626629bd6"
521574dependencies = [
522575 "libc",
576+ "mio",
523577 "signal-hook-registry",
524578]
525579
@@ -534,35 +588,46 @@ dependencies = [
534588]
535589
536590[[package]]
537−name = "siphasher"
538−version = "0.3.3"
591+name = "slab"
592+version = "0.4.2"
539593source = "registry+https://github.com/rust-lang/crates.io-index"
540−checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7"
594+checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
541595
542596[[package]]
543597name = "smallvec"
544−version = "0.6.13"
598+version = "1.4.0"
545599source = "registry+https://github.com/rust-lang/crates.io-index"
546−checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
547−dependencies = [
548− "maybe-uninit",
549−]
600+checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
550601
551602[[package]]
552−name = "smallvec"
553−version = "1.4.0"
603+name = "smol"
604+version = "0.1.10"
554605source = "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+]
556620
557621[[package]]
558−name = "syn"
559−version = "0.15.44"
622+name = "socket2"
623+version = "0.3.12"
560624source = "registry+https://github.com/rust-lang/crates.io-index"
561−checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
625+checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
562626dependencies = [
563− "proc-macro2 0.4.30",
564− "quote 0.6.13",
565− "unicode-xid 0.1.0",
627+ "cfg-if",
628+ "libc",
629+ "redox_syscall",
630+ "winapi",
566631]
567632
568633[[package]]
@@ -571,9 +636,9 @@ version = "1.0.22"
571636source = "registry+https://github.com/rust-lang/crates.io-index"
572637checksum = "1425de3c33b0941002740a420b1a906a350b88d08b82b2c8a01035a3f9447bac"
573638dependencies = [
574− "proc-macro2 1.0.13",
575− "quote 1.0.6",
576− "unicode-xid 0.2.0",
639+ "proc-macro2",
640+ "quote",
641+ "unicode-xid",
577642]
578643
579644[[package]]
@@ -586,85 +651,12 @@ dependencies = [
586651 "utf-8",
587652]
588653
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−
650654[[package]]
651655name = "unicode-segmentation"
652656version = "1.6.0"
653657source = "registry+https://github.com/rust-lang/crates.io-index"
654658checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
655659
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−
668660[[package]]
669661name = "unicode-xid"
670662version = "0.2.0"
@@ -678,29 +670,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
678670checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
679671
680672[[package]]
681−name = "utf8parse"
682−version = "0.1.1"
673+name = "void"
674+version = "1.0.2"
683675source = "registry+https://github.com/rust-lang/crates.io-index"
684−checksum = "8772a4ccbb4e89959023bc5b7cb8623a795caa7092d99f3aa9501b9484d4557d"
676+checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
685677
686678[[package]]
687−name = "version_check"
688−version = "0.9.1"
679+name = "wepoll-binding"
680+version = "2.0.2"
689681source = "registry+https://github.com/rust-lang/crates.io-index"
690−checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
691−
692−[[package]]
693−name = "vtparse"
694−version = "0.2.2"
682+checksum = "374fff4ff9701ff8b6ad0d14bacd3156c44063632d8c136186ff5967d48999a7"
695683dependencies = [
696− "utf8parse",
684+ "bitflags",
685+ "wepoll-sys",
697686]
698687
699688[[package]]
700−name = "wasi"
701−version = "0.9.0+wasi-snapshot-preview1"
689+name = "wepoll-sys"
690+version = "2.0.0"
702691source = "registry+https://github.com/rust-lang/crates.io-index"
703−checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
692+checksum = "9082a777aed991f6769e2b654aa0cb29f1c3d615daf009829b07b66c7aff6a24"
693+dependencies = [
694+ "cc",
695+]
704696
705697[[package]]
706698name = "winapi"
@@ -723,9 +715,3 @@ name = "winapi-x86_64-pc-windows-gnu"
723715version = "0.4.0"
724716source = "registry+https://github.com/rust-lang/crates.io-index"
725717checksum = "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 {
1818
1919 // TODO: buf/selection accessors
2020
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+
2226 // replaceSelection (transaction that replaces selection)
2327 // changeByRange
2428 // 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−
171use crate::{Buffer, Rope, Selection, Tendril};
182
193// TODO: divided into three different operations, I sort of like having just
@@ -33,11 +17,11 @@ pub enum Change {
3317 Insert(Tendril),
3418}
3519
36−impl Change {
37− pub fn new(from: usize, to: usize, insert: Option<Tendril>) {
38− // old_extent, new_extent, insert
39− }
40−}
20+// impl Change {
21+// pub fn new(from: usize, to: usize, insert: Option<Tendril>) {
22+// // old_extent, new_extent, insert
23+// }
24+// }
4125
4226#[derive(Copy, Clone, PartialEq, Eq)]
4327pub enum Assoc {
@@ -46,13 +30,8 @@ pub enum Assoc {
4630}
4731
4832// ChangeSpec = Change | ChangeSet | Vec<Change>
49−// ChangeDesc as a ChangeSet without text: can't be applied, cheaper to store.
50−// ChangeSet = ChangeDesc with Text
5133#[derive(Debug)]
5234pub 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)>,
5635 changes: Vec<Change>,
5736 /// The required document length. Will refuse to apply changes unless it matches.
5837 len: usize,
@@ -341,6 +320,8 @@ pub struct Transaction {
341320 // scroll_into_view
342321}
343322
323+impl Transaction {}
324+
344325#[cfg(test)]
345326mod test {
346327 use super::*;
helix-term/Cargo.toml+13−4
@@ -10,13 +10,22 @@ edition = "2018"
1010name = "hx"
1111path = "src/main.rs"
1212
13−# [[bin]]
14−# name = "line"
15−# path = "src/line.rs"
13+[[bin]]
14+name = "line"
15+path = "src/line.rs"
1616
1717[dependencies]
1818# 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+
2021anyhow = "1.0.31"
2122argh = "0.1.3"
2223helix-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;
2−use termwiz::color::{AnsiColor, ColorAttribute, RgbColor};
3−use termwiz::lineedit::*;
1+//! Demonstrates how to read events asynchronously with async-std.
2+//!
3+//! cargo run --features="event-stream" --example event-stream-async-std
44
5−#[derive(Default)]
6−struct Host {
7− history: BasicHistory,
8−}
5+use std::{
6+ io::{stdout, Write},
7+ time::Duration,
8+};
99
10−impl LineEditorHost for Host {
11− // Render the prompt with a darkslateblue background color if
12− // the terminal supports true color, otherwise render it with
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− }
10+use futures::{future::FutureExt, select, StreamExt};
11+use smol::Timer;
12+// use futures_timer::Delay;
2513
26− fn history(&mut self) -> &mut dyn History {
27− &mut self.history
28− }
14+use crossterm::{
15+ cursor::position,
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();
2931
30− /// Demo of the completion API for words starting with "h" or "he"
31− fn complete(&self, line: &str, cursor_position: usize) -> Vec<CompletionCandidate> {
32− let mut candidates = vec![];
33− if let Some((range, word)) = word_at_cursor(line, cursor_position) {
34− let words = &["hello", "help", "he-man"];
35−
36− for w in words {
37− if w.starts_with(word) {
38− candidates.push(CompletionCandidate {
39− range: range.clone(),
40− text: w.to_string(),
41− });
32+ loop {
33+ let mut delay = Timer::after(Duration::from_millis(1_000)).fuse();
34+ let mut event = reader.next().fuse();
35+
36+ select! {
37+ _ = delay => { println!(".\r"); },
38+ maybe_event = event => {
39+ match maybe_event {
40+ Some(Ok(event)) => {
41+ println!("Event::{:?}\r", event);
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+ }
50+ }
51+ Some(Err(e)) => println!("Error: {:?}\r", e),
52+ None => break,
4253 }
4354 }
44− }
45− candidates
55+ };
4656 }
4757}
4858
49−/// This is a conceptually simple function that computes the bounds
50−/// of the whitespace delimited word at the specified cursor position
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− }
59+fn main() -> Result<()> {
60+ println!("{}", HELP);
7461
75− // Look forwards until we find whitespace
76− let mut end_position = char_position;
77− while end_position < char_indices.len() && !char_indices[end_position].1.is_whitespace() {
78− end_position += 1;
79− }
62+ enable_raw_mode()?;
63+
64+ let mut stdout = stdout();
65+ execute!(stdout, EnableMouseCapture)?;
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);
8071
81− if end_position > start_position {
82− let range = char_indices[start_position].0
83− ..char_indices
84− .get(end_position)
85− .map(|c| c.0 + 1)
86− .unwrap_or(line.len());
87− Some((range.clone(), &line[range]))
88− } else {
89− None
72+ // A channel that sends the shutdown signal.
73+ let (s, r) = piper::chan::<()>(0);
74+ let mut threads = Vec::new();
75+
76+ // Create an executor thread pool.
77+ for _ in 0..num_threads {
78+ // Spawn an executor thread that waits for the shutdown signal.
79+ let r = r.clone();
80+ threads.push(thread::spawn(move || smol::run(r.recv())));
9081 }
91−}
9282
93−fn main() -> anyhow::Result<()> {
94− println!("Type `exit` to quit this example, or start a word with `h` and press Tab.");
95− let mut terminal = line_editor_terminal()?;
96− let mut editor = LineEditor::new(&mut terminal);
83+ // No need to `run()`, now we can just block on the main future.
84+ smol::block_on(print_events());
9785
98− let mut host = Host::default();
99− loop {
100− if let Some(line) = editor.read_line(&mut host)? {
101− println!("read line: {:?}", line);
102− if line == "exit" {
103− break;
104− }
86+ // Send a shutdown signal.
87+ drop(s);
10588
106− host.history().add(&line);
107− }
89+ // Wait for threads to finish.
90+ for t in threads {
91+ t.join().unwrap();
10892 }
10993
110− Ok(())
94+ execute!(stdout, DisableMouseCapture)?;
95+
96+ disable_raw_mode()
11197}
helix-term/src/main.rs+4−4
@@ -1,6 +1,6 @@
1−mod editor;
1+// mod editor;
22
3−use editor::Editor;
3+// use editor::Editor;
44
55use argh::FromArgs;
66use std::{env, path::PathBuf};
@@ -16,9 +16,9 @@ pub struct Args {
1616
1717fn main() -> Result<(), Error> {
1818 let args: Args = argh::from_env();
19− let mut editor = Editor::new(args)?;
19+ // let mut editor = Editor::new(args)?;
2020
21− editor.run()?;
21+ // editor.run()?;
2222
2323 Ok(())
2424}