summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/pages/options.asciidoc4
-rw-r--r--src/main.cc1
-rw-r--r--src/terminal_ui.cc7
-rw-r--r--src/terminal_ui.hh1
4 files changed, 13 insertions, 0 deletions
diff --git a/doc/pages/options.asciidoc b/doc/pages/options.asciidoc
index 85a6e098..4a2120ea 100644
--- a/doc/pages/options.asciidoc
+++ b/doc/pages/options.asciidoc
@@ -385,6 +385,10 @@ are exclusively available to built-in options.
set the maximum allowable width of an info box. set to zero for
no limit.
+ *terminal_cursor_native*:::
+ if *yes* or *true*, use native terminal cursor visibility control
+ instead of Kakoune's cursor management (defaults to *false*)
+
[[startup-info]]
*startup_info_version* `int`::
_default_ 0 +
diff --git a/src/main.cc b/src/main.cc
index bf382dd2..09101341 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -604,6 +604,7 @@ void register_options()
" terminal_shift_function_key int\n"
" terminal_padding_char codepoint\n"
" terminal_padding_fill bool\n"
+ " terminal_cursor_native bool\n"
" terminal_info_max_width int\n",
UserInterface::Options{});
reg.declare_option("modelinefmt", "format string used to generate the modeline",
diff --git a/src/terminal_ui.cc b/src/terminal_ui.cc
index 672626e4..c55d0763 100644
--- a/src/terminal_ui.cc
+++ b/src/terminal_ui.cc
@@ -1574,6 +1574,13 @@ void TerminalUI::set_ui_options(const Options& options)
m_padding_char = find("terminal_padding_char").map([](StringView s) { return s.column_length() < 1 ? ' ' : s[0_char]; }).value_or(Codepoint{'~'});
m_padding_fill = find("terminal_padding_fill").map(to_bool).value_or(false);
+
+ bool new_cursor_native = find("terminal_cursor_native").map(to_bool).value_or(false);
+ if (new_cursor_native != m_cursor_native)
+ {
+ m_cursor_native = new_cursor_native;
+ write(STDOUT_FILENO, m_cursor_native ? "\033[?25h" : "\033[?25l");
+ }
m_info_max_width = find("terminal_info_max_width").map(str_to_int_ifp).value_or(0);
}
diff --git a/src/terminal_ui.hh b/src/terminal_ui.hh
index 02085532..064edafe 100644
--- a/src/terminal_ui.hh
+++ b/src/terminal_ui.hh
@@ -167,6 +167,7 @@ private:
Codepoint m_padding_char = '~';
bool m_padding_fill = false;
+ bool m_cursor_native = false;
bool m_dirty = false;