From 44c801d2b5bd104f67c63d3d86174c91f38e7529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 5 Jul 2026 05:10:04 +0200 Subject: [PATCH] fix(build): protect use of Termcode when term features is not set (#15703) Fixes cargo check -p helix-view (no --features term). --- helix-view/src/clipboard.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs index 918b15b1..7076bdfb 100644 --- a/helix-view/src/clipboard.rs +++ b/helix-view/src/clipboard.rs @@ -147,8 +147,14 @@ mod external { Self::Termux } else if env_var_is_set("TMUX") && binary_exists("tmux") { Self::Tmux - } else if env_var_is_set("WEZTERM_UNIX_SOCKET") && binary_exists("wezterm") { - Self::Termcode + } else if cfg!(feature = "term") + && env_var_is_set("WEZTERM_UNIX_SOCKET") + && binary_exists("wezterm") + { + #[cfg(feature = "term")] + return Self::Termcode; + #[cfg(not(feature = "term"))] + return Self::None; } else if env_var_is_set("WAYLAND_DISPLAY") && binary_exists("wl-copy") && binary_exists("wl-paste") @@ -164,10 +170,11 @@ mod external { Self::XSel } else if binary_exists("win32yank.exe") { Self::Win32Yank - } else if cfg!(feature = "term") { - Self::Termcode } else { - Self::None + #[cfg(feature = "term")] + return Self::Termcode; + #[cfg(not(feature = "term"))] + return Self::None; } } } -- 2.51.2