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
bootstrap collab: Add automatic install of minio deb or rpm to script/bootstrap (#32968) 2025-06-18 19:07:57 +00:00
bootstrap.ps1
build-docker
bump-extension-cli
bump-nightly
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
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
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
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
crate-dep-graph
create-draft-release
create-migration
debug-cli Add a small script to make debugging the CLI easier (#32971) 2025-06-18 19:24:16 +00:00
deploy-collab
deploy-postgrest
determine-release-channel
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
drop-test-dbs
exit-ci-if-dev-drive-is-full.ps1
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
get-crate-version
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
get-release-notes-since
get-released-version
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
import-themes
install-cmake
install-linux
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
language-extension-version
linux Show config messages from install-wild, install-mold (#38979) 2025-09-26 16:47:38 +00:00
metal-debug
mitm-proxy.sh
new-crate Centralize ZED_STATELESS (#37492) 2025-09-03 22:10:14 +00:00
prompts
randomized-test-ci
randomized-test-minimize
remote-server
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
setup-dev-driver.ps1
shellcheck-scripts
snap-build
snap-try
squawk ACP debug tools pane (#36768) 2025-08-22 19:32:49 +00:00
storybook
trigger-release
uninstall.sh
update-json-schemas
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
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
zed-local Fix script/zed-local on Windows (#38832) 2025-09-25 09:03:27 -04:00