From 90428255d92f4671197d3d34f9fa33116a4557da Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 15 Jul 2022 10:36:37 -0700 Subject: [PATCH] Added some simple tests for the new keybindings --- Cargo.lock | 957 +---------------------- crates/terminal/Cargo.toml | 1 - crates/terminal/src/connection/events.rs | 347 ++++---- 3 files changed, 205 insertions(+), 1100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02403aa49b..6c87bb055f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,41 +59,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alacritty" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f293c6549baebc7f1ad0d39006bf12b7b0225cfb38687d6bd431e840b1b9f19" -dependencies = [ - "alacritty_config_derive", - "alacritty_terminal", - "bitflags", - "cocoa", - "copypasta", - "crossfont", - "dirs 3.0.2", - "embed-resource", - "fnv", - "gl_generator", - "glutin", - "libc", - "log", - "notify", - "objc", - "parking_lot 0.11.2", - "png", - "raw-window-handle", - "serde", - "serde_json", - "serde_yaml", - "structopt", - "unicode-width", - "wayland-client", - "winapi 0.3.9", - "x11-dl", - "xdg", -] - [[package]] name = "alacritty_config_derive" version = "0.1.0" @@ -121,7 +86,7 @@ dependencies = [ "mio-anonymous-pipes", "mio-extras", "miow 0.3.7", - "nix 0.22.3", + "nix", "parking_lot 0.11.2", "regex-automata", "serde", @@ -139,12 +104,6 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8ad6edb4840b78c5c3d88de606b22252d552b55f3a4699fbb10fc070ec3049" -[[package]] -name = "android_glue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" - [[package]] name = "ansi_term" version = "0.12.1" @@ -721,16 +680,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" -[[package]] -name = "calloop" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf2eec61efe56aa1e813f5126959296933cf0700030e4314786c48779a66ab82" -dependencies = [ - "log", - "nix 0.22.3", -] - [[package]] name = "cap-fs-ext" version = "0.24.4" @@ -833,15 +782,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cgl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" -dependencies = [ - "libc", -] - [[package]] name = "chat_panel" version = "0.1.0" @@ -957,7 +897,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap 3.2.8", - "core-foundation 0.9.3", + "core-foundation", "core-services", "dirs 3.0.2", "ipc-channel", @@ -992,16 +932,6 @@ dependencies = [ "util", ] -[[package]] -name = "clipboard-win" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fdf5e01086b6be750428ba4a40619f847eb2e95756eee84b18e06e5f0b50342" -dependencies = [ - "lazy-bytes-cast", - "winapi 0.3.9", -] - [[package]] name = "clock" version = "0.1.0" @@ -1026,9 +956,9 @@ dependencies = [ "bitflags", "block", "cocoa-foundation", - "core-foundation 0.9.3", - "core-graphics 0.22.3", - "foreign-types 0.3.2", + "core-foundation", + "core-graphics", + "foreign-types", "libc", "objc", ] @@ -1040,9 +970,9 @@ source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2f dependencies = [ "bitflags", "block", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", - "foreign-types 0.3.2", + "foreign-types", "libc", "objc", ] @@ -1175,71 +1105,29 @@ dependencies = [ "theme", ] -[[package]] -name = "copypasta" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4423d79fed83ebd9ab81ec21fa97144300a961782158287dc9bf7eddac37ff0b" -dependencies = [ - "clipboard-win", - "objc", - "objc-foundation", - "objc_id", - "smithay-clipboard", - "x11-clipboard", -] - -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -dependencies = [ - "core-foundation-sys 0.7.0", - "libc", -] - [[package]] name = "core-foundation" version = "0.9.3" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" dependencies = [ - "core-foundation-sys 0.8.3", + "core-foundation-sys", "libc", ] -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - [[package]] name = "core-foundation-sys" version = "0.8.3" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" -[[package]] -name = "core-graphics" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" -dependencies = [ - "bitflags", - "core-foundation 0.7.0", - "foreign-types 0.3.2", - "libc", -] - [[package]] name = "core-graphics" version = "0.22.3" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" dependencies = [ "bitflags", - "core-foundation 0.9.3", + "core-foundation", "core-graphics-types", - "foreign-types 0.3.2", + "foreign-types", "libc", ] @@ -1249,8 +1137,8 @@ version = "0.1.1" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" dependencies = [ "bitflags", - "core-foundation 0.9.3", - "foreign-types 0.3.2", + "core-foundation", + "foreign-types", "libc", ] @@ -1260,7 +1148,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b344b958cae90858bf6086f49599ecc5ec8698eacad0ea155509ba11fab347" dependencies = [ - "core-foundation 0.9.3", + "core-foundation", ] [[package]] @@ -1269,25 +1157,12 @@ version = "19.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" dependencies = [ - "core-foundation 0.9.3", - "core-graphics 0.22.3", - "foreign-types 0.3.2", + "core-foundation", + "core-graphics", + "foreign-types", "libc", ] -[[package]] -name = "core-video-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" -dependencies = [ - "cfg-if 0.1.10", - "core-foundation-sys 0.7.0", - "core-graphics 0.19.2", - "libc", - "objc", -] - [[package]] name = "cpp_demangle" version = "0.3.5" @@ -1502,27 +1377,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "crossfont" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1299695a4c6417b7e4a6957bd963478406e148b7b0351e2f2ce31296b0518251" -dependencies = [ - "cocoa", - "core-foundation 0.9.3", - "core-foundation-sys 0.8.3", - "core-graphics 0.22.3", - "core-text", - "dwrote", - "foreign-types 0.5.0", - "freetype-rs", - "libc", - "log", - "pkg-config", - "servo-fontconfig", - "winapi 0.3.9", -] - [[package]] name = "crypto-common" version = "0.1.4" @@ -1553,12 +1407,6 @@ dependencies = [ "syn", ] -[[package]] -name = "cty" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" - [[package]] name = "curl" version = "0.4.43" @@ -1590,41 +1438,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "data-url" version = "0.1.1" @@ -1760,33 +1573,12 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dlib" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" -dependencies = [ - "libloading", -] - [[package]] name = "dotenv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - [[package]] name = "dwrote" version = "0.11.0" @@ -1795,8 +1587,6 @@ checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" dependencies = [ "lazy_static", "libc", - "serde", - "serde_derive", "winapi 0.3.9", "wio", ] @@ -1859,19 +1649,6 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" -[[package]] -name = "embed-resource" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc24ff8d764818e9ab17963b0593c535f077a513f565e75e4352d758bc4d8c0" -dependencies = [ - "cc", - "rustc_version 0.4.0", - "toml", - "vswhom", - "winreg", -] - [[package]] name = "encoding_rs" version = "0.8.31" @@ -2013,18 +1790,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "filetime" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "windows-sys", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -2066,8 +1831,8 @@ source = "git+https://github.com/zed-industries/font-kit?rev=8eaf7a918eafa28b0a3 dependencies = [ "bitflags", "byteorder", - "core-foundation 0.9.3", - "core-graphics 0.22.3", + "core-foundation", + "core-graphics", "core-text", "dirs-next", "dwrote", @@ -2090,7 +1855,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e58903f4f8d5b58c7d300908e4ebe5289c1bfdf5587964330f12023b8ff17fd1" dependencies = [ "log", - "memmap2 0.2.3", + "memmap2", "ttf-parser 0.12.3", ] @@ -2100,28 +1865,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "foreign-types-shared", ] [[package]] @@ -2130,12 +1874,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - [[package]] name = "form_urlencoded" version = "1.0.1" @@ -2156,17 +1894,6 @@ dependencies = [ "libc", ] -[[package]] -name = "freetype-rs" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" -dependencies = [ - "bitflags", - "freetype-sys", - "libc", -] - [[package]] name = "freetype-sys" version = "0.13.1" @@ -2189,35 +1916,16 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "fsevent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -dependencies = [ - "bitflags", - "fsevent-sys 2.0.1", -] - [[package]] name = "fsevent" version = "2.0.2" dependencies = [ "bitflags", - "fsevent-sys 3.1.0", + "fsevent-sys", "parking_lot 0.11.2", "tempdir", ] -[[package]] -name = "fsevent-sys" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -dependencies = [ - "libc", -] - [[package]] name = "fsevent-sys" version = "3.1.0" @@ -2434,17 +2142,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "gl_generator" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" -dependencies = [ - "khronos_api", - "log", - "xml-rs", -] - [[package]] name = "glob" version = "0.3.0" @@ -2464,78 +2161,6 @@ dependencies = [ "regex", ] -[[package]] -name = "glutin" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ea9dbe544bc8a657c4c4a798c2d16cd01b549820e47657297549d28371f6d2" -dependencies = [ - "android_glue", - "cgl", - "cocoa", - "core-foundation 0.9.3", - "glutin_egl_sys", - "glutin_emscripten_sys", - "glutin_gles2_sys", - "glutin_glx_sys", - "glutin_wgl_sys", - "lazy_static", - "libloading", - "log", - "objc", - "osmesa-sys", - "parking_lot 0.11.2", - "wayland-client", - "wayland-egl", - "winapi 0.3.9", - "winit", -] - -[[package]] -name = "glutin_egl_sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2abb6aa55523480c4adc5a56bbaa249992e2dddb2fc63dc96e04a3355364c211" -dependencies = [ - "gl_generator", - "winapi 0.3.9", -] - -[[package]] -name = "glutin_emscripten_sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1" - -[[package]] -name = "glutin_gles2_sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094e708b730a7c8a1954f4f8a31880af00eb8a1c5b5bf85d28a0a3c6d69103" -dependencies = [ - "gl_generator", - "objc", -] - -[[package]] -name = "glutin_glx_sys" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e393c8fc02b807459410429150e9c4faffdb312d59b8c038566173c81991351" -dependencies = [ - "gl_generator", - "x11-dl", -] - -[[package]] -name = "glutin_wgl_sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da5951a1569dbab865c6f2a863efafff193a93caf05538d193e9e3816d21696" -dependencies = [ - "gl_generator", -] - [[package]] name = "go_to_line" version = "0.1.0" @@ -2561,15 +2186,15 @@ dependencies = [ "cc", "cocoa", "collections", - "core-foundation 0.9.3", - "core-graphics 0.22.3", + "core-foundation", + "core-graphics", "core-text", "ctor", "dhat", "env_logger", "etagere", "font-kit", - "foreign-types 0.3.2", + "foreign-types", "futures", "gpui_macros", "image", @@ -2856,12 +2481,6 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.2.3" @@ -2927,26 +2546,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05a0bd019339e5d968b37855180087b7b9d512c5046fbd244cf8c95687927d6e" -[[package]] -name = "inotify" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" -dependencies = [ - "bitflags", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - [[package]] name = "instant" version = "0.1.12" @@ -2954,9 +2553,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -3076,12 +2672,6 @@ dependencies = [ "cc", ] -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - [[package]] name = "jobserver" version = "0.1.24" @@ -3138,12 +2728,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "khronos_api" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" - [[package]] name = "kurbo" version = "0.8.3" @@ -3193,12 +2777,6 @@ dependencies = [ "util", ] -[[package]] -name = "lazy-bytes-cast" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10257499f089cd156ad82d0a9cd57d9501fa2c989068992a97eb3c27836f206b" - [[package]] name = "lazy_static" version = "1.4.0" @@ -3449,24 +3027,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memmap2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357" -dependencies = [ - "libc", -] - -[[package]] -name = "memmap2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a79b39c93a7a5a27eeaf9a23b5ff43f1b9e0ad6b1cdd441140ae53c35613fc7" -dependencies = [ - "libc", -] - [[package]] name = "memoffset" version = "0.6.5" @@ -3492,7 +3052,7 @@ dependencies = [ "bitflags", "block", "cocoa-foundation", - "foreign-types 0.3.2", + "foreign-types", "log", "objc", ] @@ -3664,59 +3224,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ndk" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys", - "num_enum", - "thiserror", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-glue" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71bee8ea72d685477e28bd004cfe1bf99c754d688cd78cad139eae4089484d4" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ndk-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" - [[package]] name = "net2" version = "0.2.37" @@ -3741,17 +3248,6 @@ dependencies = [ "memoffset", ] -[[package]] -name = "nix" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nom" version = "7.1.1" @@ -3762,24 +3258,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "notify" -version = "4.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257" -dependencies = [ - "bitflags", - "filetime", - "fsevent 0.4.0", - "fsevent-sys 2.0.1", - "inotify", - "libc", - "mio 0.6.23", - "mio-extras", - "walkdir", - "winapi 0.3.9", -] - [[package]] name = "num-bigint" version = "0.4.3" @@ -3861,27 +3339,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num_threads" version = "0.1.6" @@ -3901,17 +3358,6 @@ dependencies = [ "objc_exception", ] -[[package]] -name = "objc-foundation" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" -dependencies = [ - "block", - "objc", - "objc_id", -] - [[package]] name = "objc_exception" version = "0.1.2" @@ -3921,15 +3367,6 @@ dependencies = [ "cc", ] -[[package]] -name = "objc_id" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" -dependencies = [ - "objc", -] - [[package]] name = "object" version = "0.28.4" @@ -3962,7 +3399,7 @@ checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e" dependencies = [ "bitflags", "cfg-if 1.0.0", - "foreign-types 0.3.2", + "foreign-types", "libc", "once_cell", "openssl-macros", @@ -4014,15 +3451,6 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" -[[package]] -name = "osmesa-sys" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" -dependencies = [ - "shared_library", -] - [[package]] name = "outline" version = "0.1.0" @@ -4136,7 +3564,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39fe46acc5503595e5949c17b818714d26fdf9b4920eacf3b2947f0199f4a6ff" dependencies = [ - "rustc_version 0.3.3", + "rustc_version", ] [[package]] @@ -4358,16 +3786,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" -[[package]] -name = "proc-macro-crate" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -4411,7 +3829,7 @@ dependencies = [ "client", "clock", "collections", - "fsevent 2.0.2", + "fsevent", "futures", "fuzzy", "gpui", @@ -4601,15 +4019,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "quick-xml" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" -dependencies = [ - "memchr", -] - [[package]] name = "quote" version = "1.0.20" @@ -4718,15 +4127,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "raw-window-handle" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" -dependencies = [ - "cty", -] - [[package]] name = "rayon" version = "1.5.3" @@ -5041,16 +4441,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver 0.11.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.12", + "semver", ] [[package]] @@ -5192,12 +4583,6 @@ dependencies = [ "syn", ] -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" - [[package]] name = "scoped_threadpool" version = "0.1.9" @@ -5280,8 +4665,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", - "core-foundation 0.9.3", - "core-foundation-sys 0.8.3", + "core-foundation", + "core-foundation-sys", "libc", "security-framework-sys", ] @@ -5292,7 +4677,7 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ - "core-foundation-sys 0.8.3", + "core-foundation-sys", "libc", ] @@ -5305,12 +4690,6 @@ dependencies = [ "semver-parser", ] -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" - [[package]] name = "semver-parser" version = "0.10.2" @@ -5518,16 +4897,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_library" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" -dependencies = [ - "lazy_static", - "libc", -] - [[package]] name = "shellexpand" version = "2.1.0" @@ -5647,53 +5016,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" -[[package]] -name = "smithay-client-toolkit" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" -dependencies = [ - "bitflags", - "calloop", - "dlib", - "lazy_static", - "log", - "memmap2 0.3.1", - "nix 0.22.3", - "pkg-config", - "wayland-client", - "wayland-cursor", - "wayland-protocols", -] - -[[package]] -name = "smithay-client-toolkit" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" -dependencies = [ - "bitflags", - "dlib", - "lazy_static", - "log", - "memmap2 0.5.5", - "nix 0.24.1", - "pkg-config", - "wayland-client", - "wayland-cursor", - "wayland-protocols", -] - -[[package]] -name = "smithay-clipboard" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" -dependencies = [ - "smithay-client-toolkit 0.16.0", - "wayland-client", -] - [[package]] name = "smol" version = "1.2.5" @@ -5891,30 +5213,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap 2.34.0", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "subtle" version = "2.4.1" @@ -6055,7 +5353,6 @@ dependencies = [ name = "terminal" version = "0.1.0" dependencies = [ - "alacritty", "alacritty_terminal", "client", "dirs 4.0.0", @@ -6845,7 +6142,7 @@ dependencies = [ "fontdb", "kurbo", "log", - "memmap2 0.2.3", + "memmap2", "pico-args", "rctree", "roxmltree", @@ -6958,26 +6255,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "vswhom" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" -dependencies = [ - "libc", - "vswhom-sys", -] - -[[package]] -name = "vswhom-sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22025f6d8eb903ebf920ea6933b70b1e495be37e2cb4099e62c80454aaf57c39" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "vte" version = "0.10.1" @@ -7396,89 +6673,6 @@ dependencies = [ "wast 43.0.0", ] -[[package]] -name = "wayland-client" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91223460e73257f697d9e23d401279123d36039a3f7a449e983f123292d4458f" -dependencies = [ - "bitflags", - "downcast-rs", - "libc", - "nix 0.22.3", - "scoped-tls", - "wayland-commons", - "wayland-scanner", - "wayland-sys", -] - -[[package]] -name = "wayland-commons" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f6e5e340d7c13490eca867898c4cec5af56c27a5ffe5c80c6fc4708e22d33e" -dependencies = [ - "nix 0.22.3", - "once_cell", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-cursor" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c52758f13d5e7861fc83d942d3d99bf270c83269575e52ac29e5b73cb956a6bd" -dependencies = [ - "nix 0.22.3", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-egl" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83281d69ee162b59031c666385e93bde4039ec553b90c4191cdb128ceea29a3a" -dependencies = [ - "wayland-client", - "wayland-sys", -] - -[[package]] -name = "wayland-protocols" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60147ae23303402e41fe034f74fb2c35ad0780ee88a1c40ac09a3be1e7465741" -dependencies = [ - "bitflags", - "wayland-client", - "wayland-commons", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39a1ed3143f7a143187156a2ab52742e89dac33245ba505c17224df48939f9e0" -dependencies = [ - "proc-macro2", - "quote", - "xml-rs", -] - -[[package]] -name = "wayland-sys" -version = "0.29.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9341df79a8975679188e37dab3889bfa57c44ac2cb6da166f519a81cbe452d4" -dependencies = [ - "dlib", - "lazy_static", - "pkg-config", -] - [[package]] name = "web-sys" version = "0.3.58" @@ -7691,40 +6885,6 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" -[[package]] -name = "winit" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" -dependencies = [ - "bitflags", - "cocoa", - "core-foundation 0.9.3", - "core-graphics 0.22.3", - "core-video-sys", - "dispatch", - "instant", - "lazy_static", - "libc", - "log", - "mio 0.8.4", - "ndk", - "ndk-glue", - "ndk-sys", - "objc", - "parking_lot 0.11.2", - "percent-encoding", - "raw-window-handle", - "serde", - "smithay-client-toolkit 0.15.4", - "wasm-bindgen", - "wayland-client", - "wayland-protocols", - "web-sys", - "winapi 0.3.9", - "x11-dl", -] - [[package]] name = "winreg" version = "0.10.1" @@ -7801,55 +6961,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "x11-clipboard" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473068b7b80ac86a18328824f1054e5e007898c47b5bbc281bd7abe32bc3653c" -dependencies = [ - "xcb", -] - -[[package]] -name = "x11-dl" -version = "2.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59" -dependencies = [ - "lazy_static", - "libc", - "pkg-config", -] - -[[package]] -name = "xcb" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771e2b996df720cd1c6dd9ff90f62d91698fd3610cc078388d0564bdd6622a9c" -dependencies = [ - "libc", - "log", - "quick-xml", -] - -[[package]] -name = "xcursor" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" -dependencies = [ - "nom", -] - -[[package]] -name = "xdg" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" -dependencies = [ - "dirs 4.0.0", -] - [[package]] name = "xml-rs" version = "0.8.4" @@ -7906,7 +7017,7 @@ dependencies = [ "editor", "env_logger", "file_finder", - "fsevent 2.0.2", + "fsevent", "futures", "fuzzy", "go_to_line", diff --git a/crates/terminal/Cargo.toml b/crates/terminal/Cargo.toml index 63894b57f0..ee67e644b0 100644 --- a/crates/terminal/Cargo.toml +++ b/crates/terminal/Cargo.toml @@ -28,4 +28,3 @@ gpui = { path = "../gpui", features = ["test-support"] } client = { path = "../client", features = ["test-support"]} project = { path = "../project", features = ["test-support"]} workspace = { path = "../workspace", features = ["test-support"] } -alacritty = "0.10.1" \ No newline at end of file diff --git a/crates/terminal/src/connection/events.rs b/crates/terminal/src/connection/events.rs index 14a3b873c7..ae14e296b5 100644 --- a/crates/terminal/src/connection/events.rs +++ b/crates/terminal/src/connection/events.rs @@ -1,7 +1,20 @@ use alacritty_terminal::term::TermMode; use gpui::keymap::Keystroke; -pub enum ModifierCombinations { +/* +Design notes: +I would like terminal mode checking to be concealed behind the TerminalConnection in as many ways as possible. +Alacritty has a lot of stuff intermixed for it's input handling. TerminalConnection should be in charge +of anything that needs to conform to a standard that isn't handled by Term, e.g.: +- Reporting mouse events correctly. +- Reporting scrolls -> Depends on MOUSE_MODE, ALT_SCREEN, and ALTERNATE_SCROLL, etc. +- Correctly bracketing a paste +- Storing changed colors +- Focus change sequence +*/ + +#[derive(Debug)] +pub enum Modifiers { None, Alt, Ctrl, @@ -10,168 +23,168 @@ pub enum ModifierCombinations { Other, } -impl ModifierCombinations { +impl Modifiers { fn new(ks: &Keystroke) -> Self { match (ks.alt, ks.ctrl, ks.shift, ks.cmd) { - (false, false, false, false) => ModifierCombinations::None, - (true, false, false, false) => ModifierCombinations::Alt, - (false, true, false, false) => ModifierCombinations::Ctrl, - (false, false, true, false) => ModifierCombinations::Shift, - (false, true, true, false) => ModifierCombinations::CtrlShift, - _ => ModifierCombinations::Other, + (false, false, false, false) => Modifiers::None, + (true, false, false, false) => Modifiers::Alt, + (false, true, false, false) => Modifiers::Ctrl, + (false, false, true, false) => Modifiers::Shift, + (false, true, true, false) => Modifiers::CtrlShift, + _ => Modifiers::Other, } } } pub fn to_esc_str(keystroke: &Keystroke, mode: &TermMode) -> Option { - let modifiers = ModifierCombinations::new(&keystroke); + let modifiers = Modifiers::new(&keystroke); // Manual Bindings including modifiers let manual_esc_str = match (keystroke.key.as_ref(), modifiers) { //Basic special keys - ("space", ModifierCombinations::None) => Some(" ".to_string()), - ("tab", ModifierCombinations::None) => Some("\x09".to_string()), - ("escape", ModifierCombinations::None) => Some("\x1b".to_string()), - ("enter", ModifierCombinations::None) => Some("\x0d".to_string()), - ("backspace", ModifierCombinations::None) => Some("\x7f".to_string()), + ("space", Modifiers::None) => Some(" ".to_string()), + ("tab", Modifiers::None) => Some("\x09".to_string()), + ("escape", Modifiers::None) => Some("\x1b".to_string()), + ("enter", Modifiers::None) => Some("\x0d".to_string()), + ("backspace", Modifiers::None) => Some("\x7f".to_string()), //Interesting escape codes - ("tab", ModifierCombinations::Shift) => Some("\x1b[Z".to_string()), - ("backspace", ModifierCombinations::Alt) => Some("\x1b\x7f".to_string()), - ("backspace", ModifierCombinations::Shift) => Some("\x7f".to_string()), - ("home", ModifierCombinations::Shift) if mode.contains(TermMode::ALT_SCREEN) => { + ("tab", Modifiers::Shift) => Some("\x1b[Z".to_string()), + ("backspace", Modifiers::Alt) => Some("\x1b\x7f".to_string()), + ("backspace", Modifiers::Shift) => Some("\x7f".to_string()), + ("home", Modifiers::Shift) if mode.contains(TermMode::ALT_SCREEN) => { Some("\x1b[1;2H".to_string()) } - ("end", ModifierCombinations::Shift) if mode.contains(TermMode::ALT_SCREEN) => { + ("end", Modifiers::Shift) if mode.contains(TermMode::ALT_SCREEN) => { Some("\x1b[1;2F".to_string()) } - ("pageup", ModifierCombinations::Shift) if mode.contains(TermMode::ALT_SCREEN) => { + ("pageup", Modifiers::Shift) if mode.contains(TermMode::ALT_SCREEN) => { Some("\x1b[5;2~".to_string()) } - ("pagedown", ModifierCombinations::Shift) if mode.contains(TermMode::ALT_SCREEN) => { + ("pagedown", Modifiers::Shift) if mode.contains(TermMode::ALT_SCREEN) => { Some("\x1b[6;2~".to_string()) } - ("home", ModifierCombinations::None) if mode.contains(TermMode::APP_CURSOR) => { + ("home", Modifiers::None) if mode.contains(TermMode::APP_CURSOR) => { Some("\x1bOH".to_string()) } - ("home", ModifierCombinations::None) if !mode.contains(TermMode::APP_CURSOR) => { + ("home", Modifiers::None) if !mode.contains(TermMode::APP_CURSOR) => { Some("\x1b[H".to_string()) } - ("end", ModifierCombinations::None) if mode.contains(TermMode::APP_CURSOR) => { + ("end", Modifiers::None) if mode.contains(TermMode::APP_CURSOR) => { Some("\x1bOF".to_string()) } - ("end", ModifierCombinations::None) if !mode.contains(TermMode::APP_CURSOR) => { + ("end", Modifiers::None) if !mode.contains(TermMode::APP_CURSOR) => { Some("\x1b[F".to_string()) } - ("up", ModifierCombinations::None) if mode.contains(TermMode::APP_CURSOR) => { + ("up", Modifiers::None) if mode.contains(TermMode::APP_CURSOR) => { Some("\x1bOA".to_string()) } - ("up", ModifierCombinations::None) if !mode.contains(TermMode::APP_CURSOR) => { + ("up", Modifiers::None) if !mode.contains(TermMode::APP_CURSOR) => { Some("\x1b[A".to_string()) } - ("down", ModifierCombinations::None) if mode.contains(TermMode::APP_CURSOR) => { + ("down", Modifiers::None) if mode.contains(TermMode::APP_CURSOR) => { Some("\x1bOB".to_string()) } - ("down", ModifierCombinations::None) if !mode.contains(TermMode::APP_CURSOR) => { + ("down", Modifiers::None) if !mode.contains(TermMode::APP_CURSOR) => { Some("\x1b[B".to_string()) } - ("right", ModifierCombinations::None) if mode.contains(TermMode::APP_CURSOR) => { + ("right", Modifiers::None) if mode.contains(TermMode::APP_CURSOR) => { Some("\x1bOC".to_string()) } - ("right", ModifierCombinations::None) if !mode.contains(TermMode::APP_CURSOR) => { + ("right", Modifiers::None) if !mode.contains(TermMode::APP_CURSOR) => { Some("\x1b[C".to_string()) } - ("left", ModifierCombinations::None) if mode.contains(TermMode::APP_CURSOR) => { + ("left", Modifiers::None) if mode.contains(TermMode::APP_CURSOR) => { Some("\x1bOD".to_string()) } - ("left", ModifierCombinations::None) if !mode.contains(TermMode::APP_CURSOR) => { + ("left", Modifiers::None) if !mode.contains(TermMode::APP_CURSOR) => { Some("\x1b[D".to_string()) } - ("back", ModifierCombinations::None) => Some("\x7f".to_string()), - ("insert", ModifierCombinations::None) => Some("\x1b[2~".to_string()), - ("delete", ModifierCombinations::None) => Some("\x1b[3~".to_string()), - ("pageup", ModifierCombinations::None) => Some("\x1b[5~".to_string()), - ("pagedown", ModifierCombinations::None) => Some("\x1b[6~".to_string()), - ("f1", ModifierCombinations::None) => Some("\x1bOP".to_string()), - ("f2", ModifierCombinations::None) => Some("\x1bOQ".to_string()), - ("f3", ModifierCombinations::None) => Some("\x1bOR".to_string()), - ("f4", ModifierCombinations::None) => Some("\x1bOS".to_string()), - ("f5", ModifierCombinations::None) => Some("\x1b[15~".to_string()), - ("f6", ModifierCombinations::None) => Some("\x1b[17~".to_string()), - ("f7", ModifierCombinations::None) => Some("\x1b[18~".to_string()), - ("f8", ModifierCombinations::None) => Some("\x1b[19~".to_string()), - ("f9", ModifierCombinations::None) => Some("\x1b[20~".to_string()), - ("f10", ModifierCombinations::None) => Some("\x1b[21~".to_string()), - ("f11", ModifierCombinations::None) => Some("\x1b[23~".to_string()), - ("f12", ModifierCombinations::None) => Some("\x1b[24~".to_string()), - ("f13", ModifierCombinations::None) => Some("\x1b[25~".to_string()), - ("f14", ModifierCombinations::None) => Some("\x1b[26~".to_string()), - ("f15", ModifierCombinations::None) => Some("\x1b[28~".to_string()), - ("f16", ModifierCombinations::None) => Some("\x1b[29~".to_string()), - ("f17", ModifierCombinations::None) => Some("\x1b[31~".to_string()), - ("f18", ModifierCombinations::None) => Some("\x1b[32~".to_string()), - ("f19", ModifierCombinations::None) => Some("\x1b[33~".to_string()), - ("f20", ModifierCombinations::None) => Some("\x1b[34~".to_string()), + ("back", Modifiers::None) => Some("\x7f".to_string()), + ("insert", Modifiers::None) => Some("\x1b[2~".to_string()), + ("delete", Modifiers::None) => Some("\x1b[3~".to_string()), + ("pageup", Modifiers::None) => Some("\x1b[5~".to_string()), + ("pagedown", Modifiers::None) => Some("\x1b[6~".to_string()), + ("f1", Modifiers::None) => Some("\x1bOP".to_string()), + ("f2", Modifiers::None) => Some("\x1bOQ".to_string()), + ("f3", Modifiers::None) => Some("\x1bOR".to_string()), + ("f4", Modifiers::None) => Some("\x1bOS".to_string()), + ("f5", Modifiers::None) => Some("\x1b[15~".to_string()), + ("f6", Modifiers::None) => Some("\x1b[17~".to_string()), + ("f7", Modifiers::None) => Some("\x1b[18~".to_string()), + ("f8", Modifiers::None) => Some("\x1b[19~".to_string()), + ("f9", Modifiers::None) => Some("\x1b[20~".to_string()), + ("f10", Modifiers::None) => Some("\x1b[21~".to_string()), + ("f11", Modifiers::None) => Some("\x1b[23~".to_string()), + ("f12", Modifiers::None) => Some("\x1b[24~".to_string()), + ("f13", Modifiers::None) => Some("\x1b[25~".to_string()), + ("f14", Modifiers::None) => Some("\x1b[26~".to_string()), + ("f15", Modifiers::None) => Some("\x1b[28~".to_string()), + ("f16", Modifiers::None) => Some("\x1b[29~".to_string()), + ("f17", Modifiers::None) => Some("\x1b[31~".to_string()), + ("f18", Modifiers::None) => Some("\x1b[32~".to_string()), + ("f19", Modifiers::None) => Some("\x1b[33~".to_string()), + ("f20", Modifiers::None) => Some("\x1b[34~".to_string()), // NumpadEnter, Action::Esc("\n".into()); //Mappings for caret notation keys - ("a", ModifierCombinations::Ctrl) => Some("\x01".to_string()), //1 - ("A", ModifierCombinations::CtrlShift) => Some("\x01".to_string()), //1 - ("b", ModifierCombinations::Ctrl) => Some("\x02".to_string()), //2 - ("B", ModifierCombinations::CtrlShift) => Some("\x02".to_string()), //2 - ("c", ModifierCombinations::Ctrl) => Some("\x03".to_string()), //3 - ("C", ModifierCombinations::CtrlShift) => Some("\x03".to_string()), //3 - ("d", ModifierCombinations::Ctrl) => Some("\x04".to_string()), //4 - ("D", ModifierCombinations::CtrlShift) => Some("\x04".to_string()), //4 - ("e", ModifierCombinations::Ctrl) => Some("\x05".to_string()), //5 - ("E", ModifierCombinations::CtrlShift) => Some("\x05".to_string()), //5 - ("f", ModifierCombinations::Ctrl) => Some("\x06".to_string()), //6 - ("F", ModifierCombinations::CtrlShift) => Some("\x06".to_string()), //6 - ("g", ModifierCombinations::Ctrl) => Some("\x07".to_string()), //7 - ("G", ModifierCombinations::CtrlShift) => Some("\x07".to_string()), //7 - ("h", ModifierCombinations::Ctrl) => Some("\x08".to_string()), //8 - ("H", ModifierCombinations::CtrlShift) => Some("\x08".to_string()), //8 - ("i", ModifierCombinations::Ctrl) => Some("\x09".to_string()), //9 - ("I", ModifierCombinations::CtrlShift) => Some("\x09".to_string()), //9 - ("j", ModifierCombinations::Ctrl) => Some("\x0a".to_string()), //10 - ("J", ModifierCombinations::CtrlShift) => Some("\x0a".to_string()), //10 - ("k", ModifierCombinations::Ctrl) => Some("\x0b".to_string()), //11 - ("K", ModifierCombinations::CtrlShift) => Some("\x0b".to_string()), //11 - ("l", ModifierCombinations::Ctrl) => Some("\x0c".to_string()), //12 - ("L", ModifierCombinations::CtrlShift) => Some("\x0c".to_string()), //12 - ("m", ModifierCombinations::Ctrl) => Some("\x0d".to_string()), //13 - ("M", ModifierCombinations::CtrlShift) => Some("\x0d".to_string()), //13 - ("n", ModifierCombinations::Ctrl) => Some("\x0e".to_string()), //14 - ("N", ModifierCombinations::CtrlShift) => Some("\x0e".to_string()), //14 - ("o", ModifierCombinations::Ctrl) => Some("\x0f".to_string()), //15 - ("O", ModifierCombinations::CtrlShift) => Some("\x0f".to_string()), //15 - ("p", ModifierCombinations::Ctrl) => Some("\x10".to_string()), //16 - ("P", ModifierCombinations::CtrlShift) => Some("\x10".to_string()), //16 - ("q", ModifierCombinations::Ctrl) => Some("\x11".to_string()), //17 - ("Q", ModifierCombinations::CtrlShift) => Some("\x11".to_string()), //17 - ("r", ModifierCombinations::Ctrl) => Some("\x12".to_string()), //18 - ("R", ModifierCombinations::CtrlShift) => Some("\x12".to_string()), //18 - ("s", ModifierCombinations::Ctrl) => Some("\x13".to_string()), //19 - ("S", ModifierCombinations::CtrlShift) => Some("\x13".to_string()), //19 - ("t", ModifierCombinations::Ctrl) => Some("\x14".to_string()), //20 - ("T", ModifierCombinations::CtrlShift) => Some("\x14".to_string()), //20 - ("u", ModifierCombinations::Ctrl) => Some("\x15".to_string()), //21 - ("U", ModifierCombinations::CtrlShift) => Some("\x15".to_string()), //21 - ("v", ModifierCombinations::Ctrl) => Some("\x16".to_string()), //22 - ("V", ModifierCombinations::CtrlShift) => Some("\x16".to_string()), //22 - ("w", ModifierCombinations::Ctrl) => Some("\x17".to_string()), //23 - ("W", ModifierCombinations::CtrlShift) => Some("\x17".to_string()), //23 - ("x", ModifierCombinations::Ctrl) => Some("\x18".to_string()), //24 - ("X", ModifierCombinations::CtrlShift) => Some("\x18".to_string()), //24 - ("y", ModifierCombinations::Ctrl) => Some("\x19".to_string()), //25 - ("Y", ModifierCombinations::CtrlShift) => Some("\x19".to_string()), //25 - ("z", ModifierCombinations::Ctrl) => Some("\x1a".to_string()), //26 - ("Z", ModifierCombinations::CtrlShift) => Some("\x1a".to_string()), //26 - ("@", ModifierCombinations::Ctrl) => Some("\x00".to_string()), //0 - ("[", ModifierCombinations::Ctrl) => Some("\x1b".to_string()), //27 - ("\\", ModifierCombinations::Ctrl) => Some("\x1c".to_string()), //28 - ("]", ModifierCombinations::Ctrl) => Some("\x1d".to_string()), //29 - ("^", ModifierCombinations::Ctrl) => Some("\x1e".to_string()), //30 - ("_", ModifierCombinations::Ctrl) => Some("\x1f".to_string()), //31 - ("?", ModifierCombinations::Ctrl) => Some("\x7f".to_string()), //127 + ("a", Modifiers::Ctrl) => Some("\x01".to_string()), //1 + ("A", Modifiers::CtrlShift) => Some("\x01".to_string()), //1 + ("b", Modifiers::Ctrl) => Some("\x02".to_string()), //2 + ("B", Modifiers::CtrlShift) => Some("\x02".to_string()), //2 + ("c", Modifiers::Ctrl) => Some("\x03".to_string()), //3 + ("C", Modifiers::CtrlShift) => Some("\x03".to_string()), //3 + ("d", Modifiers::Ctrl) => Some("\x04".to_string()), //4 + ("D", Modifiers::CtrlShift) => Some("\x04".to_string()), //4 + ("e", Modifiers::Ctrl) => Some("\x05".to_string()), //5 + ("E", Modifiers::CtrlShift) => Some("\x05".to_string()), //5 + ("f", Modifiers::Ctrl) => Some("\x06".to_string()), //6 + ("F", Modifiers::CtrlShift) => Some("\x06".to_string()), //6 + ("g", Modifiers::Ctrl) => Some("\x07".to_string()), //7 + ("G", Modifiers::CtrlShift) => Some("\x07".to_string()), //7 + ("h", Modifiers::Ctrl) => Some("\x08".to_string()), //8 + ("H", Modifiers::CtrlShift) => Some("\x08".to_string()), //8 + ("i", Modifiers::Ctrl) => Some("\x09".to_string()), //9 + ("I", Modifiers::CtrlShift) => Some("\x09".to_string()), //9 + ("j", Modifiers::Ctrl) => Some("\x0a".to_string()), //10 + ("J", Modifiers::CtrlShift) => Some("\x0a".to_string()), //10 + ("k", Modifiers::Ctrl) => Some("\x0b".to_string()), //11 + ("K", Modifiers::CtrlShift) => Some("\x0b".to_string()), //11 + ("l", Modifiers::Ctrl) => Some("\x0c".to_string()), //12 + ("L", Modifiers::CtrlShift) => Some("\x0c".to_string()), //12 + ("m", Modifiers::Ctrl) => Some("\x0d".to_string()), //13 + ("M", Modifiers::CtrlShift) => Some("\x0d".to_string()), //13 + ("n", Modifiers::Ctrl) => Some("\x0e".to_string()), //14 + ("N", Modifiers::CtrlShift) => Some("\x0e".to_string()), //14 + ("o", Modifiers::Ctrl) => Some("\x0f".to_string()), //15 + ("O", Modifiers::CtrlShift) => Some("\x0f".to_string()), //15 + ("p", Modifiers::Ctrl) => Some("\x10".to_string()), //16 + ("P", Modifiers::CtrlShift) => Some("\x10".to_string()), //16 + ("q", Modifiers::Ctrl) => Some("\x11".to_string()), //17 + ("Q", Modifiers::CtrlShift) => Some("\x11".to_string()), //17 + ("r", Modifiers::Ctrl) => Some("\x12".to_string()), //18 + ("R", Modifiers::CtrlShift) => Some("\x12".to_string()), //18 + ("s", Modifiers::Ctrl) => Some("\x13".to_string()), //19 + ("S", Modifiers::CtrlShift) => Some("\x13".to_string()), //19 + ("t", Modifiers::Ctrl) => Some("\x14".to_string()), //20 + ("T", Modifiers::CtrlShift) => Some("\x14".to_string()), //20 + ("u", Modifiers::Ctrl) => Some("\x15".to_string()), //21 + ("U", Modifiers::CtrlShift) => Some("\x15".to_string()), //21 + ("v", Modifiers::Ctrl) => Some("\x16".to_string()), //22 + ("V", Modifiers::CtrlShift) => Some("\x16".to_string()), //22 + ("w", Modifiers::Ctrl) => Some("\x17".to_string()), //23 + ("W", Modifiers::CtrlShift) => Some("\x17".to_string()), //23 + ("x", Modifiers::Ctrl) => Some("\x18".to_string()), //24 + ("X", Modifiers::CtrlShift) => Some("\x18".to_string()), //24 + ("y", Modifiers::Ctrl) => Some("\x19".to_string()), //25 + ("Y", Modifiers::CtrlShift) => Some("\x19".to_string()), //25 + ("z", Modifiers::Ctrl) => Some("\x1a".to_string()), //26 + ("Z", Modifiers::CtrlShift) => Some("\x1a".to_string()), //26 + ("@", Modifiers::Ctrl) => Some("\x00".to_string()), //0 + ("[", Modifiers::Ctrl) => Some("\x1b".to_string()), //27 + ("\\", Modifiers::Ctrl) => Some("\x1c".to_string()), //28 + ("]", Modifiers::Ctrl) => Some("\x1d".to_string()), //29 + ("^", Modifiers::Ctrl) => Some("\x1e".to_string()), //30 + ("_", Modifiers::Ctrl) => Some("\x1f".to_string()), //31 + ("?", Modifiers::Ctrl) => Some("\x7f".to_string()), //127 _ => None, }; if manual_esc_str.is_some() { @@ -226,62 +239,6 @@ pub fn to_esc_str(keystroke: &Keystroke, mode: &TermMode) -> Option { } } -/* -New keybindings test plan: - -Is the terminal still usable? YES! -Do ctrl-shift-[X] and ctrl-[x] do the same thing? I THINK SO -Does ctrl-l work? YES -Does tab work? YES -Do all the global overrides (up, down, enter, escape, ctrl-c) work? => YES -Space also doesn't work YES! - - - -So, to match alacritty keyboard handling, we need to check APP_CURSOR, and ALT_SCREEN - -And we need to convert the strings that GPUI returns to keys - -And we need a way of easily declaring and matching a modifier pattern on those keys - -And we need to block writing the input to the pty if any of these match - -And I need to figure out how to express this in a cross platform way - -And a way of optionally interfacing this with actions for rebinding in defaults.json - -Design notes: -I would like terminal mode checking to be concealed behind the TerminalConnection in as many ways as possible. -Alacritty has a lot of stuff intermixed for it's input handling. TerminalConnection should be in charge -of anything that needs to conform to a standard that isn't handled by Term, e.g.: -- Reporting mouse events correctly. -- Reporting scrolls -> Depends on MOUSE_MODE, ALT_SCREEN, and ALTERNATE_SCROLL, etc. -- Correctly bracketing a paste -- Storing changed colors -- Focus change sequence - -Scrolling might be handled internally or externally, need a way to ask. Everything else should probably happen internally. - -Standards/OS compliance is in connection.rs. -This takes GPUI events and translates them to the correct terminal stuff -This means that standards compliance outside of connection should be kept to a minimum. Yes, this feels good. -Connection needs to be split up then, into a bunch of event handlers - -Punting on these by pushing them up to a scrolling element -(either on dispatch_event directly or a seperate scrollbar) - Home, ModifiersState::SHIFT, ~BindingMode::ALT_SCREEN; Action::ScrollToTop; - End, ModifiersState::SHIFT, ~BindingMode::ALT_SCREEN; Action::ScrollToBottom; - PageUp, ModifiersState::SHIFT, ~BindingMode::ALT_SCREEN; Action::ScrollPageUp; - PageDown, ModifiersState::SHIFT, ~BindingMode::ALT_SCREEN; Action::ScrollPageDown; - - - -NOTE, THE FOLLOWING HAS 2 BINDINGS: -K, ModifiersState::LOGO, Action::Esc("\x0c".into()); -K, ModifiersState::LOGO, Action::ClearHistory; => ctx.terminal_mut().clear_screen(ClearMode::Saved), - -*/ - /// Code Modifiers /// ---------+--------------------------- /// 2 | Shift @@ -312,9 +269,47 @@ mod test { use super::*; #[test] - fn test_match_alacritty_keybindings() { - let bindings = alacritty::config::bindings::default_key_bindings(); - //TODO + fn test_application_mode() { + let app_cursor = TermMode::APP_CURSOR; + let none = TermMode::NONE; + + let up = Keystroke::parse("up").unwrap(); + let down = Keystroke::parse("down").unwrap(); + let left = Keystroke::parse("left").unwrap(); + let right = Keystroke::parse("right").unwrap(); + + assert_eq!(to_esc_str(&up, &none), Some("\x1b[A".to_string())); + assert_eq!(to_esc_str(&down, &none), Some("\x1b[B".to_string())); + assert_eq!(to_esc_str(&right, &none), Some("\x1b[C".to_string())); + assert_eq!(to_esc_str(&left, &none), Some("\x1b[D".to_string())); + + assert_eq!(to_esc_str(&up, &app_cursor), Some("\x1bOA".to_string())); + assert_eq!(to_esc_str(&down, &app_cursor), Some("\x1bOB".to_string())); + assert_eq!(to_esc_str(&right, &app_cursor), Some("\x1bOC".to_string())); + assert_eq!(to_esc_str(&left, &app_cursor), Some("\x1bOD".to_string())); + } + + #[test] + fn test_ctrl_codes() { + let letters_lower = 'a'..='z'; + let letters_upper = 'A'..='Z'; + let mode = TermMode::ANY; + + for (lower, upper) in letters_lower.zip(letters_upper) { + assert_eq!( + to_esc_str( + &Keystroke::parse(&format!("ctrl-{}", lower)).unwrap(), + &mode + ), + to_esc_str( + &Keystroke::parse(&format!("ctrl-shift-{}", upper)).unwrap(), + &mode + ), + "On letter: {}/{}", + lower, + upper + ) + } } #[test]