From 4ef6adcfefd44fb85cb99a88e540623898c6dfb2 Mon Sep 17 00:00:00 2001 From: keith Date: Fri, 28 Aug 2020 21:23:25 -0700 Subject: [PATCH] part way to multi grid rendering --- Cargo.lock | 721 ++++++++++++++++------------ Cargo.toml | 1 + src/bridge/mod.rs | 1 + src/editor/cursor.rs | 4 + src/editor/mod.rs | 325 ++++++------- src/editor/window.rs | 224 +++++++++ src/renderer/cursor_renderer/mod.rs | 26 +- src/renderer/mod.rs | 123 +++-- 8 files changed, 879 insertions(+), 546 deletions(-) create mode 100644 src/editor/window.rs diff --git a/Cargo.lock b/Cargo.lock index 2c81089..8fa39c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,10 +1,16 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + [[package]] name = "adler32" -version = "1.0.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "ahash" @@ -17,9 +23,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" dependencies = [ "memchr", ] @@ -39,10 +45,10 @@ dependencies = [ ] [[package]] -name = "android_glue" -version = "0.2.3" +name = "android_log-sys" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" +checksum = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e" [[package]] name = "ansi_term" @@ -50,14 +56,14 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "anyhow" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9a60d744a80c30fcb657dfe2c1b22bcb3e814c1a1e3674f32bf5820b570fbff" +checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" [[package]] name = "approx" @@ -70,9 +76,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" [[package]] name = "arrayref" @@ -88,22 +94,22 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" [[package]] name = "ash" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69daec0742947f33a85931fa3cb0ce5f07929159dcbd1f0cbb5b2912e2978509" +checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38" dependencies = [ - "libloading", + "libloading 0.6.3", ] [[package]] name = "async-trait" -version = "0.1.30" +version = "0.1.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d" +checksum = "6e1a4a2f97ce50c9d0282c1468816208588441492b40d813b2e0419c22c05e7f" dependencies = [ - "proc-macro2 1.0.12", - "quote 1.0.4", - "syn 1.0.19", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", ] [[package]] @@ -114,7 +120,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -125,9 +131,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "base64" @@ -137,9 +143,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "bindgen" -version = "0.53.2" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8" +checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36" dependencies = [ "bitflags", "cexpr", @@ -151,8 +157,8 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "proc-macro2 1.0.12", - "quote 1.0.4", + "proc-macro2 1.0.19", + "quote 1.0.7", "regex", "rustc-hash", "shlex", @@ -200,9 +206,9 @@ dependencies = [ [[package]] name = "bytes" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "calloop" @@ -223,9 +229,9 @@ checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad" [[package]] name = "cc" -version = "1.0.52" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" +checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" [[package]] name = "cexpr" @@ -244,9 +250,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chrono" -version = "0.4.11" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b" dependencies = [ "num-integer", "num-traits", @@ -261,14 +267,14 @@ checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.5.2", ] [[package]] name = "clap" -version = "2.33.0" +version = "2.33.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ "ansi_term", "atty", @@ -290,23 +296,23 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.42" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" +checksum = "0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb" dependencies = [ "cc", ] [[package]] name = "cocoa" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29f7768b2d1be17b96158e3285951d366b40211320fb30826a76cb7a0da6400" +checksum = "0c49e86fc36d5704151f5996b7b3795385f50ce09e3be0f47a0cfde869681cf8" dependencies = [ "bitflags", "block", - "core-foundation 0.6.4", - "core-graphics 0.17.3", + "core-foundation 0.7.0", + "core-graphics 0.19.2", "foreign-types", "libc", "objc", @@ -390,9 +396,9 @@ dependencies = [ [[package]] name = "core-graphics" -version = "0.19.0" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" dependencies = [ "bitflags", "core-foundation 0.7.0", @@ -419,7 +425,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "131b3fd1f8bd5db9f2b398fa4fdb6008c64afc04d447c306ac2c7e98fba2a61d" dependencies = [ "core-foundation 0.7.0", - "core-graphics 0.19.0", + "core-graphics 0.19.2", "foreign-types", "libc", ] @@ -432,7 +438,7 @@ checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" dependencies = [ "cfg-if", "core-foundation-sys 0.7.0", - "core-graphics 0.19.0", + "core-graphics 0.19.2", "libc", "objc", ] @@ -446,6 +452,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-channel" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ee0cc8804d5393478d743b035099520087a5186f3b93fa58cec08fa62407b6" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.7.3" @@ -463,7 +479,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "cfg-if", "crossbeam-utils", "lazy_static", @@ -472,32 +488,22 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "crossbeam-queue" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "cfg-if", "lazy_static", ] [[package]] name = "curl" -version = "0.4.29" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "762e34611d2d5233a506a79072be944fddd057db2f18e04c0d6fa79e3fd466fd" +checksum = "78baca05127a115136a9898e266988fc49ca7ea2c839f60fc6e1fc9df1599168" dependencies = [ "curl-sys", "libc", @@ -505,14 +511,14 @@ dependencies = [ "openssl-sys", "schannel", "socket2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "curl-sys" -version = "0.4.31+curl-7.70.0" +version = "0.4.36+curl-7.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcd62757cc4f5ab9404bc6ca9f0ae447e729a1403948ce5106bd588ceac6a3b0" +checksum = "68cad94adeb0c16558429c3c34a607acc9ea58e09a7b66310aabc9788fc5d721" dependencies = [ "cc", "libc", @@ -520,7 +526,7 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -533,15 +539,26 @@ dependencies = [ "byteorder", ] +[[package]] +name = "derivative" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" +dependencies = [ + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", +] + [[package]] name = "derive-new" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9" dependencies = [ - "proc-macro2 1.0.12", - "quote 1.0.4", - "syn 1.0.19", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", ] [[package]] @@ -562,14 +579,13 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" +checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" dependencies = [ - "cfg-if", "libc", "redox_users", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -580,11 +596,11 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dlib" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" +checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" dependencies = [ - "libloading", + "libloading 0.6.3", ] [[package]] @@ -595,9 +611,9 @@ checksum = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d" [[package]] name = "downcast-rs" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dwrote" @@ -607,21 +623,21 @@ checksum = "bcdf488e3a52a7aa30a05732a3e58420e22acb4b2b75635a561fc6ffbcab59ef" dependencies = [ "lazy_static", "libc", - "winapi 0.3.8", + "winapi 0.3.9", "wio", ] [[package]] name = "either" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f" [[package]] name = "encoding_rs" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" +checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" dependencies = [ "cfg-if", ] @@ -641,9 +657,9 @@ dependencies = [ [[package]] name = "euclid" -version = "0.20.11" +version = "0.20.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667703ececa1ac04d1d40ae0c0fd6401b91d8caccfda3a65458ca8ee5dfedf1c" +checksum = "2bb7ef65b3777a325d1eeefefab5b6d4959da54747e33bd6258e789640f307ad" dependencies = [ "num-traits", ] @@ -660,21 +676,21 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f59efc38004c988e4201d11d263b8171f49a2e7ec0bdbb71773433f271504a5e" +checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e" dependencies = [ "cfg-if", "libc", "redox_syscall", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "flate2" -version = "1.0.14" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" +checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" dependencies = [ "cfg-if", "crc32fast", @@ -696,9 +712,9 @@ dependencies = [ [[package]] name = "float-cmp" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62c4f1b81918835a8c6a484a397775fff5953fe83529afd51b05f5c6a6617d" +checksum = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4" dependencies = [ "num-traits", ] @@ -711,9 +727,9 @@ checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e" [[package]] name = "fnv" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "font-kit" @@ -724,7 +740,7 @@ dependencies = [ "bitflags", "byteorder", "core-foundation 0.7.0", - "core-graphics 0.19.0", + "core-graphics 0.19.2", "core-text 15.0.0", "dirs", "dwrote", @@ -737,7 +753,7 @@ dependencies = [ "pathfinder_simd", "servo-fontconfig", "walkdir", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -795,9 +811,9 @@ checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" [[package]] name = "futures" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" dependencies = [ "futures-channel", "futures-core", @@ -810,9 +826,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" dependencies = [ "futures-core", "futures-sink", @@ -820,15 +836,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" [[package]] name = "futures-executor" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" dependencies = [ "futures-core", "futures-task", @@ -837,39 +853,42 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" [[package]] name = "futures-macro" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.12", - "quote 1.0.4", - "syn 1.0.19", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", ] [[package]] name = "futures-sink" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" [[package]] name = "futures-task" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] [[package]] name = "futures-util" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" dependencies = [ "futures 0.1.29", "futures-channel", @@ -879,6 +898,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", + "pin-project", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -957,9 +977,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.12" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ "libc", ] @@ -1001,9 +1021,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7152d2aed88aa566e7a342250f21ba2222c1ae230ad577499dbfa3c18475b80" +checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485" [[package]] name = "iovec" @@ -1016,15 +1036,21 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jpeg-decoder" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704" +checksum = "cc797adac5f083b8ff0ca6f6294a999393d76e197c36488e2ef732c4715f6fa3" dependencies = [ "byteorder", "rayon", @@ -1048,15 +1074,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.69" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" +checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3" [[package]] name = "libloading" @@ -1065,14 +1091,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" dependencies = [ "cc", - "winapi 0.3.8", + "winapi 0.3.9", +] + +[[package]] +name = "libloading" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2443d8f0478b16759158b2f66d525991a05491138bc05814ef52a250148ef4f9" +dependencies = [ + "cfg-if", + "winapi 0.3.9", ] [[package]] name = "libz-sys" -version = "1.0.25" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +checksum = "af67924b8dd885cccea261866c8ce5b74d239d272e154053ff927dae839f5ae9" dependencies = [ "cc", "libc", @@ -1100,9 +1136,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ "cfg-if", ] @@ -1150,28 +1186,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "memoffset" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" +checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", ] [[package]] name = "metal" -version = "0.17.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83c7dcc2038e12f68493fa3de44235df27b2497178e257185b4b5b5d028a1e4" +checksum = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0" dependencies = [ "bitflags", "block", "cocoa", - "core-graphics 0.17.3", + "core-graphics 0.19.2", "foreign-types", "log", "objc", @@ -1179,11 +1215,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.3.6" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" +checksum = "4d7559a8a40d0f97e1edea3220f698f78b1c5ab67532e49f68fde3910323b722" dependencies = [ - "adler32", + "adler", ] [[package]] @@ -1219,14 +1255,14 @@ dependencies = [ [[package]] name = "mio-named-pipes" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ "log", "mio", - "miow 0.3.3", - "winapi 0.3.8", + "miow 0.3.5", + "winapi 0.3.9", ] [[package]] @@ -1254,19 +1290,19 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" dependencies = [ "socket2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "mockall" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256489d4d106cd2bc9e98ed0337402db0044de0621745d5d9eb70a14295ff77b" +checksum = "01458f8a19b10cb28195290942e3149161c75acf67ebc8fbf714ab67a2b943bc" dependencies = [ "cfg-if", "downcast", @@ -1279,16 +1315,47 @@ dependencies = [ [[package]] name = "mockall_derive" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e14e8643cb12103b56efb963e5f9640b69b0f7bdcc460002092df4b0e959f" +checksum = "a673cb441f78cd9af4f5919c28576a3cc325fb6b54e42f7047dacce3c718c17b" dependencies = [ "cfg-if", - "proc-macro2 1.0.12", - "quote 1.0.4", - "syn 1.0.19", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", +] + +[[package]] +name = "ndk" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a356cafe20aee088789830bfea3a61336e84ded9e545e00d3869ce95dcb80c" +dependencies = [ + "jni-sys", + "ndk-sys", + "num_enum", +] + +[[package]] +name = "ndk-glue" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1730ee2e3de41c3321160a6da815f008c4006d71b095880ea50e17cf52332b8" +dependencies = [ + "android_log-sys", + "lazy_static", + "libc", + "log", + "ndk", + "ndk-sys", ] +[[package]] +name = "ndk-sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2820aca934aba5ed91c79acc72b6a44048ceacc5d36c035ed4e051f12d887d" + [[package]] name = "neovide" version = "0.6.0" @@ -1313,12 +1380,13 @@ dependencies = [ "rmpv", "rust-embed", "sdl2-sys", + "skia-safe", "skribo", "skulpin", "tokio", "unicode-segmentation", - "which 4.0.0", - "winapi 0.3.8", + "which 4.0.2", + "winapi 0.3.9", "winres", ] @@ -1330,7 +1398,7 @@ checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1348,9 +1416,9 @@ dependencies = [ [[package]] name = "nom" -version = "5.1.1" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" dependencies = [ "memchr", "version_check", @@ -1375,21 +1443,21 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" +checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00" +checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-integer", "num-traits", ] @@ -1400,18 +1468,18 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-integer", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" +checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", ] [[package]] @@ -1424,13 +1492,35 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", +] + [[package]] name = "nvim-rs" version = "0.1.1-alpha.0" -source = "git+https://github.com/kethku/nvim-rs#3abe58a50eaaccccc15bef7260f89020e280b382" +source = "git+https://github.com/kethku/nvim-rs#109feea9e345fcbb2674384b0d6914ba4b8fc61e" dependencies = [ "async-trait", - "futures 0.3.4", + "futures 0.3.5", "log", "pin-project", "rmp", @@ -1457,6 +1547,12 @@ dependencies = [ "cc", ] +[[package]] +name = "once_cell" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" + [[package]] name = "openssl-probe" version = "0.1.2" @@ -1465,11 +1561,11 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-sys" -version = "0.9.55" +version = "0.9.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" +checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "cc", "libc", "pkg-config", @@ -1478,9 +1574,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" +checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579" dependencies = [ "num-traits", ] @@ -1506,7 +1602,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1542,29 +1638,29 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "0.4.13" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c3bfbfb5bb42f99498c7234bbd768c220eb0cea6818259d0d18a1aa3d2595d" +checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.13" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccbf6449dcfb18562c015526b085b8df1aa3cdab180af8ec2ebd300a3bd28f63" +checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" dependencies = [ - "proc-macro2 1.0.12", - "quote 1.0.4", - "syn 1.0.19", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", ] [[package]] name = "pin-project-lite" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" [[package]] name = "pin-utils" @@ -1574,9 +1670,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" [[package]] name = "png" @@ -1592,15 +1688,15 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" [[package]] name = "predicates" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "347a1b6f0b21e636bc9872fb60b83b8e185f6f5516298b8238699f7f9a531030" +checksum = "96bfead12e90dccead362d62bb2c90a5f6fc4584963645bc7f71a735e0b0735a" dependencies = [ "difference", "float-cmp", @@ -1625,17 +1721,26 @@ dependencies = [ "treeline", ] +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + [[package]] name = "proc-macro-hack" -version = "0.5.15" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" +checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" [[package]] name = "proc-macro-nested" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" @@ -1648,11 +1753,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.12" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319" +checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" dependencies = [ - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] @@ -1672,11 +1777,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.4" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c1f4b0efa5fc5e8ceb705136bfee52cfdb6a4e3509f770b478cd6ed434232a7" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.12", + "proc-macro2 1.0.19", ] [[package]] @@ -1731,10 +1836,11 @@ dependencies = [ [[package]] name = "rayon" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" +checksum = "cfd016f0c045ad38b5251be2c9c0ab806917f82da4d36b2a327e5166adad9270" dependencies = [ + "autocfg 1.0.1", "crossbeam-deque", "either", "rayon-core", @@ -1742,12 +1848,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" +checksum = "91739a34c4355b5434ce54c9086c5895604a9c278586d1f1aa95e04f66b525a0" dependencies = [ + "crossbeam-channel", "crossbeam-deque", - "crossbeam-queue", "crossbeam-utils", "lazy_static", "num_cpus", @@ -1755,9 +1861,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_users" @@ -1772,9 +1878,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.7" +version = "1.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" dependencies = [ "aho-corasick", "memchr", @@ -1784,9 +1890,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" [[package]] name = "rmp" @@ -1800,9 +1906,9 @@ dependencies = [ [[package]] name = "rmpv" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e5078dd8691b0811b14fbd2d78358f7fc68e83b98ba6f16488bf77694e9fe2" +checksum = "ee358f3c4be83ab373cd3e501dc04881034f1ae198e73b2d9edd617653ac4293" dependencies = [ "num-traits", "rmp", @@ -1822,9 +1928,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "5.5.1" +version = "5.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a17890cbd0fae97c2006fa1ecec9554946443c319f4dd8cd8d3b92031725161" +checksum = "213acf1bc5a6dfcd70b62db1e9a7d06325c0e73439c312fcb8599d456d9686ee" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -1833,13 +1939,13 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "5.5.1" +version = "5.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60cacc306d294556771c6e92737ba7e6be0264144bc46dd713a14ef384b0d6b8" +checksum = "7903c2cf599db8f310b392332f38367ca4acc84420fa1aee3536299f433c10d5" dependencies = [ - "quote 1.0.4", + "quote 1.0.7", "rust-embed-utils", - "syn 1.0.19", + "syn 1.0.39", "walkdir", ] @@ -1889,9 +1995,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "same-file" @@ -1904,12 +2010,12 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1926,9 +2032,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sdl2" -version = "0.34.0" +version = "0.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6693f362118c0cd32858fe33a14d74cc3111bbc3a7de1aee88e5289fd9289f97" +checksum = "fcbb85f4211627a7291c83434d6bbfa723e28dcaa53c7606087e3c61929e4b9c" dependencies = [ "bitflags", "lazy_static", @@ -1938,9 +2044,9 @@ dependencies = [ [[package]] name = "sdl2-sys" -version = "0.34.0" +version = "0.34.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575db20c45cce6565d4ece46509288ded53f5571dc89e4af165a562eb0eeec26" +checksum = "3ed17d6d46b62b7df12134513bcc4f071268963e8c9bc8bf7ad983fbfb2bc3cc" dependencies = [ "cfg-if", "cmake", @@ -1948,6 +2054,7 @@ dependencies = [ "libc", "tar", "unidiff", + "version-compare", ] [[package]] @@ -1967,15 +2074,15 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.106" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" +checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" [[package]] name = "serde_json" -version = "1.0.52" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7894c8ed05b7a3a279aeb79025fdec1d3158080b75b98a08faf2806bb799edd" +checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" dependencies = [ "itoa", "ryu", @@ -2021,9 +2128,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signal-hook-registry" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" dependencies = [ "arc-swap", "libc", @@ -2031,9 +2138,9 @@ dependencies = [ [[package]] name = "skia-bindings" -version = "0.27.3" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa4cc006be07441ba7129e9ac39c750af5d5120759e95a3ba121d9c6ca94c0e" +checksum = "ad6f9d1f255ac966c531823efb71a0ad45f37325428ad3e4f363f676737184d8" dependencies = [ "bindgen", "cc", @@ -2048,9 +2155,9 @@ dependencies = [ [[package]] name = "skia-safe" -version = "0.27.3" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59cfb4ded0c38514114de4b0835e9aea335382f0e318a365be62af40dd904faa" +checksum = "bea0f1e6e251bb1d895d99c4d32460adc206f9fb30f1a0b27c5edf4de4908946" dependencies = [ "bitflags", "lazy_static", @@ -2072,8 +2179,8 @@ dependencies = [ [[package]] name = "skulpin" -version = "0.9.4" -source = "git+https://github.com/aclysma/skulpin#6139a1f158080b5007b81c60110162bbd4a9d3a9" +version = "0.9.5" +source = "git+https://github.com/aclysma/skulpin#f9b56db5632f10679317c3ec4e04d6985d6a63a6" dependencies = [ "log", "skulpin-app-winit", @@ -2085,7 +2192,7 @@ dependencies = [ [[package]] name = "skulpin-app-winit" version = "0.3.0" -source = "git+https://github.com/aclysma/skulpin#6139a1f158080b5007b81c60110162bbd4a9d3a9" +source = "git+https://github.com/aclysma/skulpin#f9b56db5632f10679317c3ec4e04d6985d6a63a6" dependencies = [ "log", "skulpin-renderer", @@ -2095,7 +2202,7 @@ dependencies = [ [[package]] name = "skulpin-renderer" version = "0.3.1" -source = "git+https://github.com/aclysma/skulpin#6139a1f158080b5007b81c60110162bbd4a9d3a9" +source = "git+https://github.com/aclysma/skulpin#f9b56db5632f10679317c3ec4e04d6985d6a63a6" dependencies = [ "ash", "log", @@ -2106,7 +2213,7 @@ dependencies = [ [[package]] name = "skulpin-renderer-sdl2" version = "0.3.3" -source = "git+https://github.com/aclysma/skulpin#6139a1f158080b5007b81c60110162bbd4a9d3a9" +source = "git+https://github.com/aclysma/skulpin#f9b56db5632f10679317c3ec4e04d6985d6a63a6" dependencies = [ "log", "sdl2", @@ -2116,7 +2223,7 @@ dependencies = [ [[package]] name = "skulpin-renderer-winit" version = "0.3.1" -source = "git+https://github.com/aclysma/skulpin#6139a1f158080b5007b81c60110162bbd4a9d3a9" +source = "git+https://github.com/aclysma/skulpin#f9b56db5632f10679317c3ec4e04d6985d6a63a6" dependencies = [ "cocoa", "log", @@ -2124,7 +2231,7 @@ dependencies = [ "objc", "raw-window-handle", "skulpin-renderer", - "winapi 0.3.8", + "winapi 0.3.9", "winit", ] @@ -2136,9 +2243,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "smithay-client-toolkit" @@ -2165,7 +2272,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2196,20 +2303,20 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.19" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e5aa70697bb26ee62214ae3288465ecec0000f05182f039b477001f08f5ae7" +checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9" dependencies = [ - "proc-macro2 1.0.12", - "quote 1.0.4", - "unicode-xid 0.2.0", + "proc-macro2 1.0.19", + "quote 1.0.7", + "unicode-xid 0.2.1", ] [[package]] name = "tar" -version = "0.4.26" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" +checksum = "c8a4c1d0bee3230179544336c15eefb563cf0302955d962e456542323e8c2e8a" dependencies = [ "filetime", "libc", @@ -2237,22 +2344,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" +checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" +checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ - "proc-macro2 1.0.12", - "quote 1.0.4", - "syn 1.0.19", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", ] [[package]] @@ -2283,16 +2390,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] +[[package]] +name = "tinyvec" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" + [[package]] name = "tokio" -version = "0.2.20" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c1d570eb1a36f0345a5ce9c6c6e665b70b73d11236912c0b477616aeec47b1" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ - "bytes 0.5.4", + "bytes 0.5.6", "fnv", "iovec", "lazy_static", @@ -2306,7 +2419,7 @@ dependencies = [ "signal-hook-registry", "slab", "tokio-macros", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2326,9 +2439,9 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ - "proc-macro2 1.0.12", - "quote 1.0.4", - "syn 1.0.19", + "proc-macro2 1.0.19", + "quote 1.0.7", + "syn 1.0.39", ] [[package]] @@ -2348,11 +2461,11 @@ checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" [[package]] name = "unicode-normalization" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" dependencies = [ - "smallvec", + "tinyvec", ] [[package]] @@ -2363,9 +2476,9 @@ checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" [[package]] name = "unicode-width" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" @@ -2375,15 +2488,15 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unidiff" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c152966fd1e11a44da1063caf6ca3c615cf5760603223015441df29a9653ae9" +checksum = "d8a62719acf1933bfdbeb73a657ecd9ecece70b405125267dd549e2e2edc232c" dependencies = [ "encoding_rs", "lazy_static", @@ -2392,9 +2505,9 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" +checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" [[package]] name = "vec_map" @@ -2402,11 +2515,17 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version-compare" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" + [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "void" @@ -2421,7 +2540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ "same-file", - "winapi 0.3.8", + "winapi 0.3.9", "winapi-util", ] @@ -2502,9 +2621,9 @@ dependencies = [ [[package]] name = "which" -version = "4.0.0" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd3edc3cf5458851a4d6a2329232bd5f42c7f9bbe4c4782c4ef9ce37e5d101b2" +checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" dependencies = [ "libc", "thiserror", @@ -2518,9 +2637,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", @@ -2544,7 +2663,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2555,15 +2674,14 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winit" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc53342d3d1a3d57f3949e0692d93d5a8adb7814d8683cef4a09c2b550e94246" +checksum = "1e4ccbf7ddb6627828eace16cacde80fc6bf4dbb3469f88487262a02cf8e7862" dependencies = [ - "android_glue", "bitflags", "cocoa", - "core-foundation 0.6.4", - "core-graphics 0.17.3", + "core-foundation 0.7.0", + "core-graphics 0.19.2", "core-video-sys", "dispatch", "instant", @@ -2572,13 +2690,16 @@ dependencies = [ "log", "mio", "mio-extras", + "ndk", + "ndk-glue", + "ndk-sys", "objc", "parking_lot", "percent-encoding", "raw-window-handle", "smithay-client-toolkit", "wayland-client", - "winapi 0.3.8", + "winapi 0.3.9", "x11-dl", ] @@ -2597,7 +2718,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 82b6233..b1edef7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,7 @@ cfg-if = "0.1.10" which = "4" dirs = "2" rand = "0.7" +skia-safe = "0.32.1" [dev-dependencies] mockall = "0.7.0" diff --git a/src/bridge/mod.rs b/src/bridge/mod.rs index cbeae83..9cbfed3 100644 --- a/src/bridge/mod.rs +++ b/src/bridge/mod.rs @@ -160,6 +160,7 @@ async fn start_process(mut receiver: UnboundedReceiver) { .unwrap_or_explained_panic("Could not communicate with neovim process"); let mut options = UiAttachOptions::new(); options.set_linegrid_external(true); + options.set_multigrid_external(true); options.set_rgb(true); if let Err(command_error) = nvim.command("runtime! ginit.vim").await { nvim.command(&format!( diff --git a/src/editor/cursor.rs b/src/editor/cursor.rs index ac39865..d97067c 100644 --- a/src/editor/cursor.rs +++ b/src/editor/cursor.rs @@ -43,6 +43,8 @@ pub struct Cursor { pub blinkoff: Option, pub style: Option>, pub enabled: bool, + pub double_width: bool, + pub character: String } impl Cursor { @@ -56,6 +58,8 @@ impl Cursor { blinkon: None, blinkoff: None, enabled: true, + double_width: false, + character: " ".to_string() } } diff --git a/src/editor/mod.rs b/src/editor/mod.rs index b02580c..21561e8 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -1,18 +1,18 @@ mod cursor; mod grid; mod style; +mod window; -use std::collections::HashMap; +use std::collections::{HashSet, HashMap}; use std::sync::Arc; -use log::trace; +use log::{trace, error}; use parking_lot::Mutex; use skulpin::skia_safe::colors; -use unicode_segmentation::UnicodeSegmentation; -use crate::bridge::{EditorMode, GridLineCell, GuiOption, RedrawEvent}; +use crate::bridge::{EditorMode, GuiOption, RedrawEvent, WindowAnchor}; use crate::redraw_scheduler::REDRAW_SCHEDULER; -use crate::window::window_geometry_or_default; +pub use window::*; pub use cursor::{Cursor, CursorMode, CursorShape}; pub use grid::CharacterGrid; pub use style::{Colors, Style}; @@ -21,17 +21,25 @@ lazy_static! { pub static ref EDITOR: Arc> = Arc::new(Mutex::new(Editor::new())); } -#[derive(new, Debug, Clone)] -pub struct DrawCommand { - pub text: String, - pub cell_width: u64, +pub struct RenderInfo { + windows: Vec, + closed_window_ids: Vec, +} + +pub struct WindowRenderInfo { + pub grid_id: u64, pub grid_position: (u64, u64), - pub style: Option>, + pub width: u64, + pub height: u64, + pub should_clear: bool, + pub draw_commands: Vec, + pub child_windows: Vec } pub struct Editor { - pub grid: CharacterGrid, pub title: String, + pub windows: HashMap, + pub closed_window_ids: HashSet, pub mouse_enabled: bool, pub guifont: Option, pub cursor: Cursor, @@ -45,8 +53,9 @@ pub struct Editor { impl Editor { pub fn new() -> Editor { Editor { - grid: CharacterGrid::new(window_geometry_or_default()), title: "Neovide".to_string(), + windows: HashMap::new(), + closed_window_ids: HashSet::new(), mouse_enabled: true, guifont: None, cursor: Cursor::new(), @@ -91,218 +100,180 @@ impl Editor { trace!("Image flushed"); REDRAW_SCHEDULER.queue_next_frame(); } - RedrawEvent::Resize { width, height, .. } => self.grid.resize(width, height), RedrawEvent::DefaultColorsSet { colors } => { self.default_style = Arc::new(Style::new(colors)) } RedrawEvent::HighlightAttributesDefine { id, style } => { self.defined_styles.insert(id, Arc::new(style)); } + RedrawEvent::CursorGoto { grid, row, column } => self.set_cursor_position(grid, row, column), + RedrawEvent::Resize { grid, width, height } => { + self.windows.get_mut(&grid).map(|window| window.resize(width, height)); + }, RedrawEvent::GridLine { + grid, row, column_start, - cells, - .. - } => self.draw_grid_line(row, column_start, cells), - RedrawEvent::Clear { .. } => self.grid.clear(), - RedrawEvent::CursorGoto { row, column, .. } => self.cursor.position = (row, column), + cells + } => { + self.windows.get_mut(&grid).map(|window| window.draw_grid_line(row, column_start, cells, &self.defined_styles, &mut self.previous_style)); + }, + RedrawEvent::Clear { grid } => { + self.windows.get_mut(&grid).map(|window| window.grid.clear()); + }, RedrawEvent::Scroll { + grid, top, bottom, left, right, rows, - columns, - .. - } => self.scroll_region(top, bottom, left, right, rows, columns), + columns + } => { + self.windows.get_mut(&grid).map(|window| window.scroll_region(top, bottom, left, right, rows, columns)); + }, + RedrawEvent::WindowPosition { grid, window, start_row, start_column, width, height } => self.set_window_position(grid, window, start_row, start_column, width, height), + RedrawEvent::WindowFloatPosition { grid, window, anchor, anchor_grid, anchor_row, anchor_column, .. } => self.set_window_float_position(grid, window, anchor_grid, anchor, anchor_row, anchor_column), + RedrawEvent::WindowHide { grid } => { + self.windows.get_mut(&grid).map(|window| window.hidden = true); + }, + RedrawEvent::WindowClose { grid } => self.close_window(grid), _ => {} }; } - pub fn build_draw_commands(&mut self) -> (Vec, bool) { - let mut draw_commands = Vec::new(); - - for (row_index, row) in self.grid.rows().enumerate() { - let mut command = None; - - fn add_command(commands_list: &mut Vec, command: Option) { - if let Some(command) = command { - commands_list.push(command); - } - } + fn close_window(&mut self, grid: u64) { + self.windows.remove(&grid); + self.closed_window_ids.insert(grid); + } - fn command_matches(command: &Option, style: &Option>) -> bool { - match command { - Some(command) => &command.style == style, - None => true, - } + fn set_window_position(&mut self, grid: u64, window_id: u64, start_row: u64, start_column: u64, width: u64, height: u64) { + match self.windows.get_mut(&grid) { + Some(window) => { + window.hidden = false; + window.anchor_grid_id = None; + window.anchor_type = WindowAnchor::NorthWest; + window.anchor_row = start_row; + window.anchor_column = start_column; + window.resize(width, height); + }, + None => { + let new_window = Window::new(window_id, grid, width, height, None, WindowAnchor::NorthWest, start_row, start_column); + self.windows.insert(grid, new_window); } + } + } - fn add_character( - command: &mut Option, - character: &str, - row_index: u64, - col_index: u64, - style: Option>, - ) { - match command { - Some(command) => { - command.text.push_str(character); - command.cell_width += 1; - } - None => { - command.replace(DrawCommand::new( - character.to_string(), - 1, - (col_index, row_index), - style, - )); - } - } - } + fn set_window_float_position(&mut self, grid: u64, window_id: u64, anchor_grid: u64, anchor_type: WindowAnchor, anchor_row: u64, anchor_column: u64) { + if let Some(window) = self.windows.get_mut(&grid) { + window.hidden = false; + window.anchor_grid_id = Some(anchor_grid); + window.anchor_type = anchor_type; + window.anchor_row = anchor_row; + window.anchor_column = anchor_column; + } else { + error!("Attempted to float window that does not exist."); + } - for (col_index, cell) in row.iter().enumerate() { - if let Some((character, style)) = cell { - if character.is_empty() { - add_character( - &mut command, - &" ", - row_index as u64, - col_index as u64, - style.clone(), - ); - add_command(&mut draw_commands, command); - command = None; - } else { - if !command_matches(&command, &style) { - add_command(&mut draw_commands, command); - command = None; - } - add_character( - &mut command, - &character, - row_index as u64, - col_index as u64, - style.clone(), - ); - } - } else { - if !command_matches(&command, &None) { - add_command(&mut draw_commands, command); - command = None; - } - add_character(&mut command, " ", row_index as u64, col_index as u64, None); - } - } - add_command(&mut draw_commands, command); + if let Some(anchor_window) = self.windows.get_mut(&anchor_grid) { + anchor_window.children.insert(grid); } + } - let should_clear = self.grid.should_clear; - let draw_commands = draw_commands - .into_iter() - .filter(|command| { - let (x, y) = command.grid_position; - let min = (x as i64 - 1).max(0) as u64; - let max = (x + command.cell_width + 1).min(self.grid.width); + fn get_window_top_left(&self, grid: u64) -> Option<(u64, u64)> { + let window = self.windows.get(&grid)?; - for char_index in min..max { - if self.grid.is_dirty_cell(char_index, y) { - return true; - } + match window.anchor_grid_id { + Some(anchor_grid) => { + let (parent_anchor_row, parent_anchor_column) = self.get_window_top_left(anchor_grid)?; + match window.anchor_type { + WindowAnchor::NorthWest => { + Some((parent_anchor_row + window.anchor_row, parent_anchor_column + window.anchor_column)) + }, + WindowAnchor::NorthEast => { + Some((parent_anchor_row + window.anchor_row, parent_anchor_column + window.anchor_column - window.grid.width)) + }, + WindowAnchor::SouthWest => { + Some((parent_anchor_row + window.anchor_row - window.grid.height, parent_anchor_column + window.anchor_column)) + }, + WindowAnchor::SouthEast => { + Some((parent_anchor_row + window.anchor_row - window.grid.height, parent_anchor_column + window.anchor_column - window.grid.width)) + }, } - false - }) - .collect::>(); - - self.grid.set_dirty_all(false); - self.grid.should_clear = false; - - trace!("Draw commands sent"); - (draw_commands, should_clear) + }, + None => Some((window.anchor_row, window.anchor_column)) + } } - fn draw_grid_line_cell(&mut self, row_index: u64, column_pos: &mut u64, cell: GridLineCell) { - let style = match cell.highlight_id { - Some(0) => None, - Some(style_id) => self.defined_styles.get(&style_id).cloned(), - None => self.previous_style.clone(), - }; - - let mut text = cell.text; - - if let Some(times) = cell.repeat { - text = text.repeat(times as usize); - } + fn set_cursor_position(&self, grid: u64, row: u64, column: u64) { + match self.get_window_top_left(grid) { + Some((window_row, window_column)) => { + self.cursor.position = (window_row + row, window_column + column); - if text.is_empty() { - if let Some(cell) = self.grid.get_cell_mut(*column_pos, row_index) { - *cell = Some(("".to_string(), style.clone())); - } + if let Some(window) = self.windows.get(&grid) { + self.cursor.character = match window.grid.get_cell(column, row) { + Some(Some((character, _))) => character.clone(), + _ => ' '.to_string(), + }; - self.grid.set_dirty_cell(*column_pos, row_index); - *column_pos += 1; - } else { - for (i, character) in text.graphemes(true).enumerate() { - if let Some(cell) = self.grid.get_cell_mut(i as u64 + *column_pos, row_index) { - *cell = Some((character.to_string(), style.clone())); - self.grid.set_dirty_cell(*column_pos, row_index); + self.cursor.double_width = match window.grid.get_cell(column + 1, row) { + Some(Some((character, _))) => character.is_empty(), + _ => false, + }; } + }, + None => { + self.cursor.position = (row, column); + self.cursor.double_width = false; + self.cursor.character = " ".to_string(); } - *column_pos += text.graphemes(true).count() as u64; } - - self.previous_style = style; } - fn draw_grid_line(&mut self, row: u64, column_start: u64, cells: Vec) { - if row < self.grid.height { - let mut column_pos = column_start; - for cell in cells { - self.draw_grid_line_cell(row, &mut column_pos, cell); - } - } else { - println!("Draw command out of bounds"); + fn set_option(&mut self, gui_option: GuiOption) { + trace!("Option set {:?}", &gui_option); + if let GuiOption::GuiFont(guifont) = gui_option { + self.guifont = Some(guifont); } } - fn scroll_region(&mut self, top: u64, bot: u64, left: u64, right: u64, rows: i64, cols: i64) { - let y_iter: Box> = if rows > 0 { - Box::new((top as i64 + rows)..bot as i64) - } else { - Box::new((top as i64..(bot as i64 + rows)).rev()) + fn build_window_render_info(&mut self, grid: u64) -> Option { + let grid_position = self.get_window_top_left(grid)?; + let (draw_commands, should_clear) = { + let mut window = self.windows.get_mut(&grid)?; + window.build_draw_commands() }; - for y in y_iter { - let dest_y = y - rows; - if dest_y >= 0 && dest_y < self.grid.height as i64 { - let x_iter: Box> = if cols > 0 { - Box::new((left as i64 + cols)..right as i64) - } else { - Box::new((left as i64..(right as i64 + cols)).rev()) - }; + let window = self.windows.get(&grid)?; + let child_windows = window.children.iter().filter_map(|child_id| self.build_window_render_info(*child_id)).collect(); - for x in x_iter { - let dest_x = x - cols; - let cell_data = self.grid.get_cell(x as u64, y as u64).cloned(); + Some(WindowRenderInfo { + grid_id: grid, + grid_position, + width: window.grid.width, + height: window.grid.height, + should_clear, + draw_commands, + child_windows + }) + } - if let Some(cell_data) = cell_data { - if let Some(dest_cell) = - self.grid.get_cell_mut(dest_x as u64, dest_y as u64) - { - *dest_cell = cell_data; - self.grid.set_dirty_cell(dest_x as u64, dest_y as u64); - } - } + pub fn build_render_info(&mut self) -> RenderInfo { + let mut windows = Vec::new(); + + for window in self.windows.values() { + if !window.hidden && window.anchor_grid_id.is_none() { + if let Some(window_render_info) = self.build_window_render_info(window.grid_id) { + windows.push(window_render_info); } } } - trace!("Region scrolled"); - } - fn set_option(&mut self, gui_option: GuiOption) { - trace!("Option set {:?}", &gui_option); - if let GuiOption::GuiFont(guifont) = gui_option { - self.guifont = Some(guifont); + let closed_window_ids = self.closed_window_ids.iter().copied().collect(); + self.closed_window_ids.clear(); + + RenderInfo { + windows, closed_window_ids } } } diff --git a/src/editor/window.rs b/src/editor/window.rs new file mode 100644 index 0000000..1697c72 --- /dev/null +++ b/src/editor/window.rs @@ -0,0 +1,224 @@ +use std::collections::{HashSet, HashMap}; +use std::sync::Arc; + +use log::trace; +use unicode_segmentation::UnicodeSegmentation; + +use crate::bridge::{GridLineCell, WindowAnchor}; +use super::grid::CharacterGrid; +use super::style::Style; + +#[derive(new, Debug, Clone)] +pub struct DrawCommand { + pub text: String, + pub cell_width: u64, + pub grid_position: (u64, u64), + pub style: Option>, +} + +pub struct Window { + pub id: u64, + pub grid_id: u64, + pub grid: CharacterGrid, + pub hidden: bool, + pub anchor_grid_id: Option, + pub anchor_type: WindowAnchor, + pub anchor_row: u64, + pub anchor_column: u64, + pub children: HashSet, +} + +impl Window { + pub fn new(id: u64, grid_id: u64, width: u64, height: u64, anchor_grid_id: Option, anchor_type: WindowAnchor, anchor_row: u64, anchor_column: u64) -> Window { + Window { + id, grid_id, anchor_grid_id, anchor_type, anchor_row, anchor_column, + grid: CharacterGrid::new((width, height)), + hidden: false, + children: HashSet::new() + } + } + + pub fn resize(&mut self, width: u64, height: u64) { + self.grid.resize(width, height); + } + + fn draw_grid_line_cell(&mut self, row_index: u64, column_pos: &mut u64, cell: GridLineCell, defined_styles: &HashMap>, previous_style: &mut Option>) { + let style = match cell.highlight_id { + Some(0) => None, + Some(style_id) => defined_styles.get(&style_id).cloned(), + None => previous_style.clone(), + }; + + let mut text = cell.text; + + if let Some(times) = cell.repeat { + text = text.repeat(times as usize); + } + + if text.is_empty() { + if let Some(cell) = self.grid.get_cell_mut(*column_pos, row_index) { + *cell = Some(("".to_string(), style.clone())); + } + + self.grid.set_dirty_cell(*column_pos, row_index); + *column_pos += 1; + } else { + for (i, character) in text.graphemes(true).enumerate() { + if let Some(cell) = self.grid.get_cell_mut(i as u64 + *column_pos, row_index) { + *cell = Some((character.to_string(), style.clone())); + self.grid.set_dirty_cell(*column_pos, row_index); + } + } + *column_pos += text.graphemes(true).count() as u64; + } + + *previous_style = style; + } + + pub fn draw_grid_line(&mut self, row: u64, column_start: u64, cells: Vec, defined_styles: &HashMap>, previous_style: &mut Option>) { + if row < self.grid.height { + let mut column_pos = column_start; + for cell in cells { + self.draw_grid_line_cell(row, &mut column_pos, cell, defined_styles, previous_style); + } + } else { + println!("Draw command out of bounds"); + } + } + + pub fn scroll_region(&mut self, top: u64, bot: u64, left: u64, right: u64, rows: i64, cols: i64) { + let y_iter: Box> = if rows > 0 { + Box::new((top as i64 + rows)..bot as i64) + } else { + Box::new((top as i64..(bot as i64 + rows)).rev()) + }; + + for y in y_iter { + let dest_y = y - rows; + if dest_y >= 0 && dest_y < self.grid.height as i64 { + let x_iter: Box> = if cols > 0 { + Box::new((left as i64 + cols)..right as i64) + } else { + Box::new((left as i64..(right as i64 + cols)).rev()) + }; + + for x in x_iter { + let dest_x = x - cols; + let cell_data = self.grid.get_cell(x as u64, y as u64).cloned(); + + if let Some(cell_data) = cell_data { + if let Some(dest_cell) = + self.grid.get_cell_mut(dest_x as u64, dest_y as u64) + { + *dest_cell = cell_data; + self.grid.set_dirty_cell(dest_x as u64, dest_y as u64); + } + } + } + } + } + trace!("Region scrolled"); + } + + pub fn build_draw_commands(&mut self) -> (Vec, bool) { + let mut draw_commands = Vec::new(); + + for (row_index, row) in self.grid.rows().enumerate() { + let mut command = None; + + fn add_command(commands_list: &mut Vec, command: Option) { + if let Some(command) = command { + commands_list.push(command); + } + } + + fn command_matches(command: &Option, style: &Option>) -> bool { + match command { + Some(command) => &command.style == style, + None => true, + } + } + + fn add_character( + command: &mut Option, + character: &str, + row_index: u64, + col_index: u64, + style: Option>, + ) { + match command { + Some(command) => { + command.text.push_str(character); + command.cell_width += 1; + } + None => { + command.replace(DrawCommand::new( + character.to_string(), + 1, + (col_index, row_index), + style, + )); + } + } + } + + for (col_index, cell) in row.iter().enumerate() { + if let Some((character, style)) = cell { + if character.is_empty() { + add_character( + &mut command, + &" ", + row_index as u64, + col_index as u64, + style.clone(), + ); + add_command(&mut draw_commands, command); + command = None; + } else { + if !command_matches(&command, &style) { + add_command(&mut draw_commands, command); + command = None; + } + add_character( + &mut command, + &character, + row_index as u64, + col_index as u64, + style.clone(), + ); + } + } else { + if !command_matches(&command, &None) { + add_command(&mut draw_commands, command); + command = None; + } + add_character(&mut command, " ", row_index as u64, col_index as u64, None); + } + } + add_command(&mut draw_commands, command); + } + + let should_clear = self.grid.should_clear; + let draw_commands = draw_commands + .into_iter() + .filter(|command| { + let (x, y) = command.grid_position; + let min = (x as i64 - 1).max(0) as u64; + let max = (x + command.cell_width + 1).min(self.grid.width); + + for char_index in min..max { + if self.grid.is_dirty_cell(char_index, y) { + return true; + } + } + false + }) + .collect::>(); + + self.grid.set_dirty_all(false); + self.grid.should_clear = false; + + trace!("Draw commands sent"); + (draw_commands, should_clear) + } +} diff --git a/src/renderer/cursor_renderer/mod.rs b/src/renderer/cursor_renderer/mod.rs index af49a6c..ae23518 100644 --- a/src/renderer/cursor_renderer/mod.rs +++ b/src/renderer/cursor_renderer/mod.rs @@ -276,26 +276,18 @@ impl CursorRenderer { }; let (grid_x, grid_y) = self.previous_position; - let (character, font_dimensions, in_insert_mode): (String, Point, bool) = { - let editor = EDITOR.lock(); - let character = match editor.grid.get_cell(grid_x, grid_y) { - Some(Some((character, _))) => character.clone(), - _ => ' '.to_string(), - }; - - let is_double = match editor.grid.get_cell(grid_x + 1, grid_y) { - Some(Some((character, _))) => character.is_empty(), - _ => false, - }; + let character = cursor.text; - let font_width = match (is_double, &cursor.shape) { - (true, CursorShape::Block) => font_width * 2.0, - _ => font_width, - }; + let font_width = match (cursor.double_width, &cursor.shape) { + (true, CursorShape::Block) => font_width * 2.0, + _ => font_width + }; - let in_insert_mode = matches!(editor.current_mode, EditorMode::Insert); + let font_dimensions: Point = (font_width, font_height).into(); - (character, (font_width, font_height).into(), in_insert_mode) + let in_insert_mode = { + let editor = EDITOR.lock(); + matches!(editor.current_mode, EditorMode::Insert); }; let destination: Point = (grid_x as f32 * font_width, grid_y as f32 * font_height).into(); diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 0f490b3..1b2c911 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -1,8 +1,9 @@ +use std::collections::HashMap; use std::sync::Arc; use log::trace; use skulpin::skia_safe::gpu::SurfaceOrigin; -use skulpin::skia_safe::{colors, dash_path_effect, Budgeted, Canvas, Paint, Rect, Surface}; +use skulpin::skia_safe::{colors, dash_path_effect, Budgeted, Canvas, Paint, Rect, Surface, ImageInfo}; use skulpin::CoordinateSystemHelper; mod caching_shaper; @@ -16,7 +17,7 @@ use crate::editor::{Style, EDITOR}; use cursor_renderer::CursorRenderer; pub struct Renderer { - surface: Option, + window_surfaces: HashMap, paint: Paint, shaper: CachingShaper, @@ -27,7 +28,6 @@ pub struct Renderer { impl Renderer { pub fn new() -> Renderer { - let surface = None; let mut paint = Paint::new(colors::WHITE, None); paint.set_anti_alias(false); @@ -37,7 +37,7 @@ impl Renderer { let cursor_renderer = CursorRenderer::new(); Renderer { - surface, + window_surfaces: HashMap::new(), paint, shaper, font_width, @@ -149,56 +149,47 @@ impl Renderer { canvas.restore(); } - pub fn draw( - &mut self, - gpu_canvas: &mut Canvas, - coordinate_system_helper: &CoordinateSystemHelper, - dt: f32, - ) -> bool { - trace!("Rendering"); + pub fn build_window_surface(&self, gpu_canvas: &mut Canvas, default_style: &Arc