ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
6.94k stars 418 forks source link

Custom cursor control #358

Closed jas777 closed 1 year ago

jas777 commented 2 years ago

Hello, is there a way to add a blinking cursor to the screen without a text input?

ArthurSonzogni commented 2 years ago

Note: You might want to try to use the blink decorator to make some elements to blink: https://arthursonzogni.com/FTXUI/doc/namespaceftxui.html#ad57613de5895e774218d91dea48d074b


Does the Input component use a blinking cursor? I don't believe this is currently the case. We just invert the cursor.


This issue seems somehow related to: https://github.com/ArthurSonzogni/FTXUI/issues/267

You may want to check what happens when you remove the line: https://github.com/ArthurSonzogni/FTXUI/blob/master/src/ftxui/component/screen_interactive.cpp#L447

From what I have tried, terminal emulators aren't consistent about where the "blinking" cursor is shown. So using this feature is problematic, because this would create inconsistent applications.

ArthurSonzogni commented 1 year ago

This has been implemented. See the following API:

Element focusCursorBlock(Element);
Element focusCursorBlockBlinking(Element);
Element focusCursorBar(Element);
Element focusCursorBarBlinking(Element);
Element focusCursorUnderline(Element);
Element focusCursorUnderlineBlinking(Element);

See example: https://arthursonzogni.github.io/FTXUI/examples/?file=component/focus_cursor