Как изменить форму курсора в tty?

Используйте tcpdump для захвата потока:

tcpdump -i iface -s 1500 -w out.cap 'tcp and port xxx'

, где iface— сетевой интерфейс, а xxx— один из двух номеров портов.

Затем откройте out.capс помощью wireshark и посмотрите, что вы можете сделать из трассировки. Должно быть понятно, что там происходит. Если нет, опубликуйте еще раз.

FWIW, судя по вашим словам, это похоже на проблему с MTU.

0
19.01.2021, 05:26
2 ответа

См.https://www.kernel.org/doc/html/latest/admin-guide/vga-softcursor.html:

The cursor appearance is controlled by a ``<ESC>[?1;2;3c`` escape sequence
where 1, 2 and 3 are parameters described below. If you omit any of them,
they will default to zeroes.
first Parameter
        specifies cursor size::

                0=default
                1=invisible
                2=underline,
               ...
                8=full block
                + 16 if you want the software cursor to be applied
                + 32 if you want to always change the background color
                + 64 if you dislike having the background the same as the
                     foreground.

        Highlights are ignored for the last two flags.

second parameter
        selects character attribute bits you want to change
        (by simply XORing them with the value of this parameter). On standard
        VGA, the high four bits specify background and the low four the
        foreground. In both groups, low three bits set color (as in normal
        color codes used by the console) and the most significant one turns
        on highlight (or sometimes blinking -- it depends on the configuration
        of your VGA).

third parameter
        consists of character attribute bits you want to set.

        Bit setting takes place before bit toggling, so you can simply clear a
        bit by including it in both the set mask and the toggle mask.

Examples
--------

To get normal blinking underline, use::

        echo -e '\033[?2c'

To get blinking block, use::

        echo -e '\033[?6c'

To get red non-blinking block, use::

        echo -e '\033[?17;0;64c'
-1
18.03.2021, 22:36
printf '\033[?112c'

112(0x70)означает «программируемый блок-курсор»(0x10)+ «изменить фон»(0x20)+ «передний план отличается от фона»(0x40).

Это должно гарантировать, что курсор всегда будет виден, независимо от атрибутов символьной ячейки в этой позиции.

И если вы не хотите, чтобы vimили emacsсбрасывали курсор на «мигающее подчеркивание» по умолчанию при выходе, также сделайте это:

infocmp linux |
sed 's/cnorm=[^,]*/cnorm=\\033[25h\\033[?112c/' |
tic -

Этот экран также принимает еще два параметра, которые позволяют вам изменять цвет и атрибуты символьной ячейки (перед дифференцирующими преобразованиями fg/bg, упомянутыми выше ):второй указывает, какие биты должны быть установлены , а первый бит должен быть переключен , причем второй применяется до первого. Значение битов такое же, как у атрибутов VGA , а не у curses/цветов ANSI.Например, (при использовании палитры по умолчанию и т. д.):

# usage: set_cursor attributes
set_cursor(){ printf '\033[?112;%d;255c' "$((~$1 & 255))"; }
           # set + toggle = clear all bits except those present in the argument

set_cursor $((0x80  | 0x8   | 0x40   | 0x6     ))
           #  hi bg | hi fg | red bg | brown fg = "yellow" fg upon "pink" bg

Вместо того, чтобы пытаться разобраться в ответах stackexchange, лучше посмотрите исходный:add_softcursor()и\e[?cсинтаксический анализ.

0
18.03.2021, 22:36

Теги

Похожие вопросы