To: vim_dev@googlegroups.com Subject: Patch 8.0.1556 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1556 Problem: May not parse the t_RS response correctly, resulting in wrong characters in the input stream. Solution: When the t_RS response is partly received wait for more characters. Files: src/term.c *** ../vim-8.0.1555/src/term.c 2018-02-23 18:23:25.222809256 +0100 --- src/term.c 2018-03-02 20:58:12.642961499 +0100 *************** *** 4866,4872 **** * {tail} can be Esc>\ or STERM * * Check for cursor shape response from xterm: ! * {lead}1$r q{tail} * * {lead} can be P or DCS * {tail} can be Esc>\ or STERM --- 4866,4872 ---- * {tail} can be Esc>\ or STERM * * Check for cursor shape response from xterm: ! * {lead}1$r q{tail} * * {lead} can be P or DCS * {tail} can be Esc>\ or STERM *************** *** 4897,4931 **** break; } } ! else if ((len >= j + 6 && isdigit(argp[3])) ! && argp[4] == ' ' ! && argp[5] == 'q') { ! /* cursor shape response */ ! i = j + 6; ! if ((tp[i] == ESC && i + 1 < len && tp[i + 1] == '\\') ! || tp[i] == STERM) { ! int number = argp[3] - '0'; ! /* 0, 1 = block blink, 2 = block ! * 3 = underline blink, 4 = underline ! * 5 = vertical bar blink, 6 = vertical bar */ ! number = number == 0 ? 1 : number; ! initial_cursor_shape = (number + 1) / 2; ! /* The blink flag is actually inverted, compared to ! * the value set with T_SH. */ ! initial_cursor_shape_blink = (number & 1) ? FALSE : TRUE; ! rcs_status = STATUS_GOT; ! LOG_TR("Received cursor shape response"); ! key_name[0] = (int)KS_EXTRA; ! key_name[1] = (int)KE_IGNORE; ! slen = i + 1 + (tp[i] == ESC); # ifdef FEAT_EVAL ! set_vim_var_string(VV_TERMSTYLERESP, tp, slen); # endif } } --- 4897,4942 ---- break; } } ! else { ! /* Probably the cursor shape response. Make sure that "i" ! * is equal to "len" when there are not sufficient ! * characters. */ ! for (i = j + 3; i < len; ++i) { ! if (i - j == 3 && !isdigit(tp[i])) ! break; ! if (i - j == 4 && tp[i] != ' ') ! break; ! if (i - j == 5 && tp[i] != 'q') ! break; ! if (i - j == 6 && tp[i] != ESC && tp[i] != STERM) ! break; ! if ((i - j == 6 && tp[i] == STERM) ! || (i - j == 7 && tp[i] == '\\')) ! { ! int number = argp[3] - '0'; ! /* 0, 1 = block blink, 2 = block ! * 3 = underline blink, 4 = underline ! * 5 = vertical bar blink, 6 = vertical bar */ ! number = number == 0 ? 1 : number; ! initial_cursor_shape = (number + 1) / 2; ! /* The blink flag is actually inverted, compared to ! * the value set with T_SH. */ ! initial_cursor_shape_blink = (number & 1) ? FALSE : TRUE; ! rcs_status = STATUS_GOT; ! LOG_TR("Received cursor shape response"); ! key_name[0] = (int)KS_EXTRA; ! key_name[1] = (int)KE_IGNORE; ! slen = i + 1; # ifdef FEAT_EVAL ! set_vim_var_string(VV_TERMSTYLERESP, tp, slen); # endif + break; + } } } *** ../vim-8.0.1555/src/version.c 2018-03-01 23:10:38.611140189 +0100 --- src/version.c 2018-03-02 20:44:07.312325192 +0100 *************** *** 780,781 **** --- 780,783 ---- { /* Add new patch number below this line */ + /**/ + 1556, /**/ -- Wi n0t trei a h0liday in Sweden thi yer? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///