]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.632
- add patches 7.3.619-743
[packages/vim.git] / 7.3.632
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.632
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.632
11 Problem:    Cannot select beyond 222 columns with the mouse in xterm.
12 Solution:   Add support for SGR mouse tracking. (Hayaki Saito)
13 Files:      runtime/doc/options.txt, src/feature.h, src/keymap.h, src/misc2.c,
14             src/option.h, src/os_unix.c, src/term.c, src/version.c
15
16
17 *** ../vim-7.3.631/runtime/doc/options.txt      2012-07-10 16:49:08.000000000 +0200
18 --- runtime/doc/options.txt     2012-08-15 16:04:26.000000000 +0200
19 ***************
20 *** 7383,7388 ****
21 --- 7424,7435 ----
22            jsbterm      JSB term mouse handling.
23                                                         *pterm-mouse*
24            pterm        QNX pterm mouse handling.
25 +                                                       *urxvt-mouse*
26 +          urxvt        Mouse handling for the urxvt (rxvt-unicode) terminal.
27 +                                                       *sgr-mouse*
28 +          sgr          Mouse handling for the terminal that emits SGR-styled
29 +                       mouse reporting. Works with xterm version 277 or
30 +                       later.
31   
32         The mouse handling must be enabled at compile time |+mouse_xterm|
33         |+mouse_dec| |+mouse_netterm|.
34 ***************
35 *** 7395,7400 ****
36 --- 7442,7448 ----
37         or "xterm2" already.  The main use of this option is to set it to
38         "xterm", when the terminal name doesn't start with "xterm", but it can
39         handle xterm mouse codes.
40 +       The "sgr" value will be set if the xterm version is 277 or later.
41         The "xterm2" value will be set if the xterm version is reported to be
42         95 or higher.  This only works when compiled with the |+termresponse|
43         feature and if |t_RV| is set to the escape sequence to request the
44 *** ../vim-7.3.631/src/feature.h        2012-04-25 16:50:44.000000000 +0200
45 --- src/feature.h       2012-08-15 15:46:07.000000000 +0200
46 ***************
47 *** 1056,1061 ****
48 --- 1056,1064 ----
49   # ifdef FEAT_BIG
50   #  define FEAT_MOUSE_URXVT
51   # endif
52 + # ifdef FEAT_BIG
53 + #  define FEAT_MOUSE_SGR
54 + # endif
55   # if defined(FEAT_NORMAL) && (defined(MSDOS) || defined(WIN3264))
56   #  define DOS_MOUSE
57   # endif
58 ***************
59 *** 1077,1082 ****
60 --- 1080,1090 ----
61   # define FEAT_MOUSE_XTERM
62   #endif
63   
64 + /* sgr is a small variation of mouse_xterm, and shares its code */
65 + #if defined(FEAT_MOUSE_SGR) && !defined(FEAT_MOUSE_XTERM)
66 + # define FEAT_MOUSE_XTERM
67 + #endif
68
69   /* Define FEAT_MOUSE when any of the above is defined or FEAT_GUI. */
70   #if !defined(FEAT_MOUSE_TTY) \
71         && (defined(FEAT_MOUSE_XTERM) \
72 ***************
73 *** 1087,1093 ****
74             || defined(FEAT_MOUSE_JSB) \
75             || defined(FEAT_MOUSE_PTERM) \
76             || defined(FEAT_SYSMOUSE) \
77 !           || defined(FEAT_MOUSE_URXVT))
78   # define FEAT_MOUSE_TTY               /* include non-GUI mouse support */
79   #endif
80   #if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
81 --- 1095,1102 ----
82             || defined(FEAT_MOUSE_JSB) \
83             || defined(FEAT_MOUSE_PTERM) \
84             || defined(FEAT_SYSMOUSE) \
85 !           || defined(FEAT_MOUSE_URXVT) \
86 !           || defined(FEAT_MOUSE_SGR))
87   # define FEAT_MOUSE_TTY               /* include non-GUI mouse support */
88   #endif
89   #if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
90 *** ../vim-7.3.631/src/keymap.h 2012-01-20 17:15:47.000000000 +0100
91 --- src/keymap.h        2012-08-15 15:46:07.000000000 +0200
92 ***************
93 *** 110,115 ****
94 --- 110,118 ----
95   /* Used for the urxvt mouse. */
96   #define KS_URXVT_MOUSE                238
97   
98 + /* Used for the sgr mouse. */
99 + #define KS_SGR_MOUSE          237
100
101   /*
102    * Filler used after KS_SPECIAL and others
103    */
104 ***************
105 *** 412,417 ****
106 --- 415,421 ----
107   #define K_JSBTERM_MOUSE       TERMCAP2KEY(KS_JSBTERM_MOUSE, KE_FILLER)
108   #define K_PTERM_MOUSE TERMCAP2KEY(KS_PTERM_MOUSE, KE_FILLER)
109   #define K_URXVT_MOUSE TERMCAP2KEY(KS_URXVT_MOUSE, KE_FILLER)
110 + #define K_SGR_MOUSE   TERMCAP2KEY(KS_SGR_MOUSE, KE_FILLER)
111   
112   #define K_SELECT      TERMCAP2KEY(KS_SELECT, KE_FILLER)
113   #define K_TEAROFF     TERMCAP2KEY(KS_TEAROFF, KE_FILLER)
114 *** ../vim-7.3.631/src/misc2.c  2012-08-15 14:04:50.000000000 +0200
115 --- src/misc2.c 2012-08-15 15:46:07.000000000 +0200
116 ***************
117 *** 2433,2438 ****
118 --- 2433,2441 ----
119   #ifdef FEAT_MOUSE_URXVT
120       {K_URXVT_MOUSE,   (char_u *)"UrxvtMouse"},
121   #endif
122 + #ifdef FEAT_MOUSE_SGR
123 +     {K_SGR_MOUSE,     (char_u *)"SgrMouse"},
124 + #endif
125       {K_LEFTMOUSE,     (char_u *)"LeftMouse"},
126       {K_LEFTMOUSE_NM,  (char_u *)"LeftMouseNM"},
127       {K_LEFTDRAG,      (char_u *)"LeftDrag"},
128 *** ../vim-7.3.631/src/option.h 2012-07-10 16:49:08.000000000 +0200
129 --- src/option.h        2012-08-15 15:46:07.000000000 +0200
130 ***************
131 *** 822,828 ****
132   EXTERN char_u *p_ttym;        /* 'ttymouse' */
133   EXTERN unsigned ttym_flags;
134   # ifdef IN_OPTION_C
135 ! static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", NULL};
136   # endif
137   # define TTYM_XTERM           0x01
138   # define TTYM_XTERM2          0x02
139 --- 822,828 ----
140   EXTERN char_u *p_ttym;        /* 'ttymouse' */
141   EXTERN unsigned ttym_flags;
142   # ifdef IN_OPTION_C
143 ! static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", "sgr", NULL};
144   # endif
145   # define TTYM_XTERM           0x01
146   # define TTYM_XTERM2          0x02
147 ***************
148 *** 831,836 ****
149 --- 831,837 ----
150   # define TTYM_JSBTERM         0x10
151   # define TTYM_PTERM           0x20
152   # define TTYM_URXVT           0x40
153 + # define TTYM_SGR             0x80
154   #endif
155   EXTERN char_u *p_udir;        /* 'undodir' */
156   EXTERN long   p_ul;           /* 'undolevels' */
157 *** ../vim-7.3.631/src/os_unix.c        2012-04-20 15:55:10.000000000 +0200
158 --- src/os_unix.c       2012-08-15 16:06:54.000000000 +0200
159 ***************
160 *** 2159,2168 ****
161 --- 2159,2171 ----
162    * Return 1 for "xterm".
163    * Return 2 for "xterm2".
164    * Return 3 for "urxvt".
165 +  * Return 4 for "sgr".
166    */
167       int
168   use_xterm_mouse()
169   {
170 +     if (ttym_flags == TTYM_SGR)
171 +       return 4;
172       if (ttym_flags == TTYM_URXVT)
173         return 3;
174       if (ttym_flags == TTYM_XTERM2)
175 ***************
176 *** 3339,3345 ****
177       xterm_mouse_vers = use_xterm_mouse();
178   
179   # ifdef FEAT_MOUSE_URXVT
180 !     if (ttym_flags == TTYM_URXVT) {
181         out_str_nf((char_u *)
182                    (on
183                    ? IF_EB("\033[?1015h", ESC_STR "[?1015h")
184 --- 3342,3349 ----
185       xterm_mouse_vers = use_xterm_mouse();
186   
187   # ifdef FEAT_MOUSE_URXVT
188 !     if (ttym_flags == TTYM_URXVT)
189 !     {
190         out_str_nf((char_u *)
191                    (on
192                    ? IF_EB("\033[?1015h", ESC_STR "[?1015h")
193 ***************
194 *** 3348,3353 ****
195 --- 3352,3368 ----
196       }
197   # endif
198   
199 + # ifdef FEAT_MOUSE_SGR
200 +     if (ttym_flags == TTYM_SGR)
201 +     {
202 +       out_str_nf((char_u *)
203 +                  (on
204 +                  ? IF_EB("\033[?1006h", ESC_STR "[?1006h")
205 +                  : IF_EB("\033[?1006l", ESC_STR "[?1006l")));
206 +       ison = on;
207 +     }
208 + # endif
209
210       if (xterm_mouse_vers > 0)
211       {
212         if (on) /* enable mouse events, use mouse tracking if available */
213 ***************
214 *** 3577,3582 ****
215 --- 3592,3618 ----
216       else
217         del_mouse_termcode(KS_URXVT_MOUSE);
218   # endif
219 + # ifdef FEAT_MOUSE_SGR
220 +     /* same as the dec mouse */
221 +     if (use_xterm_mouse() == 4
222 + #  ifdef FEAT_GUI
223 +           && !gui.in_use
224 + #  endif
225 +           )
226 +     {
227 +       set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME)
228 +                   ? IF_EB("\233<", CSI_STR "<")
229 +                   : IF_EB("\033[<", ESC_STR "[<")));
230
231 +       if (*p_mouse != NUL)
232 +       {
233 +           mch_setmouse(FALSE);
234 +           setmouse();
235 +       }
236 +     }
237 +     else
238 +       del_mouse_termcode(KS_SGR_MOUSE);
239 + # endif
240   }
241   #endif
242   
243 *** ../vim-7.3.631/src/term.c   2012-02-05 22:05:44.000000000 +0100
244 --- src/term.c  2012-08-15 16:14:09.000000000 +0200
245 ***************
246 *** 1997,2002 ****
247 --- 1997,2003 ----
248   #  define HMT_JSBTERM 8
249   #  define HMT_PTERM   16
250   #  define HMT_URXVT   32
251 + #  define HMT_SGR     64
252   static int has_mouse_termcode = 0;
253   # endif
254   
255 ***************
256 *** 2037,2042 ****
257 --- 2038,2048 ----
258         has_mouse_termcode |= HMT_URXVT;
259       else
260   #   endif
261 + #   ifdef FEAT_MOUSE_SGR
262 +     if (n == KS_SGR_MOUSE)
263 +       has_mouse_termcode |= HMT_SGR;
264 +     else
265 + #   endif
266         has_mouse_termcode |= HMT_NORMAL;
267   #  endif
268   }
269 ***************
270 *** 2079,2084 ****
271 --- 2085,2095 ----
272         has_mouse_termcode &= ~HMT_URXVT;
273       else
274   #   endif
275 + #   ifdef FEAT_MOUSE_SGR
276 +     if (n == KS_SGR_MOUSE)
277 +       has_mouse_termcode &= ~HMT_SGR;
278 +     else
279 + #   endif
280         has_mouse_termcode &= ~HMT_NORMAL;
281   #  endif
282   }
283 ***************
284 *** 4023,4029 ****
285   #ifdef FEAT_TERMRESPONSE
286         if (key_name[0] == NUL
287             /* URXVT mouse uses <ESC>[#;#;#M, but we are matching <ESC>[ */
288 !           || key_name[0] == KS_URXVT_MOUSE)
289         {
290             /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
291              * eat other possible responses to t_RV, rxvt returns
292 --- 4034,4041 ----
293   #ifdef FEAT_TERMRESPONSE
294         if (key_name[0] == NUL
295             /* URXVT mouse uses <ESC>[#;#;#M, but we are matching <ESC>[ */
296 !           || key_name[0] == KS_URXVT_MOUSE
297 !           || key_name[0] == KS_SGR_MOUSE)
298         {
299             /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
300              * eat other possible responses to t_RV, rxvt returns
301 ***************
302 *** 4061,4066 ****
303 --- 4073,4088 ----
304   
305                     if (tp[1 + (tp[0] != CSI)] == '>' && j == 2)
306                     {
307 + # ifdef TTYM_SGR
308 +                       if (extra >= 277
309 + # ifdef TTYM_URXVT
310 +                               && ttym_flags != TTYM_URXVT
311 + # endif
312 +                               )
313 +                           set_option_value((char_u *)"ttym", 0L,
314 +                                                         (char_u *)"sgr", 0);
315 +                         else
316 + # endif
317                         /* if xterm version >= 95 use mouse dragging */
318                         if (extra >= 95
319   # ifdef TTYM_URXVT
320 ***************
321 *** 4147,4167 ****
322         /*
323          * If it is a mouse click, get the coordinates.
324          */
325 !       if (key_name[0] == (int)KS_MOUSE
326   # ifdef FEAT_MOUSE_JSB
327 !               || key_name[0] == (int)KS_JSBTERM_MOUSE
328   # endif
329   # ifdef FEAT_MOUSE_NET
330 !               || key_name[0] == (int)KS_NETTERM_MOUSE
331   # endif
332   # ifdef FEAT_MOUSE_DEC
333 !               || key_name[0] == (int)KS_DEC_MOUSE
334   # endif
335   # ifdef FEAT_MOUSE_PTERM
336 !               || key_name[0] == (int)KS_PTERM_MOUSE
337   # endif
338   # ifdef FEAT_MOUSE_URXVT
339 !               || key_name[0] == (int)KS_URXVT_MOUSE
340   # endif
341                 )
342         {
343 --- 4169,4192 ----
344         /*
345          * If it is a mouse click, get the coordinates.
346          */
347 !       if (key_name[0] == KS_MOUSE
348   # ifdef FEAT_MOUSE_JSB
349 !               || key_name[0] == KS_JSBTERM_MOUSE
350   # endif
351   # ifdef FEAT_MOUSE_NET
352 !               || key_name[0] == KS_NETTERM_MOUSE
353   # endif
354   # ifdef FEAT_MOUSE_DEC
355 !               || key_name[0] == KS_DEC_MOUSE
356   # endif
357   # ifdef FEAT_MOUSE_PTERM
358 !               || key_name[0] == KS_PTERM_MOUSE
359   # endif
360   # ifdef FEAT_MOUSE_URXVT
361 !               || key_name[0] == KS_URXVT_MOUSE
362 ! # endif
363 ! # ifdef FEAT_MOUSE_SGR
364 !               || key_name[0] == KS_SGR_MOUSE
365   # endif
366                 )
367         {
368 ***************
369 *** 4243,4250 ****
370                 }
371             }
372   
373 ! # ifdef FEAT_MOUSE_URXVT
374 !           if (key_name[0] == (int)KS_URXVT_MOUSE)
375             {
376                 for (;;)
377                 {
378 --- 4268,4276 ----
379                 }
380             }
381   
382 ! # if defined(FEAT_MOUSE_URXVT) || defined(FEAT_MOUSE_SGR)
383 !           if (key_name[0] == KS_URXVT_MOUSE
384 !               || key_name[0] == KS_SGR_MOUSE)
385             {
386                 for (;;)
387                 {
388 ***************
389 *** 4256,4261 ****
390 --- 4282,4301 ----
391                      *            ^-- row
392                      *         ^----- column
393                      *      ^-------- code
394 +                    *
395 +                    * SGR 1006 mouse reporting mode:
396 +                    * Almost identical to xterm mouse mode, except the values
397 +                    * are decimal instead of bytes.
398 +                    *
399 +                    * \033[<%d;%d;%dM
400 +                    *             ^-- row
401 +                    *          ^----- column
402 +                    *       ^-------- code
403 +                    *
404 +                    * \033[<%d;%d;%dm        : mouse release event
405 +                    *             ^-- row
406 +                    *          ^----- column
407 +                    *       ^-------- code
408                      */
409                     p = tp + slen;
410   
411 ***************
412 *** 4263,4294 ****
413                     if (*p++ != ';')
414                         return -1;
415   
416                     mouse_col = getdigits(&p) - 1;
417                     if (*p++ != ';')
418                         return -1;
419   
420                     mouse_row = getdigits(&p) - 1;
421 !                   if (*p++ != 'M')
422                         return -1;
423   
424                     slen += (int)(p - (tp + slen));
425   
426                     /* skip this one if next one has same code (like xterm
427                      * case) */
428                     j = termcodes[idx].len;
429 !                   if (STRNCMP(tp, tp + slen, (size_t)j) == 0) {
430 !                       /* check if the command is complete by looking for the
431 !                        * M */
432                         int slen2;
433                         int cmd_complete = 0;
434 !                       for (slen2 = slen; slen2 < len; slen2++) {
435 !                           if (tp[slen2] == 'M') {
436                                 cmd_complete = 1;
437                                 break;
438                             }
439                         }
440                         p += j;
441 !                       if (cmd_complete && getdigits(&p) == mouse_code) {
442                             slen += j; /* skip the \033[ */
443                             continue;
444                         }
445 --- 4303,4348 ----
446                     if (*p++ != ';')
447                         return -1;
448   
449 +                   /* when mouse reporting is SGR, add 32 to mouse code */
450 +                     if (key_name[0] == KS_SGR_MOUSE)
451 +                         mouse_code += 32;
452
453                     mouse_col = getdigits(&p) - 1;
454                     if (*p++ != ';')
455                         return -1;
456   
457                     mouse_row = getdigits(&p) - 1;
458 !                     if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
459 !                       mouse_code |= MOUSE_RELEASE;
460 !                     else if (*p != 'M')
461                         return -1;
462 +                     p++;
463   
464                     slen += (int)(p - (tp + slen));
465   
466                     /* skip this one if next one has same code (like xterm
467                      * case) */
468                     j = termcodes[idx].len;
469 !                   if (STRNCMP(tp, tp + slen, (size_t)j) == 0)
470 !                   {
471                         int slen2;
472                         int cmd_complete = 0;
473
474 !                       /* check if the command is complete by looking for the
475 !                        * 'M' */
476 !                       for (slen2 = slen; slen2 < len; slen2++)
477 !                       {
478 !                           if (tp[slen2] == 'M'
479 !                                 || (key_name[0] == KS_SGR_MOUSE
480 !                                                        && tp[slen2] == 'm'))
481 !                           {
482                                 cmd_complete = 1;
483                                 break;
484                             }
485                         }
486                         p += j;
487 !                       if (cmd_complete && getdigits(&p) == mouse_code)
488 !                       {
489                             slen += j; /* skip the \033[ */
490                             continue;
491                         }
492 ***************
493 *** 4302,4307 ****
494 --- 4356,4364 ----
495   #ifdef FEAT_MOUSE_URXVT
496             || key_name[0] == (int)KS_URXVT_MOUSE
497   #endif
498 + #ifdef FEAT_MOUSE_SGR
499 +           || key_name[0] == KS_SGR_MOUSE
500 + #endif
501             )
502         {
503   #  if !defined(MSWIN) && !defined(MSDOS)
504 *** ../vim-7.3.631/src/version.c        2012-08-15 14:04:50.000000000 +0200
505 --- src/version.c       2012-08-15 15:47:30.000000000 +0200
506 ***************
507 *** 384,389 ****
508 --- 384,394 ----
509   # else
510         "-mouse_urxvt",
511   # endif
512 + # ifdef FEAT_MOUSE_SGR
513 +       "+mouse_sgr",
514 + # else
515 +       "-mouse_sgr",
516 + # endif
517   #endif
518   #ifdef __QNX__
519   # ifdef FEAT_MOUSE_PTERM
520 *** ../vim-7.3.631/src/version.c        2012-08-15 14:04:50.000000000 +0200
521 --- src/version.c       2012-08-15 15:47:30.000000000 +0200
522 ***************
523 *** 716,717 ****
524 --- 721,724 ----
525   {   /* Add new patch number below this line */
526 + /**/
527 +     632,
528   /**/
529
530 -- 
531 hundred-and-one symptoms of being an internet addict:
532 243. You unsuccessfully try to download a pizza from www.dominos.com.
533
534  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
535 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
536 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
537  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.16917 seconds and 3 git commands to generate.