Skip to content

Commit bc9dd1a

Browse files
committed
Merge remote-tracking branch 'Yukaii/feature/native-cursor'
2 parents 767a7df + 0d20aea commit bc9dd1a

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

doc/pages/options.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ are exclusively available to built-in options.
385385
set the maximum allowable width of an info box. set to zero for
386386
no limit.
387387

388+
*terminal_cursor_native*:::
389+
if *yes* or *true*, use native terminal cursor visibility control
390+
instead of Kakoune's cursor management (defaults to *false*)
391+
388392
[[startup-info]]
389393
*startup_info_version* `int`::
390394
_default_ 0 +

src/main.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ void register_options()
604604
" terminal_shift_function_key int\n"
605605
" terminal_padding_char codepoint\n"
606606
" terminal_padding_fill bool\n"
607+
" terminal_cursor_native bool\n"
607608
" terminal_info_max_width int\n",
608609
UserInterface::Options{});
609610
reg.declare_option("modelinefmt", "format string used to generate the modeline",

src/terminal_ui.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,6 +1574,13 @@ void TerminalUI::set_ui_options(const Options& options)
15741574

15751575
m_padding_char = find("terminal_padding_char").map([](StringView s) { return s.column_length() < 1 ? ' ' : s[0_char]; }).value_or(Codepoint{'~'});
15761576
m_padding_fill = find("terminal_padding_fill").map(to_bool).value_or(false);
1577+
1578+
bool new_cursor_native = find("terminal_cursor_native").map(to_bool).value_or(false);
1579+
if (new_cursor_native != m_cursor_native)
1580+
{
1581+
m_cursor_native = new_cursor_native;
1582+
write(STDOUT_FILENO, m_cursor_native ? "\033[?25h" : "\033[?25l");
1583+
}
15771584

15781585
m_info_max_width = find("terminal_info_max_width").map(str_to_int_ifp).value_or(0);
15791586
}

src/terminal_ui.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ private:
167167

168168
Codepoint m_padding_char = '~';
169169
bool m_padding_fill = false;
170+
bool m_cursor_native = false;
170171

171172
bool m_dirty = false;
172173

0 commit comments

Comments
 (0)