Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Better conpty (#39090)

Jakub Konka8af3f583c277
diff --git a/Cargo.lock b/Cargo.lock
index 4c41ad427d3..a79d0971db2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4111,9 +4111,9 @@ dependencies = [
[[package]]
name = "crc"
-version = "3.2.1"
+version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
+checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
dependencies = [
"crc-catalog",
]
@@ -14573,9 +14573,9 @@ checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
[[package]]
name = "sha2"
-version = "0.10.8"
+version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
dependencies = [
"cfg-if",
"cpufeatures",
@@ -20347,6 +20347,7 @@ dependencies = [
"web_search",
"web_search_providers",
"windows 0.61.1",
+ "windows-sys 0.61.0",
"winresource",
"workspace",
"workspace-hack",
diff --git a/Cargo.toml b/Cargo.toml
index 3d84e6bc06f..d23d3b08970 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -714,6 +714,7 @@ wasmtime = { version = "29", default-features = false, features = [
wasmtime-wasi = "29"
which = "6.0.0"
windows-core = "0.61"
+windows-sys = "0.61"
wit-component = "0.221"
workspace-hack = "0.1.0"
yawc = "0.2.5"
diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml
index 5dfdfd7bf2d..69402cc9087 100644
--- a/crates/zed/Cargo.toml
+++ b/crates/zed/Cargo.toml
@@ -170,6 +170,7 @@ zlog_settings.workspace = true
[target.'cfg(target_os = "windows")'.dependencies]
windows.workspace = true
+windows-sys.workspace = true
[target.'cfg(target_os = "windows")'.build-dependencies]
winresource = "0.1"
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index 2f132b27af3..8dd5d8b1d61 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -259,6 +259,9 @@ pub fn main() {
.unwrap_or("unknown"),
);
+ #[cfg(windows)]
+ check_for_conpty_dll();
+
let app = Application::new().with_assets(Assets);
let system_id = app.background_executor().block(system_id()).ok();
@@ -1514,3 +1517,12 @@ fn dump_all_gpui_actions() {
)
.unwrap();
}
+
+#[cfg(windows)]
+fn check_for_conpty_dll() {
+ use windows_sys::{Win32::System::LibraryLoader::LoadLibraryW, w};
+ let hmodule = unsafe { LoadLibraryW(w!("conpty.dll")) };
+ if hmodule.is_null() {
+ log::warn!("Failed to load conpty.dll. Terminal will work with reduced functionality.");
+ }
+}
diff --git a/script/bundle-windows.ps1 b/script/bundle-windows.ps1
index a26abf8413f..7fa7771e720 100644
--- a/script/bundle-windows.ps1
+++ b/script/bundle-windows.ps1
@@ -146,6 +146,14 @@ function DownloadAMDGpuServices {
Expand-Archive -Path $zipPath -DestinationPath "." -Force
}
+function DownloadConpty {
+ # If you update the Conpty version, please also update the version in `crates/zed/build.rs`.
+ $url = "https://www.nuget.org/api/v2/package/CI.Microsoft.Windows.Console.ConPTY/1.22.250314001"
+ $zipPath = ".\conpty.zip"
+ Invoke-WebRequest -Uri $url -OutFile $zipPath
+ Expand-Archive -Path $zipPath -DestinationPath ".\conpty" -Force
+}
+
function CollectFiles {
Move-Item -Path "$innoDir\zed_explorer_command_injector.appx" -Destination "$innoDir\appx\zed_explorer_command_injector.appx" -Force
Move-Item -Path "$innoDir\zed_explorer_command_injector.dll" -Destination "$innoDir\appx\zed_explorer_command_injector.dll" -Force
@@ -153,6 +161,8 @@ function CollectFiles {
Move-Item -Path "$innoDir\zed.sh" -Destination "$innoDir\bin\zed" -Force
Move-Item -Path "$innoDir\auto_update_helper.exe" -Destination "$innoDir\tools\auto_update_helper.exe" -Force
Move-Item -Path ".\AGS_SDK-6.3.0\ags_lib\lib\amd_ags_x64.dll" -Destination "$innoDir\amd_ags_x64.dll" -Force
+ Move-Item -Path ".\conpty\build\native\runtimes\*" -Destination "$innoDir\bin" -Force
+ Move-Item -Path ".\conpty\runtimes\win10-x64\native\conpty.dll" -Destination "$innoDir\bin\conpty.dll" -Force
}
function BuildInstaller {
@@ -280,6 +290,7 @@ MakeAppx
SignZedAndItsFriends
ZipZedAndItsFriendsDebug
DownloadAMDGpuServices
+DownloadConpty
CollectFiles
BuildInstaller