Skip to content

Commit 26bb8cb

Browse files
committed
Add vterm-ignore-cursor-change
1 parent 056ad74 commit 26bb8cb

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

vterm-module.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,8 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data) {
722722
Term *term = (Term *)user_data;
723723
switch (prop) {
724724
case VTERM_PROP_CURSORVISIBLE:
725+
if (term->ignore_cursor_change)
726+
break;
725727
invalidate_terminal(term, term->cursor.row, term->cursor.row + 1);
726728
term->cursor.cursor_visible = val->boolean;
727729
term->cursor.cursor_type_changed = true;
@@ -734,6 +736,8 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data) {
734736
term->cursor.cursor_blink_changed = true;
735737
break;
736738
case VTERM_PROP_CURSORSHAPE:
739+
if (term->ignore_cursor_change)
740+
break;
737741
invalidate_terminal(term, term->cursor.row, term->cursor.row + 1);
738742
term->cursor.cursor_type = val->number;
739743
term->cursor.cursor_type_changed = true;
@@ -1231,6 +1235,7 @@ emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[],
12311235
int disable_inverse_video = env->is_not_nil(env, args[5]);
12321236
int ignore_blink_cursor = env->is_not_nil(env, args[6]);
12331237
int set_bold_hightbright = env->is_not_nil(env, args[7]);
1238+
int ignore_cursor_change = env->is_not_nil(env, args[8]);
12341239

12351240
term->vt = vterm_new(rows, cols);
12361241
vterm_set_utf8(term->vt, 1);
@@ -1266,6 +1271,7 @@ emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[],
12661271
term->disable_underline = disable_underline;
12671272
term->disable_inverse_video = disable_inverse_video;
12681273
term->ignore_blink_cursor = ignore_blink_cursor;
1274+
term->ignore_cursor_change = ignore_cursor_change;
12691275
emacs_value newline = env->make_string(env, "\n", 1);
12701276
for (int i = 0; i < term->height; i++) {
12711277
insert(env, newline);
@@ -1511,7 +1517,7 @@ int emacs_module_init(struct emacs_runtime *ert) {
15111517
// Exported functions
15121518
emacs_value fun;
15131519
fun =
1514-
env->make_function(env, 4, 8, Fvterm_new, "Allocate a new vterm.", NULL);
1520+
env->make_function(env, 4, 9, Fvterm_new, "Allocate a new vterm.", NULL);
15151521
bind_function(env, "vterm--new", fun);
15161522

15171523
fun = env->make_function(env, 1, 5, Fvterm_update,

vterm-module.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ typedef struct Term {
118118
bool disable_underline;
119119
bool disable_inverse_video;
120120
bool ignore_blink_cursor;
121+
bool ignore_cursor_change;
121122

122123
char *cmd_buffer;
123124

vterm.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ you can use `M-x blink-cursor-mode` to toggle."
397397
:type 'boolean
398398
:group 'vterm)
399399

400+
(defcustom vterm-ignore-cursor-change nil
401+
"When t, vterm will ignore request from application to modify cursor shape or visibility."
402+
:type 'boolean
403+
:group 'vterm)
404+
400405
(defcustom vterm-copy-exclude-prompt t
401406
"When not-nil, the prompt is not included by `vterm-copy-mode-done'."
402407
:type 'boolean
@@ -774,7 +779,8 @@ Exceptions are defined by `vterm-keymap-exceptions'."
774779
vterm-disable-underline
775780
vterm-disable-inverse-video
776781
vterm-ignore-blink-cursor
777-
vterm-set-bold-hightbright))
782+
vterm-set-bold-hightbright
783+
vterm-ignore-cursor-change))
778784
(setq buffer-read-only t)
779785
(setq-local scroll-conservatively 101)
780786
(setq-local scroll-margin 0)

0 commit comments

Comments
 (0)