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

[WIP] Add ncurses_cursor ui_options. #1393

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+17 −1
Diff settings

Always

Just for now

Copy path View file
@@ -304,6 +304,8 @@ void register_options()
"The ncurses ui supports the following options:\n"
"<key>: <value>:\n"
" ncurses_assistant clippy|cat|dilbert|none|off\n"
" ncurses_cursor block|ibeam|underline\n"
" ncurses_cursor_blink bool\n"
" ncurses_status_on_top bool\n"
" ncurses_set_title bool\n"
" ncurses_enable_mouse bool\n"
Copy path View file
@@ -1039,7 +1039,7 @@ void NCursesUI::enable_mouse(bool enabled)
fflush(stdout);
}

void NCursesUI::set_ui_options(const Options& options)
void NCursesUI::set_ui_options(const Options& options) // TODO: no add operation for type str-to-str-map
{
{
auto it = options.find("ncurses_assistant"_sv);
@@ -1053,6 +1053,20 @@ void NCursesUI::set_ui_options(const Options& options)
m_assistant = ConstArrayView<StringView>{};
}

{
auto cursor_blink_it = options.find("ncurses_cursor_blink"_sv);
int blink = cursor_blink_it == options.end() or
(cursor_blink_it->value == "yes" or cursor_blink_it->value == "true") ?
1 : 0;
auto it = options.find("ncurses_cursor"_sv);
if (it == options.end() or it->value == "block")
printf("\x1b[%u q", 2 - blink); // TODO: try and reset when quitting kak
else if (it->value == "ibeam")
printf("\x1b[%u q", 6 - blink);
else if (it->value == "underline")
printf("\x1b[%u q", 4 - blink); // TODO: m_status_on_top = false, cursor not visible
}

{
auto it = options.find("ncurses_status_on_top"_sv);
m_status_on_top = it != options.end() and
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.