From 44570d15d220f5d41aa1ce20e84644bd7f891d54 Mon Sep 17 00:00:00 2001 From: jixiufeng Date: Mon, 22 Apr 2019 23:39:36 +0800 Subject: support xterm-256color --- vterm-module.c | 15 +++++++++------ vterm.el | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/vterm-module.c b/vterm-module.c index 224ffcf..f753280 100644 --- a/vterm-module.c +++ b/vterm-module.c @@ -498,12 +498,15 @@ static emacs_value color_to_rgb_string(emacs_env *env, Term *term, if (VTERM_COLOR_IS_DEFAULT_BG(color)) { return env->vec_get(env, palette, 0); } - if (VTERM_COLOR_IS_INDEXED(color) < 16) { - return env->vec_get(env, palette, color->indexed.idx % 8); - } - if (VTERM_COLOR_IS_INDEXED(color) >= 16) { - VTermState *state = vterm_obtain_state(term->vt); - vterm_state_get_palette_color(state, color->indexed.idx, color); + if (VTERM_COLOR_IS_INDEXED(color)) { + if (color->indexed.idx < 16) { + return env->vec_get(env, palette, color->indexed.idx % 8); + } else { + VTermState *state = vterm_obtain_state(term->vt); + vterm_state_get_palette_color(state, color->indexed.idx, color); + } + } else if (VTERM_COLOR_IS_RGB(color)) { + /* do nothing just use the argument color directly */ } char buffer[8]; diff --git a/vterm.el b/vterm.el index 63ff177..108e36a 100644 --- a/vterm.el +++ b/vterm.el @@ -140,7 +140,7 @@ for different shell" (if (version< emacs-version "27") (add-hook 'window-size-change-functions #'vterm--window-size-change-26 t t) (add-hook 'window-size-change-functions #'vterm--window-size-change t t)) - (let ((process-environment (append '("TERM=xterm" + (let ((process-environment (append '("TERM=xterm-256color" "INSIDE_EMACS=vterm" "LINES" "COLUMNS") -- cgit v1.0