diff --git a/vterm-module.c b/vterm-module.c index 2294ef4..3ba9438 100644 --- a/vterm-module.c +++ b/vterm-module.c @@ -722,6 +722,8 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data) { Term *term = (Term *)user_data; switch (prop) { case VTERM_PROP_CURSORVISIBLE: + if (term->ignore_cursor_change) + break; invalidate_terminal(term, term->cursor.row, term->cursor.row + 1); term->cursor.cursor_visible = val->boolean; term->cursor.cursor_type_changed = true; @@ -734,6 +736,8 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data) { term->cursor.cursor_blink_changed = true; break; case VTERM_PROP_CURSORSHAPE: + if (term->ignore_cursor_change) + break; invalidate_terminal(term, term->cursor.row, term->cursor.row + 1); term->cursor.cursor_type = val->number; term->cursor.cursor_type_changed = true; @@ -1231,6 +1235,7 @@ emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[], int disable_inverse_video = env->is_not_nil(env, args[5]); int ignore_blink_cursor = env->is_not_nil(env, args[6]); int set_bold_hightbright = env->is_not_nil(env, args[7]); + int ignore_cursor_change = env->is_not_nil(env, args[8]); term->vt = vterm_new(rows, cols); vterm_set_utf8(term->vt, 1); @@ -1266,6 +1271,7 @@ emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[], term->disable_underline = disable_underline; term->disable_inverse_video = disable_inverse_video; term->ignore_blink_cursor = ignore_blink_cursor; + term->ignore_cursor_change = ignore_cursor_change; emacs_value newline = env->make_string(env, "\n", 1); for (int i = 0; i < term->height; i++) { insert(env, newline); @@ -1511,7 +1517,7 @@ int emacs_module_init(struct emacs_runtime *ert) { // Exported functions emacs_value fun; fun = - env->make_function(env, 4, 8, Fvterm_new, "Allocate a new vterm.", NULL); + env->make_function(env, 4, 9, Fvterm_new, "Allocate a new vterm.", NULL); bind_function(env, "vterm--new", fun); fun = env->make_function(env, 1, 5, Fvterm_update, diff --git a/vterm-module.h b/vterm-module.h index ebf3624..c14960f 100644 --- a/vterm-module.h +++ b/vterm-module.h @@ -118,6 +118,7 @@ typedef struct Term { bool disable_underline; bool disable_inverse_video; bool ignore_blink_cursor; + bool ignore_cursor_change; char *cmd_buffer; diff --git a/vterm.el b/vterm.el index 9bc0d16..b8c1841 100644 --- a/vterm.el +++ b/vterm.el @@ -397,6 +397,11 @@ you can use `M-x blink-cursor-mode` to toggle." :type 'boolean :group 'vterm) +(defcustom vterm-ignore-cursor-change nil + "When t, vterm will ignore request from application to modify cursor shape or visibility." + :type 'boolean + :group 'vterm) + (defcustom vterm-copy-exclude-prompt t "When not-nil, the prompt is not included by `vterm-copy-mode-done'." :type 'boolean @@ -774,7 +779,8 @@ Exceptions are defined by `vterm-keymap-exceptions'." vterm-disable-underline vterm-disable-inverse-video vterm-ignore-blink-cursor - vterm-set-bold-hightbright)) + vterm-set-bold-hightbright + vterm-ignore-cursor-change)) (setq buffer-read-only t) (setq-local scroll-conservatively 101) (setq-local scroll-margin 0)