summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2025-06-28 21:44:43 +1000
committerMaxime Coste <mawww@kakoune.org>2025-06-28 21:44:43 +1000
commitbc9dd1a962c82a0cd1a783995639c823f468e9a3 (patch)
tree1d4a6f5fbc04276f3584c2d6ff94483f9526173d /src
parent767a7df6c9b614f1a1c623027758ee3dbd25a75e (diff)
parent0d20aea4284cbbe436fa7599c70a1c87c4601803 (diff)
Merge remote-tracking branch 'Yukaii/feature/native-cursor'
Diffstat (limited to 'src')
-rw-r--r--src/main.cc1
-rw-r--r--src/terminal_ui.cc7
-rw-r--r--src/terminal_ui.hh1
3 files changed, 9 insertions, 0 deletions
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;