Skip to content

Commit 4413deb

Browse files
author
Your Name
committed
fix(#155): stop forcing OutputRendering=Ansi, add strikethrough rendering
Issue #155: psmux was forcing $PSStyle.OutputRendering = 'Ansi' during PowerShell init, overriding the default 'Host' mode. This was a leftover from early development (commit 2c53984) when it was incorrectly believed to be needed for ConPTY. ConPTY correctly presents as a console host, so PowerShell's Host mode auto-detects ANSI capability without help. Removed the forced OutputRendering from all three PSReadLine init constants (PSRL_FIX, PSRL_CRASH_GUARD, PSRL_PRED_RESTORE). The actual crash guard for issue #109 only needs PredictionSource manipulation, not OutputRendering. Also fixed strikethrough (SGR 9) not rendering: the vt100-psmux parser already handled the attribute internally, but Cell lacked a strikethrough() accessor and rendering.rs never mapped it to Modifier::CROSSED_OUT.
1 parent 43dd68f commit 4413deb

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

crates/vt100-psmux/src/cell.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,11 @@ impl Cell {
190190
pub fn hidden(&self) -> bool {
191191
self.attrs.hidden()
192192
}
193+
194+
/// Returns whether the cell should be rendered with the strikethrough
195+
/// text attribute.
196+
#[must_use]
197+
pub fn strikethrough(&self) -> bool {
198+
self.attrs.strikethrough()
199+
}
193200
}

src/pane.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,6 @@ const ENV_SHIM_PS: &str = concat!(
612612
/// NullReferenceException in GetHistoryItems() during ConPTY startup.
613613
/// See https://github.com/psmux/psmux/issues/109
614614
const PSRL_FIX: &str = concat!(
615-
"$PSStyle.OutputRendering = 'Ansi'; ",
616615
"try { Set-PSReadLineOption -PredictionSource None -ErrorAction Stop } catch {}; ",
617616
"try { Set-PSReadLineOption -PredictionViewStyle InlineView -ErrorAction Stop } catch {}; ",
618617
"try { Remove-PSReadLineKeyHandler -Chord 'F2' -ErrorAction Stop } catch {}",
@@ -624,17 +623,15 @@ const PSRL_FIX: &str = concat!(
624623
/// at whatever the system default is. Used pre-profile when allow-predictions
625624
/// is on (#150).
626625
const PSRL_CRASH_GUARD: &str = concat!(
627-
"$PSStyle.OutputRendering = 'Ansi'; ",
628626
"$Global:__psmux_origPred = try { (Get-PSReadLineOption).PredictionSource } catch { 'History' }; ",
629627
"try { Set-PSReadLineOption -PredictionSource None -ErrorAction Stop } catch {}",
630628
);
631629

632630
/// Post-profile prediction restore: if PredictionSource is still None (meaning
633631
/// the user's profile did not explicitly set it), restore the saved original.
634-
/// If the profile DID set a value, we leave it alone. Also re-applies ANSI
635-
/// output rendering. Used post-profile when allow-predictions is on (#150).
632+
/// If the profile DID set a value, we leave it alone.
633+
/// Used post-profile when allow-predictions is on (#150).
636634
const PSRL_PRED_RESTORE: &str = concat!(
637-
"$PSStyle.OutputRendering = 'Ansi'; ",
638635
"if ((Get-PSReadLineOption).PredictionSource -eq 'None' -and $Global:__psmux_origPred -ne 'None') { ",
639636
"try { Set-PSReadLineOption -PredictionSource $Global:__psmux_origPred -ErrorAction Stop } catch {} ",
640637
"}",

src/rendering.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ pub fn render_node(
218218
if cell.inverse() { style = style.add_modifier(Modifier::REVERSED); }
219219
if cell.blink() { style = style.add_modifier(Modifier::SLOW_BLINK); }
220220
if cell.hidden() { style = style.add_modifier(Modifier::HIDDEN); }
221+
if cell.strikethrough() { style = style.add_modifier(Modifier::CROSSED_OUT); }
221222
let text = cell.contents().to_string();
222223
let w = UnicodeWidthStr::width(text.as_str()) as u16;
223224
if w == 0 {

0 commit comments

Comments
 (0)