diff options
| author | Lukas Fürmetz <fuermetz@mailbox.org> | 2018-10-25 22:42:00 +0200 |
|---|---|---|
| committer | Lukas Fürmetz <fuermetz@mailbox.org> | 2018-10-25 22:42:00 +0200 |
| commit | fbe7a522e3a801176d2d6180507a8cbd99d639ef (patch) | |
| tree | 8bc64a6704635b3c5059cc6c0f30c1d0188802c1 | |
| parent | 3ab1aefab5704ca439919856cddb093b4de8f0b5 (diff) | |
Add support for cursor blinking
| -rw-r--r-- | elisp.c | 7 | ||||
| -rw-r--r-- | elisp.h | 2 | ||||
| -rw-r--r-- | vterm-module.c | 7 |
3 files changed, 13 insertions, 3 deletions
@@ -120,6 +120,13 @@ void toggle_cursor(emacs_env *env, bool visible) { env->funcall(env, Fset, 2, (emacs_value[]){Qcursor_type, Qvisible}); } +void toggle_cursor_blinking(emacs_env *env, bool blinking) { + blinking = false; + emacs_value Qfalse = env->make_integer(env, -1); + emacs_value Qblinking = blinking ? Qt : Qfalse; + env->funcall(env, Fblink_cursor_mode, 1, (emacs_value[]){Qblinking}); +} + emacs_value get_hex_color_fg(emacs_env *env, emacs_value face) { return env->funcall(env, Fvterm_face_color_hex, 2, (emacs_value[]){face, Qforeground}); @@ -36,6 +36,7 @@ emacs_value Fput_text_property; emacs_value Fset; emacs_value Fvterm_face_color_hex; emacs_value Fvterm_flush_output; +emacs_value Fblink_cursor_mode; // Utils void bind_function(emacs_env *env, const char *name, emacs_value Sfun); @@ -55,6 +56,7 @@ void goto_char(emacs_env *env, int pos); void forward_line(emacs_env *env, int n) ; void goto_line(emacs_env *env, int n) ; void toggle_cursor(emacs_env *env, bool visible); +void toggle_cursor_blinking(emacs_env *env, bool visible); void delete_lines(emacs_env *env ,int linenum,int count ,bool del_whole_line); emacs_value get_hex_color_fg(emacs_env *env, emacs_value face); emacs_value get_hex_color_bg(emacs_env *env, emacs_value face); diff --git a/vterm-module.c b/vterm-module.c index 19f45c1..b0410f1 100644 --- a/vterm-module.c +++ b/vterm-module.c @@ -341,6 +341,8 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *user_data) { case VTERM_PROP_CURSORVISIBLE: term->cursor_visible = val->boolean; break; + case VTERM_PROP_CURSORBLINK: + term->cursor_blinking = val->boolean; default: return 0; } @@ -556,6 +558,7 @@ static emacs_value Fvterm_update(emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data) { Term *term = env->get_user_ptr(env, args[0]); + toggle_cursor_blinking(env, term->cursor_blinking); toggle_cursor(env, term->cursor_visible); // Process keys @@ -647,9 +650,7 @@ int emacs_module_init(struct emacs_runtime *ert) { Fdelete_lines = env->make_global_ref(env, env->intern(env, "vterm--delete-lines")); Frecenter = env->make_global_ref(env,env->intern(env, "vterm--recenter")); Fforward_char = env->make_global_ref(env,env->intern(env, "vterm--forward-char")); - - - + Fblink_cursor_mode = env->make_global_ref(env,env->intern(env, "blink-cursor-mode")); // Faces Qterm = env->make_global_ref(env, env->intern(env, "vterm")); |
