]> granicus.if.org Git - vim/commitdiff
patch 8.0.1533: libterm doesn't support requesting fg and bg color v8.0.1533
authorBram Moolenaar <Bram@vim.org>
Sat, 24 Feb 2018 13:03:56 +0000 (14:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 24 Feb 2018 13:03:56 +0000 (14:03 +0100)
Problem:    Libterm doesn't support requesting fg and bg color.
Solution:   Implement t_RF and t_RB.

src/libvterm/src/state.c
src/libvterm/src/vterm.c
src/libvterm/src/vterm_internal.h
src/version.c

index 32dabeb3480e8f29216ba7f1f15c4ed82911d6f4..05dbe5a964cb710931e17c2ddc99299dee4823c9 100644 (file)
@@ -1506,6 +1506,22 @@ static int on_osc(const char *command, size_t cmdlen, void *user)
     settermprop_string(state, VTERM_PROP_TITLE, command + 2, cmdlen - 2);
     return 1;
   }
+  else if(strneq(command, "10;", 3)) {
+    /* request foreground color: <Esc>]10;?<0x07> */
+    int red = state->default_fg.red;
+    int blue = state->default_fg.blue;
+    int green = state->default_fg.green;
+    vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "10;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue);
+    return 1;
+  }
+  else if(strneq(command, "11;", 3)) {
+    /* request background color: <Esc>]11;?<0x07> */
+    int red = state->default_bg.red;
+    int blue = state->default_bg.blue;
+    int green = state->default_bg.green;
+    vterm_push_output_sprintf_ctrl(state->vt, C1_OSC, "11;rgb:%02x%02x/%02x%02x/%02x%02x\x07", red, red, green, green, blue, blue);
+    return 1;
+  }
   else if(strneq(command, "12;", 3)) {
     settermprop_string(state, VTERM_PROP_CURSORCOLOR, command + 3, cmdlen - 3);
     return 1;
index 1789fb3563b4c5f055cc1c3126079dfa80768143..853fe50484bf5e985062f3503aa74d6af37bbac9 100644 (file)
@@ -56,7 +56,7 @@ VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *fun
   vt->strbuffer_cur = 0;
   vt->strbuffer = vterm_allocator_malloc(vt, vt->strbuffer_len);
 
-  vt->outbuffer_len = 64;
+  vt->outbuffer_len = 200;
   vt->outbuffer_cur = 0;
   vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len);
 
index 759382cb1e7f2d28d11c135385a08f24d8823691..3b337c0c196d05db83adf5a4fff20dff4cd59d13 100644 (file)
@@ -222,7 +222,8 @@ enum {
   C1_SS3 = 0x8f,
   C1_DCS = 0x90,
   C1_CSI = 0x9b,
-  C1_ST  = 0x9c
+  C1_ST  = 0x9c,
+  C1_OSC = 0x9d
 };
 
 void vterm_state_push_output_sprintf_CSI(VTermState *vts, const char *format, ...);
index c2096c7c6e43f297d73077bd4a03710175d4ecbe..95e5a72ba1df0d6ee9f4440c3e43a98b96d8f528 100644 (file)
@@ -778,6 +778,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1533,
 /**/
     1532,
 /**/