aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/main.c2
-rw-r--r--src/nvim/option.c20
-rw-r--r--src/nvim/os/env.c14
3 files changed, 26 insertions, 10 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 33e1551351..7ad42d6776 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -283,7 +283,7 @@ int main(int argc, char **argv)
cmdline_row = (int)(Rows - p_ch);
msg_row = cmdline_row;
screenalloc(false); /* allocate screen buffers */
- set_init_2();
+ set_init_2(params.headless);
TIME_MSG("inits 2");
msg_scroll = TRUE;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 695d0edebf..458d80716c 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -939,11 +939,8 @@ void free_all_options(void)
#endif
-/*
- * Initialize the options, part two: After getting Rows and Columns and
- * setting 'term'.
- */
-void set_init_2(void)
+/// Initialize the options, part two: After getting Rows and Columns.
+void set_init_2(bool headless)
{
int idx;
@@ -966,8 +963,12 @@ void set_init_2(void)
p_window = Rows - 1;
}
set_number_default("window", Rows - 1);
- parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */
- (void)parse_printoptions(); /* parse 'printoptions' default value */
+ if (!headless && !os_term_is_nice()) {
+ set_string_option_direct((char_u *)"guicursor", -1, (char_u *)"",
+ OPT_GLOBAL, SID_NONE);
+ }
+ parse_shape_opt(SHAPE_CURSOR); // set cursor shapes from 'guicursor'
+ (void)parse_printoptions(); // parse 'printoptions' default value
}
/*
@@ -2842,9 +2843,10 @@ did_set_string_option (
}
}
- /* 'guicursor' */
- else if (varp == &p_guicursor)
+ // 'guicursor'
+ else if (varp == &p_guicursor) {
errmsg = parse_shape_opt(SHAPE_CURSOR);
+ }
else if (varp == &p_popt)
errmsg = parse_printoptions();
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 1a97adfa21..839e0d1b51 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -889,3 +889,17 @@ bool os_setenv_append_path(const char *fname)
}
return false;
}
+
+/// Returns true if the terminal can be assumed to silently ignore unknown
+/// control codes.
+bool os_term_is_nice(void)
+{
+#if defined(__APPLE__) || defined(WIN32)
+ return true;
+#else
+ const char *vte_version = os_getenv("VTE_VERSION");
+ return (vte_version && atoi(vte_version) >= 3900)
+ || NULL != os_getenv("KONSOLE_PROFILE_NAME")
+ || NULL != os_getenv("KONSOLE_DBUS_SESSION");
+#endif
+}