Skip to content

Add vterm-ignore-cursor-change #760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion vterm-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions vterm-module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion vterm.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down