A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
fix(render): judge the cursor colour by what the program set
RoversX233177d9b327
diff --git a/wezterm-gui/src/termwindow/render/mod.rs b/wezterm-gui/src/termwindow/render/mod.rsindex e769fa37..bfc82ad8 100644--- a/wezterm-gui/src/termwindow/render/mod.rs+++ b/wezterm-gui/src/termwindow/render/mod.rs@@ -878,6 +878,10 @@ impl crate::TermWindow {{return configured;}+ // A cell on the default background has no alpha in a see-through+ // window; text drawn in its colour must still be opaque.+ let (r, g, b, _) = cell_background.tuple();+ let cell_background = LinearRgba::with_components(r, g, b, 1.);if cell_background.contrast_ratio(&cursor_background) >= MIN_CONTRAST {return cell_background;}@@ -1708,6 +1712,22 @@ mod cursor_colour_tests {assert_eq!(picked, dark, "the cell background is the readable fallback");}+ /// In a see-through window the default background reaches this with no+ /// alpha. Inverting into it must not draw the text fully transparent.+ #[test]+ fn the_inverted_text_stays_opaque_in_a_see_through_window() {+ let (r, g, b, _) = rgb(0x1e, 0x1e, 0x1e).tuple();+ let clear_dark = LinearRgba::with_components(r, g, b, 0.);++ let picked = TermWindow::block_cursor_text_color(+ rgb(0xff, 0xff, 0xff),+ clear_dark,+ rgb(0xee, 0xee, 0xee),+ false,+ );+ assert_eq!(picked, rgb(0x1e, 0x1e, 0x1e));+ }+/// A cursor that already reads keeps the colour the scheme asked for.#[test]fn a_readable_cursor_fg_is_left_alone() {diff --git a/wezterm-gui/src/termwindow/render/pane.rs b/wezterm-gui/src/termwindow/render/pane.rsindex 36b4249d..b755c096 100644--- a/wezterm-gui/src/termwindow/render/pane.rs+++ b/wezterm-gui/src/termwindow/render/pane.rs@@ -2166,8 +2166,13 @@ impl crate::TermWindow {let selection_bg = palette.selection_bg.to_linear();let cursor_fg = palette.cursor_fg.to_linear();let cursor_bg = palette.cursor_bg.to_linear();- let cursor_is_default_color =- palette.cursor_fg == global_cursor_fg && palette.cursor_bg == global_cursor_bg;+ // Settings applies its scheme -- the light one included -- to this+ // window rather than to the global palette compared here, so a pane+ // can differ from it with no program involved. Only a palette the+ // program set itself (OSC 12 and friends) means it chose the cursor.+ let cursor_is_default_color = (palette.cursor_fg == global_cursor_fg+ && palette.cursor_bg == global_cursor_bg)+ || pos.pane.palette_override().is_none();{// A smooth scroll cuts the top row off by `scroll_px`, which