summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0059
blob: a029733c5507322e2539a15793f5abfa7f9a39a7 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0059
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0059
Problem:    Displayed digraph for "ga" wrong with 'encoding' "cp1251".
Solution:   Convert from 'encoding' to "utf-8" if needed. (closes #3015)
Files:	    src/digraph.c, src/testdir/test_digraph.vim


*** ../vim-8.1.0058/src/digraph.c	2018-02-27 20:01:13.000000000 +0100
--- src/digraph.c	2018-06-16 17:06:04.657272887 +0200
***************
*** 1979,1992 ****
   * If not found return NULL.
   */
      char_u *
! get_digraph_for_char(val)
!     int val;
  {
      int		i;
      int		use_defaults;
      digr_T	*dp;
      static      char_u      r[3];
  
      for (use_defaults = 0; use_defaults <= 1; use_defaults++)
      {
  	if (use_defaults == 0)
--- 1979,2015 ----
   * If not found return NULL.
   */
      char_u *
! get_digraph_for_char(int val_arg)
  {
+     int		val = val_arg;
      int		i;
      int		use_defaults;
      digr_T	*dp;
      static      char_u      r[3];
  
+ #if defined(FEAT_MBYTE) && defined(USE_UNICODE_DIGRAPHS)
+     if (!enc_utf8)
+     {
+ 	char_u	    buf[6], *to;
+ 	vimconv_T   vc;
+ 
+ 	// convert the character from 'encoding' to Unicode
+ 	i = mb_char2bytes(val, buf);
+ 	vc.vc_type = CONV_NONE;
+ 	if (convert_setup(&vc, p_enc, (char_u *)"utf-8") == OK)
+ 	{
+ 	    vc.vc_fail = TRUE;
+ 	    to = string_convert(&vc, buf, &i);
+ 	    if (to != NULL)
+ 	    {
+ 		val = utf_ptr2char(to);
+ 		vim_free(to);
+ 	    }
+ 	    (void)convert_setup(&vc, NULL, NULL);
+ 	}
+     }
+ #endif
+ 
      for (use_defaults = 0; use_defaults <= 1; use_defaults++)
      {
  	if (use_defaults == 0)
*** ../vim-8.1.0058/src/testdir/test_digraph.vim	2018-02-27 21:08:09.000000000 +0100
--- src/testdir/test_digraph.vim	2018-06-16 17:15:21.629331405 +0200
***************
*** 465,468 ****
--- 465,480 ----
    bwipe!
  endfunc
  
+ func Test_show_digraph_cp1251()
+   if !has('multi_byte')
+     return
+   endif
+   new
+   set encoding=cp1251
+   call Put_Dig("='")
+   call assert_equal("\n<\xfa>  <|z>  <M-z>  250,  Hex fa,  Oct 372, Digr ='", execute('ascii'))
+   set encoding=utf-8
+   bwipe!
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.1.0058/src/version.c	2018-06-16 16:20:48.772597946 +0200
--- src/version.c	2018-06-16 17:07:11.244898262 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     59,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
53. To find out what time it is, you send yourself an e-mail and check the
    "Date:" field.

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