Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnableBlinking and DisableBlinking don't work in the GNOME terminal #650

Closed
Cl00e9ment opened this issue Apr 9, 2022 · 4 comments
Closed

Comments

@Cl00e9ment
Copy link
Contributor

Describe the bug
EnableBlinking and DisableBlinking don't work in the GNOME terminal.

Proposition
The control sequences for enabling/disabling blinking (\x1b[?12h and \x1b[?12l) don't seem to work in some terminals, however the control sequences that set the shape and the blinking state at the same time (\x1b[x q, with x an integer) are working.

Also, SetCursorShape modify the blinking state with an hard-coded value (block is steady, and underline and line are blinking).

Since the EnableBlinking and DisableBlinking commands are not working in some terminals and that SetCursorShape modify the blinking state with an hard-coded value, why not choosing the cursor shape and blinking state at the same time and making: EnableBlinking, DisableBlinking and SetCursorShape deprecated?

We can imagine a SetCursorStyle command that look like this:

pub struct SetCursorStyle(pub CursorStyle);

impl Command for SetCursorStyle {
    fn write_ansi(&self, f: &mut impl fmt::Write) -> fmt::Result {
        use CursorStyle::*;
        match self.0 {
            BlinkingBlock => f.write_str("\x1b[?12h\x1b[0 q"),
            SteadyBlock => f.write_str("\x1b[?12l\x1b[2 q"),
            BlinkingUnderScore => f.write_str("\x1b[?12h\x1b[3 q"),
            SteadyUnderScore => f.write_str("\x1b[?12l\x1b[4 q"),
            BlinkingBar => f.write_str("\x1b[?12h\x1b[5 q"),
            SteadyBar => f.write_str("\x1b[?12l\x1b[6 q"),
        }
    }

    #[cfg(windows)]
    fn execute_winapi(&self) -> Result<()> {
        Ok(())
    }
}

Note that I'm using the \x1b[?12h and \x1b[?12l control sequences as a fail-over, in case \x1b[x q isn't supported.
If you think that it's a good idea, I can make the PR.

OS

  • Manjaro Linux

Terminal/Console

  • GNOME Terminal 3.42.2 for GNOME 41
@peepo5
Copy link

peepo5 commented Apr 25, 2022

Can confirm.

@ghost
Copy link

ghost commented Jan 9, 2023

I think that such a pull request would be very welcome. I'm having a similar problem using Konsole on KDE.

@TimonPost
Copy link
Member

Yes this would be a nice to have. Little redundancy in ESC[?12h for blinking and then using ESC [ _n_ SP q for an other type of blinking could perhaps assure that blinking happens.

@TimonPost
Copy link
Member

Fixed by: #742

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants