# HG changeset patch # User Christian Brabandt # Date 1500664504 -7200 # Node ID d7430b56c9edc7bab89b9cb406040931d45400e2 # Parent 454976193d517554fbf9cdcb28ff43f760239cd4 patch 8.0.0740: cannot resize a terminal window by the command commit https://github.com/vim/vim/commit/e906ae85b291ccc7da842b7ac609c697bb582e1f Author: Bram Moolenaar Date: Fri Jul 21 21:10:01 2017 +0200 patch 8.0.0740: cannot resize a terminal window by the command Problem: Cannot resize a terminal window by the command running in it. Solution: Add support for the window size escape sequence. Make BS work. diff --git a/src/libvterm/src/state.c b/src/libvterm/src/state.c --- a/src/libvterm/src/state.c +++ b/src/libvterm/src/state.c @@ -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, co 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(VTermS 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--; diff --git a/src/terminal.c b/src/terminal.c --- a/src/terminal.c +++ b/src/terminal.c @@ -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; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 740, +/**/ 739, /**/ 738,