1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00

fix force_reverse_video_cursor

This commit is contained in:
Wez Furlong 2021-06-28 09:18:13 -07:00
parent 5044fcb98b
commit e05ddb1737
2 changed files with 29 additions and 21 deletions

View File

@ -49,6 +49,7 @@ As features stabilize some brief notes about them will accumulate here.
* Fixed: click to focus now focuses the pane under the mouse cursor [#881](https://github.com/wez/wezterm/issues/881)
* Removed: `Parasio Dark` color scheme; it was a duplicate of the correctly named `Paraiso Dark` scheme. Thanks to [@adrian5](https://github.com/adrian5)! [#906](https://github.com/wez/wezterm/pull/906)
* Fixed: key repeat on Wayland now respects the system specified key repeat rate, and doesn't "stick". [#669](https://github.com/wez/wezterm/issues/669)
* Fixed: `force_reverse_video_cursor` wasn't correctly swapping the cursor colors in all cases. [#706](https://github.com/wez/wezterm/issues/706)
### 20210502-154244-3f7122cb

View File

@ -191,12 +191,7 @@ impl super::TermWindow {
let mut quads = gl_state.quads.map(&mut vb);
log::trace!("quad map elapsed {:?}", start.elapsed());
let cursor_border_color =
rgbcolor_to_window_color(if self.config.force_reverse_video_cursor {
palette.foreground
} else {
palette.cursor_border
});
let cursor_border_color = rgbcolor_to_window_color(palette.cursor_border);
let foreground = rgbcolor_to_window_color(palette.foreground);
if self.show_tab_bar && pos.index == 0 {
@ -320,16 +315,8 @@ impl super::TermWindow {
let start = Instant::now();
let selection_fg = rgbcolor_to_window_color(palette.selection_fg);
let selection_bg = rgbcolor_to_window_color(palette.selection_bg);
let cursor_fg = rgbcolor_to_window_color(if self.config.force_reverse_video_cursor {
palette.background
} else {
palette.cursor_fg
});
let cursor_bg = rgbcolor_to_window_color(if self.config.force_reverse_video_cursor {
palette.foreground
} else {
palette.cursor_bg
});
let cursor_fg = rgbcolor_to_window_color(palette.cursor_fg);
let cursor_bg = rgbcolor_to_window_color(palette.cursor_bg);
for (line_idx, line) in lines.iter().enumerate() {
let stable_row = stable_top + line_idx as StableRowIndex;
@ -949,7 +936,11 @@ impl super::TermWindow {
.cursor_sprite(cursor_shape)
.texture_coords(),
);
quad.set_cursor_color(params.cursor_border_color);
quad.set_cursor_color(if self.config.force_reverse_video_cursor {
bg_color
} else {
params.cursor_border_color
});
}
}
}
@ -1013,7 +1004,11 @@ impl super::TermWindow {
.cursor_sprite(cursor_shape)
.texture_coords(),
);
quad.set_cursor_color(params.cursor_border_color);
quad.set_cursor_color(if self.config.force_reverse_video_cursor {
bg_color
} else {
params.cursor_border_color
});
}
}
}
@ -1066,7 +1061,11 @@ impl super::TermWindow {
.cursor_sprite(cursor_shape)
.texture_coords(),
);
quad.set_cursor_color(params.cursor_border_color);
quad.set_cursor_color(if self.config.force_reverse_video_cursor {
bg_color
} else {
params.cursor_border_color
});
Ok(())
}
@ -1147,7 +1146,11 @@ impl super::TermWindow {
.cursor_sprite(cursor_shape)
.texture_coords(),
);
quad.set_cursor_color(params.cursor_border_color);
quad.set_cursor_color(if self.config.force_reverse_video_cursor {
bg_color
} else {
params.cursor_border_color
});
Ok(())
}
@ -1210,7 +1213,11 @@ impl super::TermWindow {
// Cursor cell overrides colors
(_, true, CursorShape::BlinkingBlock, CursorVisibility::Visible)
| (_, true, CursorShape::SteadyBlock, CursorVisibility::Visible) => {
(params.cursor_fg, params.cursor_bg)
if self.config.force_reverse_video_cursor {
(params.bg_color, params.fg_color)
} else {
(params.cursor_fg, params.cursor_bg)
}
}
// Normally, render the cell as configured (or if the window is unfocused)
_ => (params.fg_color, params.bg_color),