comparison src/term.c @ 4395:113768420756 v7.3.946

updated for version 7.3.946 Problem: Sometimes get stuck in waiting for cursor position report, resulting in keys starting with <Esc>[ not working. Solution: Only wait for more characters after <Esc>[ if followed by '?', '>' or a digit.
author Bram Moolenaar <bram@vim.org>
date Wed, 15 May 2013 14:22:41 +0200
parents 71fa86c8fd4a
children cf52d2a8c05c
comparison
equal deleted inserted replaced
4394:b4941edc4984 4395:113768420756
4124 * 4124 *
4125 * - cursor position report: <Esc>[{row};{col}R 4125 * - cursor position report: <Esc>[{row};{col}R
4126 * The final byte is 'R'. now it is only used for checking for 4126 * The final byte is 'R'. now it is only used for checking for
4127 * ambiguous-width character state. 4127 * ambiguous-width character state.
4128 */ 4128 */
4129 p = tp[0] == CSI ? tp + 1 : tp + 2;
4129 if ((*T_CRV != NUL || *T_U7 != NUL) 4130 if ((*T_CRV != NUL || *T_U7 != NUL)
4130 && ((tp[0] == ESC && tp[1] == '[' && len >= 3) 4131 && ((tp[0] == ESC && tp[1] == '[' && len >= 3)
4131 || (tp[0] == CSI && len >= 2))) 4132 || (tp[0] == CSI && len >= 2))
4133 && (VIM_ISDIGIT(*p) || *p == '>' || *p == '?'))
4132 { 4134 {
4133 j = 0; 4135 j = 0;
4134 extra = 0; 4136 extra = 0;
4135 for (i = 2 + (tp[0] != CSI); i < len 4137 for (i = 2 + (tp[0] != CSI); i < len
4136 && !(tp[i] >= '{' && tp[i] <= '~') 4138 && !(tp[i] >= '{' && tp[i] <= '~')
4137 && !ASCII_ISALPHA(tp[i]); ++i) 4139 && !ASCII_ISALPHA(tp[i]); ++i)
4138 if (tp[i] == ';' && ++j == 1) 4140 if (tp[i] == ';' && ++j == 1)
4139 extra = atoi((char *)tp + i + 1); 4141 extra = i + 1;
4140 if (i == len) 4142 if (i == len)
4141 return -1; /* not enough characters */ 4143 return -1; /* not enough characters */
4142 4144
4143 #ifdef FEAT_MBYTE 4145 #ifdef FEAT_MBYTE
4144 /* eat it when it has 2 arguments and ends in 'R' */ 4146 /* eat it when it has 2 arguments and ends in 'R' */
4148 4150
4149 u7_status = U7_GOT; 4151 u7_status = U7_GOT;
4150 # ifdef FEAT_AUTOCMD 4152 # ifdef FEAT_AUTOCMD
4151 did_cursorhold = TRUE; 4153 did_cursorhold = TRUE;
4152 # endif 4154 # endif
4155 if (extra > 0)
4156 extra = atoi((char *)tp + extra);
4153 if (extra == 2) 4157 if (extra == 2)
4154 aw = "single"; 4158 aw = "single";
4155 else if (extra == 3) 4159 else if (extra == 3)
4156 aw = "double"; 4160 aw = "double";
4157 if (aw != NULL) 4161 if (aw != NULL)
4176 switch_to_8bit(); 4180 switch_to_8bit();
4177 4181
4178 /* rxvt sends its version number: "20703" is 2.7.3. 4182 /* rxvt sends its version number: "20703" is 2.7.3.
4179 * Ignore it for when the user has set 'term' to xterm, 4183 * Ignore it for when the user has set 'term' to xterm,
4180 * even though it's an rxvt. */ 4184 * even though it's an rxvt. */
4185 if (extra > 0)
4186 extra = atoi((char *)tp + extra);
4181 if (extra > 20000) 4187 if (extra > 20000)
4182 extra = 0; 4188 extra = 0;
4183 4189
4184 if (tp[1 + (tp[0] != CSI)] == '>' && j == 2) 4190 if (tp[1 + (tp[0] != CSI)] == '>' && j == 2)
4185 { 4191 {