]> granicus.if.org Git - vim/commitdiff
patch 8.0.0740: cannot resize a terminal window by the command v8.0.0740
authorBram Moolenaar <Bram@vim.org>
Fri, 21 Jul 2017 19:10:01 +0000 (21:10 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 21 Jul 2017 19:10:01 +0000 (21:10 +0200)
Problem:    Cannot resize a terminal window by the command running in it.
Solution:   Add support for the window size escape sequence.  Make BS work.

src/libvterm/src/state.c
src/terminal.c
src/version.c

index 5b777c909c3c7edc98f24c12b189c996f1f6f731..1b7e89d316f9a422a24e9e5a48c8354d819b6351 100644 (file)
@@ -9,6 +9,8 @@
 # define DEBUG_GLYPH_COMBINE
 #endif
 
+static int on_resize(int rows, int cols, void *user);
+
 /* Some convenient wrappers to make callback functions easier */
 
 static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos)
@@ -1396,6 +1398,14 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha
 
     break;
 
+  case 0x74:
+    switch(CSI_ARG(args[0])) {
+      case 8: /* CSI 8 ; rows ; cols t  set size */
+       if (argcount == 3)
+         on_resize(CSI_ARG(args[1]), CSI_ARG(args[2]), state);
+    }
+    break;
+
   case INTERMED('\'', 0x7D): /* DECIC */
     count = CSI_ARG_COUNT(args[0]);
 
@@ -1534,7 +1544,7 @@ static void request_status_string(VTermState *state, const char *command, size_t
       switch(state->mode.cursor_shape) {
         case VTERM_PROP_CURSORSHAPE_BLOCK:     reply = 2; break;
         case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break;
-        case VTERM_PROP_CURSORSHAPE_BAR_LEFT:  reply = 6; break;
+       default: /* VTERM_PROP_CURSORSHAPE_BAR_LEFT */  reply = 6; break;
       }
       if(state->mode.cursor_blink)
         reply--;
index ac5b7b892d841c851f0458fa2e061e1d06a4f513..4069e9b33d9f6f01ef7a81b10bdfcf37f5307966 100644 (file)
@@ -572,7 +572,8 @@ term_convert_key(int c, char *buf)
     {
        case CAR:               key = VTERM_KEY_ENTER; break;
        case ESC:               key = VTERM_KEY_ESCAPE; break;
-       case K_BS:              key = VTERM_KEY_BACKSPACE; break;
+                               /* VTERM_KEY_BACKSPACE becomes 0x7f DEL */
+       case K_BS:              c = BS; break;
        case K_DEL:             key = VTERM_KEY_DEL; break;
        case K_DOWN:            key = VTERM_KEY_DOWN; break;
        case K_END:             key = VTERM_KEY_END; break;
index fc0f2da9730fc4e9fbb4891a62665328856a6851..399641bab9ef47bb0e01e6c5b5d069c1765da510 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    740,
 /**/
     739,
 /**/