diff src/libvterm/src/pen.c @ 20462:9ad473b50471 v8.2.0785

patch 8.2.0785: libvterm code lags behind the upstream version Commit: https://github.com/vim/vim/commit/6fc3b59ee914a0d1710c8b037a0c592e0a7c34d4 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 17 22:27:55 2020 +0200 patch 8.2.0785: libvterm code lags behind the upstream version Problem: Libvterm code lags behind the upstream version. Solution: Include revisions 734 - 740.
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 May 2020 22:30:03 +0200
parents 1c75e1974313
children 747a270eb1db
line wrap: on
line diff
--- a/src/libvterm/src/pen.c
+++ b/src/libvterm/src/pen.c
@@ -261,9 +261,26 @@ INTERNAL void vterm_state_setpen(VTermSt
       setpenattr_bool(state, VTERM_ATTR_ITALIC, 1);
       break;
 
-    case 4: // Underline single
-      state->pen.underline = 1;
-      setpenattr_int(state, VTERM_ATTR_UNDERLINE, 1);
+    case 4: // Underline
+      state->pen.underline = VTERM_UNDERLINE_SINGLE;
+      if(CSI_ARG_HAS_MORE(args[argi])) {
+        argi++;
+        switch(CSI_ARG(args[argi])) {
+          case 0:
+            state->pen.underline = 0;
+            break;
+          case 1:
+            state->pen.underline = VTERM_UNDERLINE_SINGLE;
+            break;
+          case 2:
+            state->pen.underline = VTERM_UNDERLINE_DOUBLE;
+            break;
+          case 3:
+            state->pen.underline = VTERM_UNDERLINE_CURLY;
+            break;
+        }
+      }
+      setpenattr_int(state, VTERM_ATTR_UNDERLINE, state->pen.underline);
       break;
 
     case 5: // Blink
@@ -288,8 +305,8 @@ INTERNAL void vterm_state_setpen(VTermSt
       break;
 
     case 21: // Underline double
-      state->pen.underline = 2;
-      setpenattr_int(state, VTERM_ATTR_UNDERLINE, 2);
+      state->pen.underline = VTERM_UNDERLINE_DOUBLE;
+      setpenattr_int(state, VTERM_ATTR_UNDERLINE, state->pen.underline);
       break;
 
     case 22: // Bold off
@@ -405,8 +422,10 @@ INTERNAL int vterm_state_getpen(VTermSta
   if(state->pen.italic)
     args[argi++] = 3;
 
-  if(state->pen.underline == 1)
+  if(state->pen.underline == VTERM_UNDERLINE_SINGLE)
     args[argi++] = 4;
+  if(state->pen.underline == VTERM_UNDERLINE_CURLY)
+    args[argi++] = 4 | CSI_ARG_FLAG_MORE, args[argi++] = 3;
 
   if(state->pen.blink)
     args[argi++] = 5;
@@ -420,7 +439,7 @@ INTERNAL int vterm_state_getpen(VTermSta
   if(state->pen.font)
     args[argi++] = 10 + state->pen.font;
 
-  if(state->pen.underline == 2)
+  if(state->pen.underline == VTERM_UNDERLINE_DOUBLE)
     args[argi++] = 21;
 
   if(state->fg_index >= 0 && state->fg_index < 8)