Почему курсор перестает мигать, когда окно не в фокусе?

828
Bleeding Fingers

Я видел это как в Linux (Ubuntu 13.10), так и в Windows (7), когда окно (редактор, браузер, терминал и т. Д.), Содержащее текстовое поле с мигающим курсором, выходит из фокуса, курсор перестает мигать.

Почему это так? Некоторые детали внутреннего процесса ( как ) это будет оценено.

0

1 ответ на вопрос

0
Ƭᴇcʜιᴇ007

The blinking one is the prompt that is ready for input (because it's in the foreground).

It's a visual cue so you know which command box your input will go to.

More info from Wikipedia:

In most command-line interfaces or text editors, the text cursor or caret navigation, is an underscore, a solid rectangle, or a vertical line, which may be flashing or steady, indicating where text will be placed when entered (the insertion point).

and

The blinking of the text cursor is usually temporarily suspended when it is being moved; otherwise, the cursor may change position when it is not visible, making its location difficult to follow.

As to "How" it's implemented, that would depend on the command line interface being used, and will probably vary from vendor to vendor, and many of those vendors are closed-source.

Often the cursor appearance is also affected/controlled by the video adapter, but generally only in true video text modes.

If I were to implement my own, I'd image a timer that toggles the cursor's visibility state would be used, and that timer would be suspended when the window loses focus (perhaps also setting the state in not-visible), and started again when focus returns. But that's simplifying the crap out of it. ;)

Интерпретаторы команд не имеют ничего общего с реализациями либо GUI-каретки, либо курсоров TUI. JdeBP 10 лет назад 0
@JdeBP плохой выбор слов. Исправлена. Ƭᴇcʜιᴇ007 10 лет назад 0

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