summaryrefslogtreecommitdiff
path: root/source/ap/vim/patches/7.3.283
blob: 1a3a6358cff6a790aab30f1df25faafbdaed2fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
To: vim_dev@googlegroups.com
Subject: Patch 7.3.283
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.283
Problem:    An expression mapping with a multi-byte character containing a
	    0x80 byte gets messed up. (ZyX)
Solution:   Unescape the expression before evaluating it (Yukihiro Nakadaira)
Files:	    src/getchar.c


*** ../vim-7.3.282/src/getchar.c	2011-04-28 17:30:05.000000000 +0200
--- src/getchar.c	2011-08-17 17:04:38.000000000 +0200
***************
*** 3262,3270 ****
      validate_maphash();
  
      /*
!      * find end of keys and skip CTRL-Vs (and backslashes) in it
       * Accept backslash like CTRL-V when 'cpoptions' does not contain 'B'.
!      * with :unmap white space is included in the keys, no argument possible
       */
      p = keys;
      do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL);
--- 3262,3270 ----
      validate_maphash();
  
      /*
!      * Find end of keys and skip CTRL-Vs (and backslashes) in it.
       * Accept backslash like CTRL-V when 'cpoptions' does not contain 'B'.
!      * with :unmap white space is included in the keys, no argument possible.
       */
      p = keys;
      do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL);
***************
*** 4506,4517 ****
--- 4506,4528 ----
  {
      char_u	*res;
      char_u	*p;
+     char_u	*expr;
      char_u	*save_cmd;
      pos_T	save_cursor;
  
+     /* Remove escaping of CSI, because "str" is in a format to be used as
+      * typeahead. */
+     expr = vim_strsave(str);
+     if (expr == NULL)
+ 	return NULL;
+     vim_unescape_csi(expr);
+ 
      save_cmd = save_cmdline_alloc();
      if (save_cmd == NULL)
+     {
+ 	vim_free(expr);
  	return NULL;
+     }
  
      /* Forbid changing text or using ":normal" to avoid most of the bad side
       * effects.  Also restore the cursor position. */
***************
*** 4521,4527 ****
  #endif
      set_vim_var_char(c);  /* set v:char to the typed character */
      save_cursor = curwin->w_cursor;
!     p = eval_to_string(str, NULL, FALSE);
      --textlock;
  #ifdef FEAT_EX_EXTRA
      --ex_normal_lock;
--- 4532,4538 ----
  #endif
      set_vim_var_char(c);  /* set v:char to the typed character */
      save_cursor = curwin->w_cursor;
!     p = eval_to_string(expr, NULL, FALSE);
      --textlock;
  #ifdef FEAT_EX_EXTRA
      --ex_normal_lock;
***************
*** 4529,4536 ****
--- 4540,4550 ----
      curwin->w_cursor = save_cursor;
  
      restore_cmdline_alloc(save_cmd);
+     vim_free(expr);
+ 
      if (p == NULL)
  	return NULL;
+     /* Escape CSI in the result to be able to use the string as typeahead. */
      res = vim_strsave_escape_csi(p);
      vim_free(p);
  
*** ../vim-7.3.282/src/version.c	2011-08-17 16:25:43.000000000 +0200
--- src/version.c	2011-08-17 17:17:03.000000000 +0200
***************
*** 711,712 ****
--- 711,714 ----
  {   /* Add new patch number below this line */
+ /**/
+     283,
  /**/

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~

 /// 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    ///