1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-29 21:44:24 +03:00

windows: speculative compile fix for termwiz

refs: #5020
This commit is contained in:
Wez Furlong 2024-05-04 17:15:35 -07:00
parent 2eac806d8c
commit 9070d4cb6d
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -29,7 +29,7 @@ impl WindowsConsoleRenderer {
} }
} }
fn to_attr_word(attr: &CellAttributes) -> u16 { fn to_attr_word(capabilities: &Capabilities, attr: &CellAttributes) -> u16 {
macro_rules! ansi_colors_impl { macro_rules! ansi_colors_impl {
($idx:expr, $default:ident, ($idx:expr, $default:ident,
$red:ident, $green:ident, $blue:ident, $red:ident, $green:ident, $blue:ident,
@ -82,7 +82,7 @@ fn to_attr_word(attr: &CellAttributes) -> u16 {
0 0
}; };
if attr.capabilities.color_level() == ColorLevel::MonoChrome { if capabilities.color_level() == ColorLevel::MonoChrome {
return reverse | underline; return reverse | underline;
} }
@ -314,7 +314,7 @@ impl WindowsConsoleRenderer {
dirty: false, dirty: false,
rows, rows,
cols, cols,
pending_attr: to_attr_word(&CellAttributes::default()), pending_attr: to_attr_word(&self.capabilities, &CellAttributes::default()),
}; };
for change in changes { for change in changes {
@ -324,7 +324,13 @@ impl WindowsConsoleRenderer {
.set_background(color.clone()) .set_background(color.clone())
.clone(); .clone();
buffer.fill(' ', to_attr_word(&attr), 0, 0, cols * rows); buffer.fill(
' ',
to_attr_word(&self.capabilities, &attr),
0,
0,
cols * rows,
);
buffer.set_cursor(0, 0, out)?; buffer.set_cursor(0, 0, out)?;
} }
Change::ClearToEndOfLine(color) => { Change::ClearToEndOfLine(color) => {
@ -334,7 +340,7 @@ impl WindowsConsoleRenderer {
buffer.fill( buffer.fill(
' ', ' ',
to_attr_word(&attr), to_attr_word(&self.capabilities, &attr),
buffer.cursor_x, buffer.cursor_x,
buffer.cursor_y, buffer.cursor_y,
cols.saturating_sub(buffer.cursor_x), cols.saturating_sub(buffer.cursor_x),
@ -347,14 +353,18 @@ impl WindowsConsoleRenderer {
buffer.fill( buffer.fill(
' ', ' ',
to_attr_word(&attr), to_attr_word(&self.capabilities, &attr),
buffer.cursor_x, buffer.cursor_x,
buffer.cursor_y, buffer.cursor_y,
cols * rows, cols * rows,
); );
} }
Change::Text(text) => { Change::Text(text) => {
buffer.write_text(&text, to_attr_word(&self.pending_attr), out)?; buffer.write_text(
&text,
to_attr_word(&self.capabilities, &self.pending_attr),
out,
)?;
} }
Change::CursorPosition { x, y } => { Change::CursorPosition { x, y } => {
let x = match x { let x = match x {