使用 tput 隐藏和取消隐藏光标

PSk*_*cik 18 terminal escape-characters tput

tput civis
Run Code Online (Sandbox Code Playgroud)

成功隐藏光标。

tput cvvis
Run Code Online (Sandbox Code Playgroud)

应该取消隐藏它,但它没有。

知道可能是什么问题吗?

Tho*_*key 12

在 ncurses终端数据库中cvvis按照 terminfo 手册页中的说明使用:

   cursor_visible            cvvis  vs   make cursor very
                                         visible
Run Code Online (Sandbox Code Playgroud)

如果normalvery visible之间没有区别,cvvis则通常会省略该功能。该功能用于curs_set

The curs_set routine sets the cursor state to invisible, normal, or very visible for visibility equal to 0, 1, or 2 respectively. If the terminal supports the visibility re-quested, the previous cursor state is returned; otherwise, ERR is returned.

The terminfo(5) manual page also says

If the cursor needs to be made more visible than normal when it is not on the bottom line (to make, for example, a non-blinking underline into an easier to find block or blinking underline) give this sequence as cvvis. If there is a way to make the cursor completely invisible, give that as civis. The capability cnorm should be given which undoes the effects of both of these modes.

一些终端描述可(错误地)等号cvviscnorm,因为一些emacs的配置假定cvvis总是设置。