zed/script
Jakub Konka 8af3f583c2
Better conpty (#39090)
Closes #22657
Closes #37863

# Background

Several users have noted that the terminal shipped with Zed on Windows
is either misbehaving or missing several features including lack of
consistent clearing behaviour. After some investigation which included
digging into the Microsoft Terminal project and VSCode editor, it turns
out that the pseudoconsole provided by Windows OS is severely outdated
which manifests itself in problems such as lack of clearing behaviour,
etc. Interestingly however, neither MS Terminal nor VSCode exhibit this
limitation so the question was why. Enter custom `conpty.dll` and
`OpenConsole.exe` runtime. These are updated, developed in MS Terminal
tree subprojects that aim to replace native Windows API as well as
augment the `conhost.exe` process that runs by default in Windows. They
also fix all the woes we had with the terminal on Windows (there is a
chance that ctrl-c behaviour is also fixed with these, but still need to
double check that this is indeed the case). This PR ensures that Zed
also benefits from the update pseudoconsole API.

# Proposed approach

It is possible to fork MS Terminal and instrument the necessary
subprojects for Rust-awareness (using `cc-rs` or otherwise to compile
the C++ code and then embed it in Rust-produced binaries for easier
inclusion in projects) but it comes at a cost of added complexity,
maintenance burden, etc. An alternative approach was proposed by
@reflectronic to download the binary from the official Nuget repo and
bundle it for release/local use. This PR aims to do just that.

There are two bits to this PR:
1. ~~when building Zed locally, and more specifically, when the `zed`
crate is being built, we will strive to download and unpack the binaries
into `OUT_DIR` provided by `cargo`. We will then set
`ZED_CONPTY_INSTALL_PATH=${OUT_DIR}/conpty` and use it at runtime in Zed
binary to tweak the loader's search path with that additional path. This
effectively ensures that Zed built from source on Windows has full
terminal support.~~ EDIT: after several discussions offline, we've
decided that keeping it minimal will serve us best, meaning: when
developing locally it is up to the developer of Zed to install
`conpty.dll` and put it in the loader's search path.
2. when bundling Windows release, we will download and unpack the nuget
package into Zed's bundle which will ensure it is installed in the same
directory as Zed by the installer.

**Note** I realise that 1. may actually not be needed - instead we could
leave that bit for the user who wants to run Zed from source to ensure
that they have `conpty.dll` in the loader's search path. I'd love to
hear opinions on this!

Release Notes:

- N/A

---------

Co-authored-by: Cole Miller <cole@zed.dev>
2025-09-29 22:08:35 +02:00
..
danger Bump pnpm dependencies (#37258) 2025-08-31 10:19:12 +00:00
flatpak Add (flatpak) and (snap) suffixes to Zed version in system info (#32903) 2025-06-17 20:39:35 +00:00
issue_response Bump pnpm dependencies (#37258) 2025-08-31 10:19:12 +00:00
lib filter out comments in deploy helper env vars (#35847) 2025-08-07 18:01:46 -07:00
licenses Make script/generate-license fail on WARN too (#34008) 2025-07-07 13:56:53 -04:00
terms Legal Terms: May 6th 2025 update (#30151) 2025-05-07 17:14:02 +00:00
update_top_ranking_issues Remove duplicate issues in top-ranking issues script (#33127) 2025-06-20 17:13:26 -04:00
analyze_highlights.py ci: Add shellcheck for scripts (#20631) 2024-11-18 16:41:22 -05:00
bootstrap collab: Add automatic install of minio deb or rpm to script/bootstrap (#32968) 2025-06-18 19:07:57 +00:00
bootstrap.ps1 windows: Make collab run on Windows (#23117) 2025-01-17 09:39:13 +02:00
build-docker Support More Linux (#18480) 2024-09-30 17:46:21 -04:00
bump-extension-cli Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
bump-nightly Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
bump-zed-minor-versions Fix markdown list in bump-zed-minor-versions (#38515) 2025-09-19 16:11:19 +00:00
bump-zed-patch-version Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
bundle-freebsd linux: Make desktop file executable (#35597) 2025-08-04 15:35:19 -04:00
bundle-linux linux: Make desktop file executable (#35597) 2025-08-04 15:35:19 -04:00
bundle-mac Ensure we have the targets needed for bundling (#38688) 2025-09-23 03:51:03 +00:00
bundle-windows.ps1 Better conpty (#39090) 2025-09-29 22:08:35 +02:00
check-keymaps Add CI check that cmd- is not in linux keymaps + check other mods (#32334) 2025-06-08 09:34:07 +00:00
check-licenses Change license of crates/livekit_api from AGPL to GPL (#25206) 2025-02-19 23:32:51 +00:00
check-links ci: Restore lychee link check. Only validate internal links (#32463) 2025-06-10 11:20:07 -04:00
check-todos Add CI check that cmd- is not in linux keymaps + check other mods (#32334) 2025-06-08 09:34:07 +00:00
clear-target-dir-if-larger-than Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
clear-target-dir-if-larger-than.ps1 windows: Publish nightly (#24800) 2025-07-09 08:57:03 +08:00
clippy Run additional checks from script/clippy if local (#29768) 2025-05-02 01:26:12 +00:00
clippy.ps1 Windows tests on self-hosted runners (#29764) 2025-06-16 17:29:36 -04:00
collab-flamegraph Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
crate-dep-graph Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
create-draft-release Use our own git clone in draft release notes (#20956) 2024-11-21 11:55:22 -07:00
create-migration remoting (#9680) 2024-03-22 08:44:56 -06:00
debug-cli Add a small script to make debugging the CLI easier (#32971) 2025-06-18 19:24:16 +00:00
deploy-collab Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
deploy-postgrest Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
determine-release-channel Fix bad quote in script/determine-release-channel (#20613) 2024-11-13 12:41:50 -05:00
determine-release-channel.ps1 windows: Publish nightly (#24800) 2025-07-09 08:57:03 +08:00
digital-ocean-db.sh Add a script to connect to the database. (#32023) 2025-06-04 09:23:23 -06:00
draft-release-notes Use our own git clone in draft release notes (#20956) 2024-11-21 11:55:22 -07:00
drop-test-dbs Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
exit-ci-if-dev-drive-is-full.ps1 windows: Fix tests on Windows (#22616) 2025-02-05 14:30:09 +00:00
freebsd Add initial FreeBSD script & installation doc (#30981) 2025-06-06 23:14:25 +00:00
generate-licenses Bump Rust to 1.90 (#38436) 2025-09-22 14:36:10 -07:00
generate-licenses-csv Bump Rust to 1.90 (#38436) 2025-09-22 14:36:10 -07:00
generate-licenses.ps1 Bump Rust to 1.90 (#38436) 2025-09-22 14:36:10 -07:00
generate-terms-rtf Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
get-crate-version Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
get-crate-version.ps1 windows: Publish nightly (#24800) 2025-07-09 08:57:03 +08:00
get-preview-channel-changes Fetch all staff in get-preview-channel-changes script (#37940) 2025-09-10 20:05:51 +00:00
get-pull-requests-since Add a get-release-notes-since script (#18445) 2024-09-27 10:59:19 -04:00
get-release-notes-since Add a get-release-notes-since script (#18445) 2024-09-27 10:59:19 -04:00
get-released-version Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
get-stable-channel-release-notes Add get stable channel release notes script (#36969) 2025-08-26 23:35:29 +00:00
github-pr-status A script to help with PR naggery (#32025) 2025-06-04 09:23:14 -06:00
histogram Print error message and skip line 2024-01-23 16:52:08 +01:00
import-themes Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
install-cmake Improve install-cmake script (#20836) 2024-11-18 16:39:57 -05:00
install-linux linux scripts: Respect $CARGO_TARGET_DIR (#13830) 2024-07-05 14:19:05 +03:00
install-mold Show config messages from install-wild, install-mold (#38979) 2025-09-26 16:47:38 +00:00
install-rustup.ps1 Windows tests on self-hosted runners (#29764) 2025-06-16 17:29:36 -04:00
install-wild Show config messages from install-wild, install-mold (#38979) 2025-09-26 16:47:38 +00:00
install.sh Use TMPDIR environment variable in install script (#35636) 2025-08-08 05:05:56 +00:00
kube-shell Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
language-extension-version Add text objects to extensions (#21488) 2024-12-03 13:56:25 -07:00
linux Show config messages from install-wild, install-mold (#38979) 2025-09-26 16:47:38 +00:00
metal-debug Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
mitm-proxy.sh Improve script/mitm-proxy.sh to support podman (#25834) 2025-02-28 22:37:03 +00:00
new-crate Centralize ZED_STATELESS (#37492) 2025-09-03 22:10:14 +00:00
prompts Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
randomized-test-ci Remove ZED_CLIENT_SECRET_TOKEN 2024-01-23 10:34:43 -07:00
randomized-test-minimize Format scripts with Prettier (#8393) 2024-02-25 11:03:33 -05:00
remote-server Add remote server cross compilation (#19136) 2024-10-12 23:23:56 -07:00
reset_db Fix reset_db script (#29067) 2025-04-18 19:28:14 +00:00
run-local-minio collab: Add automatic install of minio deb or rpm to script/bootstrap (#32968) 2025-06-18 19:07:57 +00:00
seed-db Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
setup-dev-driver.ps1 windows: Use dev drive instead of ReFS (#25858) 2025-03-01 22:43:10 +08:00
shellcheck-scripts ci: Add shellcheck for scripts (#20631) 2024-11-18 16:41:22 -05:00
snap-build Add scripts and configuration for building snap package (#25064) 2025-02-19 10:28:23 -07:00
snap-try Add scripts and configuration for building snap package (#25064) 2025-02-19 10:28:23 -07:00
squawk ACP debug tools pane (#36768) 2025-08-22 19:32:49 +00:00
storybook Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
trigger-release Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
uninstall.sh Add an uninstall script (#21213) 2024-11-28 10:31:12 +02:00
update-json-schemas Bump JSON schemas: package.json, tsconfig.json (#20910) 2024-11-20 13:35:00 -05:00
update-workspace-hack Add workspace-hack (#27277) 2025-04-02 13:26:34 -07:00
update-workspace-hack.ps1 windows: Add update-workspace-hack.ps1 script (#28219) 2025-04-07 21:26:26 +08:00
upload-extension-cli Add GitHub Action for publishing the extension CLI (#9542) 2024-03-19 14:19:32 -04:00
upload-nightly freebsd: Improve nightly builds of zed-remote-server (#32255) 2025-06-06 15:30:03 +00:00
upload-nightly.ps1 windows: Publish nightly (#24800) 2025-07-09 08:57:03 +08:00
what-is-deployed Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
zed-local Fix script/zed-local on Windows (#38832) 2025-09-25 09:03:27 -04:00