wezterm: avoid repaint for blinking cursor when not focused

This takes CPU usage down to 0 when the window isn't focused.

refs: https://github.com/wez/wezterm/issues/200
This commit is contained in:
Wez Furlong committed 2020-05-30 12:29:04 -07:00
1 parent 5ed6324572
commit c44fa7659f
1 file changed
+2 -2
+2 -2
View File
@@ -616,12 +616,12 @@ impl TermWindow {
// If blinking is permitted, and the cursor shape is set
// to a blinking variant, and it's been longer than the
// blink rate interval, then invalid the lines in the terminal
// blink rate interval, then invalidate and redraw
// so that we will re-evaluate the cursor visibility.
// This is pretty heavyweight: it would be nice to only invalidate
// the line on which the cursor resides, and then only if the cursor
// is within the viewport.
if config.cursor_blink_rate != 0 {
if config.cursor_blink_rate != 0 && myself.focused.is_some() {
let shape = config
.default_cursor_style
.effective_shape(render.get_cursor_position().shape);