From 4e783b3920a49dabcac5496bd67b7cf87bd41aaa Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Sat, 20 Apr 2019 20:18:40 +0100 Subject: [PATCH] make cursor visible when setting shape to default If the cursor has been made invisible (by setting the shape to `Hidden`), then in order for it to be visible when it is reset to the default shape, it must be made visible. This can be done by rendering the `CursorVisible` sequence. Where supported, the `CursorNormal` sequence can be rendered to do both `CursorVisible` and `ResetCursorStyle` in one go. --- termwiz/src/render/terminfo.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/termwiz/src/render/terminfo.rs b/termwiz/src/render/terminfo.rs index a37ce4739..9c64c2e15 100644 --- a/termwiz/src/render/terminfo.rs +++ b/termwiz/src/render/terminfo.rs @@ -524,8 +524,15 @@ impl TerminfoRenderer { } Change::CursorShape(shape) => match shape { CursorShape::Default => { - if let Some(reset) = self.get_capability::() { - reset.expand().to(out.by_ref())?; + if let Some(normal) = self.get_capability::() { + normal.expand().to(out.by_ref())?; + } else { + if let Some(show) = self.get_capability::() { + show.expand().to(out.by_ref())?; + } + if let Some(reset) = self.get_capability::() { + reset.expand().to(out.by_ref())?; + } } } CursorShape::Hidden => {