Remove Windows WinPTY backend

This commit is contained in:
Christian Duerr 2021-01-01 05:07:39 +00:00 committed by GitHub
parent 1723e30d25
commit 8ed72cc065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 77 additions and 864 deletions

View File

@ -1,11 +1,12 @@
For bug reports, the following information can help speed up the process. Please describe the bug that you have found and what you would expect to happen instead.
For bug reports, the following information can help speed up the process. Please
describe the bug that you have found and what you would expect to happen
instead.
### System
OS: Linux/BSD/macOS/Windows
Version: `alacritty --version` output
Linux/BSD: X11/Wayland, DE or Compositor and WM
Windows: WinPTY/ConPTY (see `alacritty -v` output)
### Logs

View File

@ -62,6 +62,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `live-shader-reload` feature
- Config option `dynamic_title`, you should use `window.dynamic_title` instead
- Config option `scrolling.faux_multiplier`, which was replaced by escape `CSI ? 1007 h/l`
- WinPTY support on Windows
## 0.6.0

445
Cargo.lock generated
View File

@ -12,15 +12,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
[[package]]
name = "aho-corasick"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
dependencies = [
"memchr",
]
[[package]]
name = "alacritty"
version = "0.7.0-dev"
@ -81,7 +72,6 @@ dependencies = [
"mio",
"mio-anonymous-pipes",
"mio-extras",
"mio-named-pipes",
"miow 0.3.6",
"nix",
"parking_lot",
@ -93,7 +83,6 @@ dependencies = [
"unicode-width",
"vte",
"winapi 0.3.9",
"winpty",
]
[[package]]
@ -165,30 +154,6 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "bindgen"
version = "0.53.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5"
dependencies = [
"bitflags",
"cexpr",
"cfg-if 0.1.10",
"clang-sys",
"clap",
"env_logger",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"which",
]
[[package]]
name = "bitflags"
version = "1.2.1"
@ -218,27 +183,6 @@ version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]]
name = "bzip2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b"
dependencies = [
"bzip2-sys",
"libc",
]
[[package]]
name = "bzip2-sys"
version = "0.1.9+1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad3b39a260062fca31f7b0b12f207e8f2590a67d32ec7d59c20484b07ea7285e"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]]
name = "calloop"
version = "0.6.5"
@ -254,18 +198,6 @@ name = "cc"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
dependencies = [
"jobserver",
]
[[package]]
name = "cexpr"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
dependencies = [
"nom 5.1.2",
]
[[package]]
name = "cfg-if"
@ -288,17 +220,6 @@ dependencies = [
"libc",
]
[[package]]
name = "clang-sys"
version = "0.29.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a"
dependencies = [
"glob",
"libc",
"libloading 0.5.2",
]
[[package]]
name = "clap"
version = "2.33.3"
@ -623,7 +544,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76"
dependencies = [
"libloading 0.6.4",
"libloading",
]
[[package]]
@ -662,19 +583,6 @@ dependencies = [
"winreg",
]
[[package]]
name = "env_logger"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]]
name = "expat-sys"
version = "2.1.6"
@ -697,18 +605,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "flate2"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42"
dependencies = [
"cfg-if 0.1.10",
"crc32fast",
"libc",
"miniz_oxide",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -836,12 +732,6 @@ dependencies = [
"xml-rs",
]
[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "glutin"
version = "0.26.0"
@ -858,7 +748,7 @@ dependencies = [
"glutin_glx_sys",
"glutin_wgl_sys",
"lazy_static",
"libloading 0.6.4",
"libloading",
"log",
"objc",
"osmesa-sys",
@ -923,25 +813,6 @@ dependencies = [
"libc",
]
[[package]]
name = "http_req"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef9a6b5b2cd80630d9c6bda175408a86908d8a9c1eb5b2857206529d88d063a3"
dependencies = [
"native-tls",
"unicase",
]
[[package]]
name = "humantime"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
dependencies = [
"quick-error",
]
[[package]]
name = "ident_case"
version = "1.0.1"
@ -998,15 +869,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
dependencies = [
"libc",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
@ -1047,16 +909,6 @@ version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
[[package]]
name = "libloading"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
dependencies = [
"cc",
"winapi 0.3.9",
]
[[package]]
name = "libloading"
version = "0.6.4"
@ -1174,18 +1026,6 @@ dependencies = [
"slab",
]
[[package]]
name = "mio-named-pipes"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
dependencies = [
"log",
"mio",
"miow 0.3.6",
"winapi 0.3.9",
]
[[package]]
name = "miow"
version = "0.2.2"
@ -1208,24 +1048,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "native-tls"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4"
dependencies = [
"lazy_static",
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]]
name = "ndk"
version = "0.2.1"
@ -1294,16 +1116,6 @@ dependencies = [
"libc",
]
[[package]]
name = "nom"
version = "5.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
dependencies = [
"memchr",
"version_check",
]
[[package]]
name = "nom"
version = "6.0.1"
@ -1389,39 +1201,6 @@ version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
[[package]]
name = "openssl"
version = "0.10.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
"foreign-types 0.3.2",
"lazy_static",
"libc",
"openssl-sys",
]
[[package]]
name = "openssl-probe"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "openssl-sys"
version = "0.9.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6"
dependencies = [
"autocfg",
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "osmesa-sys"
version = "0.1.2"
@ -1466,12 +1245,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "percent-encoding"
version = "2.1.0"
@ -1495,12 +1268,6 @@ dependencies = [
"miniz_oxide",
]
[[package]]
name = "ppv-lite86"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
@ -1519,12 +1286,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "quick-error"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
version = "1.0.8"
@ -1534,47 +1295,6 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"libc",
"rand_chacha",
"rand_core",
"rand_hc",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core",
]
[[package]]
name = "raw-window-handle"
version = "0.3.3"
@ -1601,18 +1321,6 @@ dependencies = [
"rust-argon2",
]
[[package]]
name = "regex"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
]
[[package]]
name = "regex-automata"
version = "0.1.9"
@ -1629,15 +1337,6 @@ version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "rust-argon2"
version = "0.8.3"
@ -1650,12 +1349,6 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rusttype"
version = "0.9.2"
@ -1681,16 +1374,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "schannel"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
dependencies = [
"lazy_static",
"winapi 0.3.9",
]
[[package]]
name = "scoped-tls"
version = "1.0.0"
@ -1703,29 +1386,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "security-framework"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69"
dependencies = [
"bitflags",
"core-foundation 0.9.1",
"core-foundation-sys 0.8.2",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b"
dependencies = [
"core-foundation-sys 0.8.2",
"libc",
]
[[package]]
name = "serde"
version = "1.0.118"
@ -1800,12 +1460,6 @@ dependencies = [
"libc",
]
[[package]]
name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "signal-hook"
version = "0.1.17"
@ -1907,29 +1561,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "tempfile"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
dependencies = [
"cfg-if 0.1.10",
"libc",
"rand",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.9",
]
[[package]]
name = "termcolor"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.11.0"
@ -1959,15 +1590,6 @@ dependencies = [
"syn",
]
[[package]]
name = "thread_local"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
dependencies = [
"lazy_static",
]
[[package]]
name = "time"
version = "0.1.44"
@ -1994,15 +1616,6 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc"
[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check",
]
[[package]]
name = "unicode-width"
version = "0.1.8"
@ -2026,12 +1639,6 @@ name = "utf8parse"
version = "0.2.0"
source = "git+https://github.com/alacritty/vte#b4b08a6de09ebecc6a4c14c81435418fd5a4e8a8"
[[package]]
name = "vcpkg"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
[[package]]
name = "vec_map"
version = "0.8.2"
@ -2188,15 +1795,6 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "which"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
dependencies = [
"libc",
]
[[package]]
name = "winapi"
version = "0.2.8"
@ -2272,29 +1870,6 @@ dependencies = [
"x11-dl",
]
[[package]]
name = "winpty"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92c5a39bb2408a307dd5ab774039ec3f2c68d052970ae4dacc346101abe202b2"
dependencies = [
"bitflags",
"http_req",
"tempfile",
"winpty-sys",
"zip",
]
[[package]]
name = "winpty-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed8a179a59760dc51d30b5e6eaf1bd6da88461f72f2616e962ddebef7e413210"
dependencies = [
"bindgen",
"cc",
]
[[package]]
name = "winreg"
version = "0.8.0"
@ -2360,7 +1935,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a9a231574ae78801646617cefd13bfe94be907c0e4fa979cfd8b770aa3c5d08"
dependencies = [
"nom 6.0.1",
"nom",
]
[[package]]
@ -2383,17 +1958,3 @@ checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d"
dependencies = [
"linked-hash-map",
]
[[package]]
name = "zip"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2896475a242c41366941faa27264df2cb935185a92e059a004d0048feb2ac5"
dependencies = [
"byteorder",
"bzip2",
"crc32fast",
"flate2",
"thiserror",
"time",
]

View File

@ -240,7 +240,6 @@ cargo build --release
```
If all goes well, this should place a binary at `target/release/alacritty`.
On Windows this directory should also contain the `winpty-agent.exe`.
### macOS

View File

@ -44,12 +44,6 @@ macOS and Windows.
Prebuilt binaries for macOS and Windows can also be downloaded from the
[GitHub releases page](https://github.com/alacritty/alacritty/releases).
On Windows, Alacritty requires winpty to emulate UNIX's PTY API for versions
older than Windows 10 (October 2018 Update) and Microsoft's VC++
redistributable. The winpty agent (`winpty-agent.exe`) **must** be in the same
directory as the Alacritty executable and is available through the
[GitHub releases page](https://github.com/alacritty/alacritty/releases).
For everyone else, the detailed instructions to install Alacritty can be found
[here](INSTALL.md).

View File

@ -402,16 +402,6 @@
# directory of the parent process will be used.
#working_directory: None
# WinPTY backend (Windows only)
#
# Alacritty defaults to using the newer ConPTY backend if it is available,
# since it resolves a lot of bugs and is quite a bit faster. If it is not
# available, the WinPTY backend will be used instead.
#
# Setting this option to `true` makes Alacritty use the legacy WinPTY backend,
# even if the ConPTY backend is available.
#winpty_backend: false
# Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: true

View File

@ -64,6 +64,5 @@ embed-resource = "1.3"
default = ["wayland", "x11"]
x11 = ["copypasta/x11", "glutin/x11", "x11-dl", "png"]
wayland = ["copypasta/wayland", "glutin/wayland", "wayland-client"]
winpty = ["alacritty_terminal/winpty"]
nightly = []
bench = []

View File

@ -298,8 +298,7 @@ mod tests {
fn dynamic_title_overridden_by_options() {
let mut config = Config::default();
let mut options = Options::default();
options.title = Some("foo".to_owned());
let options = Options { title: Some("foo".to_owned()), ..Options::default() };
options.override_config(&mut config);
assert!(!config.ui_config.window.dynamic_title);

View File

@ -1210,8 +1210,8 @@ mod tests {
#[test]
fn binding_matches_different_action() {
let binding = MockBinding::default();
let mut different_action = MockBinding::default();
different_action.action = Action::ClearHistory;
let different_action =
MockBinding { action: Action::ClearHistory, ..MockBinding::default() };
assert!(binding.triggers_match(&different_action));
assert!(different_action.triggers_match(&binding));
@ -1219,10 +1219,8 @@ mod tests {
#[test]
fn mods_binding_requires_strict_match() {
let mut superset_mods = MockBinding::default();
superset_mods.mods = ModifiersState::all();
let mut subset_mods = MockBinding::default();
subset_mods.mods = ModifiersState::ALT;
let superset_mods = MockBinding { mods: ModifiersState::all(), ..MockBinding::default() };
let subset_mods = MockBinding { mods: ModifiersState::ALT, ..MockBinding::default() };
assert!(!superset_mods.triggers_match(&subset_mods));
assert!(!subset_mods.triggers_match(&superset_mods));
@ -1230,10 +1228,8 @@ mod tests {
#[test]
fn binding_matches_identical_mode() {
let mut b1 = MockBinding::default();
b1.mode = BindingMode::ALT_SCREEN;
let mut b2 = MockBinding::default();
b2.mode = BindingMode::ALT_SCREEN;
let b1 = MockBinding { mode: BindingMode::ALT_SCREEN, ..MockBinding::default() };
let b2 = MockBinding { mode: BindingMode::ALT_SCREEN, ..MockBinding::default() };
assert!(b1.triggers_match(&b2));
assert!(b2.triggers_match(&b1));
@ -1242,18 +1238,22 @@ mod tests {
#[test]
fn binding_without_mode_matches_any_mode() {
let b1 = MockBinding::default();
let mut b2 = MockBinding::default();
b2.mode = BindingMode::APP_KEYPAD;
b2.notmode = BindingMode::ALT_SCREEN;
let b2 = MockBinding {
mode: BindingMode::APP_KEYPAD,
notmode: BindingMode::ALT_SCREEN,
..MockBinding::default()
};
assert!(b1.triggers_match(&b2));
}
#[test]
fn binding_with_mode_matches_empty_mode() {
let mut b1 = MockBinding::default();
b1.mode = BindingMode::APP_KEYPAD;
b1.notmode = BindingMode::ALT_SCREEN;
let b1 = MockBinding {
mode: BindingMode::APP_KEYPAD,
notmode: BindingMode::ALT_SCREEN,
..MockBinding::default()
};
let b2 = MockBinding::default();
assert!(b1.triggers_match(&b2));
@ -1262,10 +1262,11 @@ mod tests {
#[test]
fn binding_matches_modes() {
let mut b1 = MockBinding::default();
b1.mode = BindingMode::ALT_SCREEN | BindingMode::APP_KEYPAD;
let mut b2 = MockBinding::default();
b2.mode = BindingMode::APP_KEYPAD;
let b1 = MockBinding {
mode: BindingMode::ALT_SCREEN | BindingMode::APP_KEYPAD,
..MockBinding::default()
};
let b2 = MockBinding { mode: BindingMode::APP_KEYPAD, ..MockBinding::default() };
assert!(b1.triggers_match(&b2));
assert!(b2.triggers_match(&b1));
@ -1273,10 +1274,14 @@ mod tests {
#[test]
fn binding_matches_partial_intersection() {
let mut b1 = MockBinding::default();
b1.mode = BindingMode::ALT_SCREEN | BindingMode::APP_KEYPAD;
let mut b2 = MockBinding::default();
b2.mode = BindingMode::APP_KEYPAD | BindingMode::APP_CURSOR;
let b1 = MockBinding {
mode: BindingMode::ALT_SCREEN | BindingMode::APP_KEYPAD,
..MockBinding::default()
};
let b2 = MockBinding {
mode: BindingMode::APP_KEYPAD | BindingMode::APP_CURSOR,
..MockBinding::default()
};
assert!(b1.triggers_match(&b2));
assert!(b2.triggers_match(&b1));
@ -1284,10 +1289,8 @@ mod tests {
#[test]
fn binding_mismatches_notmode() {
let mut b1 = MockBinding::default();
b1.mode = BindingMode::ALT_SCREEN;
let mut b2 = MockBinding::default();
b2.notmode = BindingMode::ALT_SCREEN;
let b1 = MockBinding { mode: BindingMode::ALT_SCREEN, ..MockBinding::default() };
let b2 = MockBinding { notmode: BindingMode::ALT_SCREEN, ..MockBinding::default() };
assert!(!b1.triggers_match(&b2));
assert!(!b2.triggers_match(&b1));
@ -1295,10 +1298,8 @@ mod tests {
#[test]
fn binding_mismatches_unrelated() {
let mut b1 = MockBinding::default();
b1.mode = BindingMode::ALT_SCREEN;
let mut b2 = MockBinding::default();
b2.mode = BindingMode::APP_KEYPAD;
let b1 = MockBinding { mode: BindingMode::ALT_SCREEN, ..MockBinding::default() };
let b2 = MockBinding { mode: BindingMode::APP_KEYPAD, ..MockBinding::default() };
assert!(!b1.triggers_match(&b2));
assert!(!b2.triggers_match(&b1));
@ -1306,10 +1307,12 @@ mod tests {
#[test]
fn binding_matches_notmodes() {
let mut subset_notmodes = MockBinding::default();
let mut superset_notmodes = MockBinding::default();
subset_notmodes.notmode = BindingMode::VI | BindingMode::APP_CURSOR;
superset_notmodes.notmode = BindingMode::APP_CURSOR;
let subset_notmodes = MockBinding {
notmode: BindingMode::VI | BindingMode::APP_CURSOR,
..MockBinding::default()
};
let superset_notmodes =
MockBinding { notmode: BindingMode::APP_CURSOR, ..MockBinding::default() };
assert!(subset_notmodes.triggers_match(&superset_notmodes));
assert!(superset_notmodes.triggers_match(&subset_notmodes));
@ -1317,11 +1320,12 @@ mod tests {
#[test]
fn binding_matches_mode_notmode() {
let mut b1 = MockBinding::default();
let mut b2 = MockBinding::default();
b1.mode = BindingMode::VI;
b1.notmode = BindingMode::APP_CURSOR;
b2.notmode = BindingMode::APP_CURSOR;
let b1 = MockBinding {
mode: BindingMode::VI,
notmode: BindingMode::APP_CURSOR,
..MockBinding::default()
};
let b2 = MockBinding { notmode: BindingMode::APP_CURSOR, ..MockBinding::default() };
assert!(b1.triggers_match(&b2));
assert!(b2.triggers_match(&b1));
@ -1329,8 +1333,7 @@ mod tests {
#[test]
fn binding_trigger_input() {
let mut binding = MockBinding::default();
binding.trigger = 13;
let binding = MockBinding { trigger: 13, ..MockBinding::default() };
let mods = binding.mods;
let mode = binding.mode;
@ -1341,8 +1344,10 @@ mod tests {
#[test]
fn binding_trigger_mods() {
let mut binding = MockBinding::default();
binding.mods = ModifiersState::ALT | ModifiersState::LOGO;
let binding = MockBinding {
mods: ModifiersState::ALT | ModifiersState::LOGO,
..MockBinding::default()
};
let superset_mods = ModifiersState::all();
let subset_mods = ModifiersState::empty();
@ -1357,8 +1362,7 @@ mod tests {
#[test]
fn binding_trigger_modes() {
let mut binding = MockBinding::default();
binding.mode = BindingMode::ALT_SCREEN;
let binding = MockBinding { mode: BindingMode::ALT_SCREEN, ..MockBinding::default() };
let t = binding.trigger;
let mods = binding.mods;
@ -1370,8 +1374,7 @@ mod tests {
#[test]
fn binding_trigger_notmodes() {
let mut binding = MockBinding::default();
binding.notmode = BindingMode::ALT_SCREEN;
let binding = MockBinding { notmode: BindingMode::ALT_SCREEN, ..MockBinding::default() };
let t = binding.trigger;
let mods = binding.mods;

View File

@ -1118,8 +1118,7 @@ impl<N: Notify + OnResize> Processor<N> {
WindowEvent::Resized(size) => {
// Minimizing the window sends a Resize event with zero width and
// height. But there's no need to ever actually resize to this.
// Both WinPTY & ConPTY have issues when resizing down to zero size
// and back.
// ConPTY has issues when resizing down to zero size and back.
#[cfg(windows)]
if size.width == 0 && size.height == 0 {
return;

View File

@ -1255,8 +1255,10 @@ mod tests {
let mut terminal = Term::new(&cfg, size, MockEventProxy);
let mut mouse = Mouse::default();
mouse.click_state = $initial_state;
let mut mouse = Mouse {
click_state: $initial_state,
..Mouse::default()
};
let mut selection = None;

View File

@ -32,7 +32,6 @@ nix = "0.18.0"
signal-hook = { version = "0.1", features = ["mio-support"] }
[target.'cfg(windows)'.dependencies]
mio-named-pipes = "0.1"
miow = "0.3"
winapi = { version = "0.3.7", features = [
"impl-default", "basetsd", "libloaderapi", "minwindef", "ntdef", "processthreadsapi", "winbase",
@ -40,10 +39,6 @@ winapi = { version = "0.3.7", features = [
]}
mio-anonymous-pipes = "0.1"
# Winpty crate supports only MSVC.
[target.'cfg(all(target_os="windows", target_env="msvc"))'.dependencies]
winpty = { version = "0.2.0", optional = true }
[features]
default = []
bench = []

View File

@ -57,10 +57,6 @@ pub struct Config<T> {
/// Bell configuration.
bell: BellConfig,
#[cfg(windows)]
#[config(deprecated = "recompile with winpty feature or remove this setting")]
pub winpty_backend: bool,
#[config(deprecated = "use `bell` instead")]
pub visual_bell: Option<BellConfig>,
}

View File

@ -297,8 +297,6 @@ fn grow_reflow_multiline() {
assert_eq!(grid[2][Column(5)], cell('6'));
// Make sure rest of grid is empty.
// https://github.com/rust-lang/rust-clippy/issues/3788
#[allow(clippy::needless_range_loop)]
for r in 0..2 {
assert_eq!(grid[r].len(), 6);
for c in 0..6 {
@ -348,6 +346,8 @@ fn shrink_reflow_disabled() {
assert_eq!(grid[0][Column(1)], cell('2'));
}
// https://github.com/rust-lang/rust-clippy/pull/6375
#[allow(clippy::all)]
fn cell(c: char) -> Cell {
let mut cell = Cell::default();
cell.c = c;

View File

@ -1,190 +0,0 @@
//! Types to determine the appropriate PTY backend at runtime.
//!
//! Unless the winpty feature is disabled, the PTY backend will automatically fall back to
//! WinPTY when the newer ConPTY API is not supported, as long as the user hasn't explicitly
//! opted into the WinPTY config option.
use std::io::{self, Read, Write};
use log::info;
use mio::{Evented, Poll, PollOpt, Ready, Token};
use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite};
use mio_named_pipes::NamedPipe;
use crate::config::Config;
use crate::event::OnResize;
use crate::term::SizeInfo;
use super::{conpty, winpty, Pty};
pub fn new<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) -> Pty {
if let Some(pty) = conpty::new(config, size, window_id) {
info!("Using ConPTY backend");
pty
} else {
info!("Using WinPTY backend");
winpty::new(config, size, window_id)
}
}
pub enum PtyBackend {
Winpty(winpty::Agent),
Conpty(conpty::Conpty),
}
impl OnResize for PtyBackend {
fn on_resize(&mut self, size: &SizeInfo) {
match self {
PtyBackend::Winpty(w) => w.on_resize(size),
PtyBackend::Conpty(c) => c.on_resize(size),
}
}
}
// TODO: The ConPTY API currently must use synchronous pipes as the input
// and output handles. This has led to the need to support two different
// types of pipe.
//
// When https://github.com/Microsoft/console/issues/262 lands then the
// Anonymous variant of this enum can be removed from the codebase and
// everything can just use NamedPipe.
pub enum EventedReadablePipe {
Anonymous(EventedAnonRead),
Named(NamedPipe),
}
pub enum EventedWritablePipe {
Anonymous(EventedAnonWrite),
Named(NamedPipe),
}
impl Evented for EventedReadablePipe {
fn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt,
) -> io::Result<()> {
match self {
EventedReadablePipe::Anonymous(p) => p.register(poll, token, interest, opts),
EventedReadablePipe::Named(p) => p.register(poll, token, interest, opts),
}
}
fn reregister(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt,
) -> io::Result<()> {
match self {
EventedReadablePipe::Anonymous(p) => p.reregister(poll, token, interest, opts),
EventedReadablePipe::Named(p) => p.reregister(poll, token, interest, opts),
}
}
fn deregister(&self, poll: &Poll) -> io::Result<()> {
match self {
EventedReadablePipe::Anonymous(p) => p.deregister(poll),
EventedReadablePipe::Named(p) => p.deregister(poll),
}
}
}
impl Read for EventedReadablePipe {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
match self {
EventedReadablePipe::Anonymous(p) => p.read(buf),
EventedReadablePipe::Named(p) => p.read(buf),
}
}
}
impl Evented for EventedWritablePipe {
fn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt,
) -> io::Result<()> {
match self {
EventedWritablePipe::Anonymous(p) => p.register(poll, token, interest, opts),
EventedWritablePipe::Named(p) => p.register(poll, token, interest, opts),
}
}
fn reregister(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt,
) -> io::Result<()> {
match self {
EventedWritablePipe::Anonymous(p) => p.reregister(poll, token, interest, opts),
EventedWritablePipe::Named(p) => p.reregister(poll, token, interest, opts),
}
}
fn deregister(&self, poll: &Poll) -> io::Result<()> {
match self {
EventedWritablePipe::Anonymous(p) => p.deregister(poll),
EventedWritablePipe::Named(p) => p.deregister(poll),
}
}
}
impl Write for EventedWritablePipe {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
match self {
EventedWritablePipe::Anonymous(p) => p.write(buf),
EventedWritablePipe::Named(p) => p.write(buf),
}
}
fn flush(&mut self) -> io::Result<()> {
match self {
EventedWritablePipe::Anonymous(p) => p.flush(),
EventedWritablePipe::Named(p) => p.flush(),
}
}
}
impl From<winpty::Agent> for PtyBackend {
fn from(inner: winpty::Agent) -> Self {
PtyBackend::Winpty(inner)
}
}
impl From<conpty::Conpty> for PtyBackend {
fn from(inner: conpty::Conpty) -> Self {
PtyBackend::Conpty(inner)
}
}
impl From<EventedAnonRead> for EventedReadablePipe {
fn from(inner: EventedAnonRead) -> Self {
EventedReadablePipe::Anonymous(inner)
}
}
impl From<NamedPipe> for EventedReadablePipe {
fn from(inner: NamedPipe) -> Self {
EventedReadablePipe::Named(inner)
}
}
impl From<EventedAnonWrite> for EventedWritablePipe {
fn from(inner: EventedAnonWrite) -> Self {
EventedWritablePipe::Anonymous(inner)
}
}
impl From<NamedPipe> for EventedWritablePipe {
fn from(inner: NamedPipe) -> Self {
EventedWritablePipe::Named(inner)
}
}

View File

@ -6,10 +6,10 @@ use std::ptr;
use mio_anonymous_pipes::{EventedAnonRead, EventedAnonWrite};
use winapi::shared::basetsd::{PSIZE_T, SIZE_T};
use winapi::shared::minwindef::{BYTE, DWORD};
use winapi::shared::ntdef::{HANDLE, HRESULT, LPWSTR};
use winapi::shared::minwindef::BYTE;
use winapi::shared::ntdef::LPWSTR;
use winapi::shared::winerror::S_OK;
use winapi::um::libloaderapi::{GetModuleHandleA, GetProcAddress};
use winapi::um::consoleapi::{ClosePseudoConsole, CreatePseudoConsole, ResizePseudoConsole};
use winapi::um::processthreadsapi::{
CreateProcessW, InitializeProcThreadAttributeList, UpdateProcThreadAttribute,
PROCESS_INFORMATION, STARTUPINFOW,
@ -23,52 +23,9 @@ use crate::term::SizeInfo;
use crate::tty::windows::child::ChildExitWatcher;
use crate::tty::windows::{cmdline, win32_string, Pty};
// TODO: Replace with winapi's implementation. This cannot be
// done until a safety net is in place for versions of Windows
// that do not support the ConPTY api, as such versions will
// pass unit testing - but fail to actually function.
/// Dynamically-loaded Pseudoconsole API from kernel32.dll.
///
/// The field names are deliberately PascalCase as this matches
/// the defined symbols in kernel32 and also is the convention
/// that the `winapi` crate follows.
#[allow(non_snake_case)]
struct ConptyApi {
CreatePseudoConsole:
unsafe extern "system" fn(COORD, HANDLE, HANDLE, DWORD, *mut HPCON) -> HRESULT,
ResizePseudoConsole: unsafe extern "system" fn(HPCON, COORD) -> HRESULT,
ClosePseudoConsole: unsafe extern "system" fn(HPCON),
}
impl ConptyApi {
/// Load the API or None if it cannot be found.
pub fn new() -> Option<Self> {
// Unsafe because windows API calls.
unsafe {
let hmodule = GetModuleHandleA("kernel32\0".as_ptr() as _);
assert!(!hmodule.is_null());
let cpc = GetProcAddress(hmodule, "CreatePseudoConsole\0".as_ptr() as _);
let rpc = GetProcAddress(hmodule, "ResizePseudoConsole\0".as_ptr() as _);
let clpc = GetProcAddress(hmodule, "ClosePseudoConsole\0".as_ptr() as _);
if cpc.is_null() || rpc.is_null() || clpc.is_null() {
None
} else {
Some(Self {
CreatePseudoConsole: mem::transmute(cpc),
ResizePseudoConsole: mem::transmute(rpc),
ClosePseudoConsole: mem::transmute(clpc),
})
}
}
}
}
/// RAII Pseudoconsole.
pub struct Conpty {
pub handle: HPCON,
api: ConptyApi,
}
impl Drop for Conpty {
@ -77,20 +34,14 @@ impl Drop for Conpty {
// conout pipe has already been dropped by this point.
//
// See PR #3084 and https://docs.microsoft.com/en-us/windows/console/closepseudoconsole.
unsafe { (self.api.ClosePseudoConsole)(self.handle) }
unsafe { ClosePseudoConsole(self.handle) }
}
}
// The ConPTY handle can be sent between threads.
unsafe impl Send for Conpty {}
pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> Option<Pty> {
if config.winpty_backend {
return None;
}
let api = ConptyApi::new()?;
pub fn new<C>(config: &Config<C>, size: &SizeInfo) -> Option<Pty> {
let mut pty_handle = 0 as HPCON;
// Passing 0 as the size parameter allows the "system default" buffer
@ -105,7 +56,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) ->
// Create the Pseudo Console, using the pipes.
let result = unsafe {
(api.CreatePseudoConsole)(
CreatePseudoConsole(
coord,
conin_pty_handle.into_raw_handle(),
conout_pty_handle.into_raw_handle(),
@ -213,7 +164,7 @@ pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) ->
let conout = EventedAnonRead::new(conout);
let child_watcher = ChildExitWatcher::new(proc_info.hProcess).unwrap();
let conpty = Conpty { handle: pty_handle, api };
let conpty = Conpty { handle: pty_handle };
Some(Pty::new(conpty, conout, conin, child_watcher))
}
@ -226,7 +177,7 @@ fn panic_shell_spawn() {
impl OnResize for Conpty {
fn on_resize(&mut self, sizeinfo: &SizeInfo) {
if let Some(coord) = coord_from_sizeinfo(sizeinfo) {
let result = unsafe { (self.api.ResizePseudoConsole)(self.handle, coord) };
let result = unsafe { ResizePseudoConsole(self.handle, coord) };
assert_eq!(result, S_OK);
}
}

View File

@ -10,23 +10,12 @@ use crate::term::SizeInfo;
use crate::tty::windows::child::ChildExitWatcher;
use crate::tty::{ChildEvent, EventedPty, EventedReadWrite};
#[cfg(all(feature = "winpty", target_env = "msvc"))]
mod automatic_backend;
mod child;
mod conpty;
#[cfg(all(feature = "winpty", target_env = "msvc"))]
mod winpty;
#[cfg(not(all(feature = "winpty", target_env = "msvc")))]
use conpty::Conpty as Backend;
#[cfg(not(all(feature = "winpty", target_env = "msvc")))]
use mio_anonymous_pipes::{EventedAnonRead as ReadPipe, EventedAnonWrite as WritePipe};
#[cfg(all(feature = "winpty", target_env = "msvc"))]
use automatic_backend::{
EventedReadablePipe as ReadPipe, EventedWritablePipe as WritePipe, PtyBackend as Backend,
};
pub struct Pty {
// XXX: Backend is required to be the first field, to ensure correct drop order. Dropping
// `conout` before `backend` will cause a deadlock (with Conpty).
@ -39,14 +28,8 @@ pub struct Pty {
child_watcher: ChildExitWatcher,
}
#[cfg(not(all(feature = "winpty", target_env = "msvc")))]
pub fn new<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) -> Pty {
conpty::new(config, size, window_id).expect("Failed to create ConPTY backend")
}
#[cfg(all(feature = "winpty", target_env = "msvc"))]
pub fn new<C>(config: &Config<C>, size: &SizeInfo, window_id: Option<usize>) -> Pty {
automatic_backend::new(config, size, window_id)
pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> Pty {
conpty::new(config, size).expect("Failed to create ConPTY backend")
}
impl Pty {

View File

@ -1,70 +0,0 @@
use std::fs::OpenOptions;
use std::os::windows::fs::OpenOptionsExt;
use std::os::windows::io::{FromRawHandle, IntoRawHandle};
use std::u16;
use log::info;
use mio_named_pipes::NamedPipe;
use winapi::um::winbase::FILE_FLAG_OVERLAPPED;
use winpty::{Config as WinptyConfig, ConfigFlags, MouseMode, SpawnConfig, SpawnFlags, Winpty};
use crate::config::Config;
use crate::event::OnResize;
use crate::term::SizeInfo;
use crate::tty::windows::child::ChildExitWatcher;
use crate::tty::windows::{cmdline, Pty};
pub use winpty::Winpty as Agent;
pub fn new<C>(config: &Config<C>, size: &SizeInfo, _window_id: Option<usize>) -> Pty {
// Create config.
let mut wconfig = WinptyConfig::new(ConfigFlags::empty()).unwrap();
wconfig.set_initial_size(size.cols().0 as i32, size.screen_lines().0 as i32);
wconfig.set_mouse_mode(&MouseMode::Auto);
// Start agent.
let mut agent = Winpty::open(&wconfig).unwrap();
let (conin, conout) = (agent.conin_name(), agent.conout_name());
let cmdline = cmdline(&config);
// Spawn process.
let spawnconfig = SpawnConfig::new(
SpawnFlags::AUTO_SHUTDOWN | SpawnFlags::EXIT_AFTER_SHUTDOWN,
None, // appname.
Some(&cmdline),
config.working_directory.as_deref(),
None, // Env.
)
.unwrap();
let default_opts = &mut OpenOptions::new();
default_opts.share_mode(0).custom_flags(FILE_FLAG_OVERLAPPED);
let (conout_pipe, conin_pipe);
unsafe {
conout_pipe = NamedPipe::from_raw_handle(
default_opts.clone().read(true).open(conout).unwrap().into_raw_handle(),
);
conin_pipe = NamedPipe::from_raw_handle(
default_opts.clone().write(true).open(conin).unwrap().into_raw_handle(),
);
};
agent.spawn(&spawnconfig).unwrap();
let child_watcher = ChildExitWatcher::new(agent.raw_handle()).unwrap();
Pty::new(agent, conout_pipe, conin_pipe, child_watcher)
}
impl OnResize for Agent {
fn on_resize(&mut self, size: &SizeInfo) {
let (cols, lines) = (size.cols().0, size.screen_lines().0);
if cols > 0 && cols <= u16::MAX as usize && lines > 0 && lines <= u16::MAX as usize {
self.set_size(cols as u16, lines as u16)
.unwrap_or_else(|_| info!("Unable to set WinPTY size, did it die?"));
}
}
}