aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjixiufeng <jixiufeng@luojilab.com>2019-04-22 23:39:36 +0800
committerjixiuf <jixiuf@qq.com>2019-07-30 22:00:57 +0800
commit44570d15d220f5d41aa1ce20e84644bd7f891d54 (patch)
treed7208b01e3cadfa9e5f33308a44992ebb0b47279
parent40f39427413841dc716e1d309ed36cf67d6dcb06 (diff)
support xterm-256color
-rw-r--r--vterm-module.c15
-rw-r--r--vterm.el2
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")