summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0512
blob: a101a0bba4e4bf84f82baa4a50e8990a9baee0d4 (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0512
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.0512
Problem:    'helplang' default is inconsistent for C and C.UTF-8.
Solution:   Don't accept a value unless it starts with two letters.
Files:      src/ex_cmds2.c


*** ../vim-8.1.0511/src/ex_cmds2.c	2018-10-14 21:40:57.356848425 +0200
--- src/ex_cmds2.c	2018-11-05 20:19:07.922777334 +0100
***************
*** 5359,5364 ****
--- 5359,5374 ----
  
  #if defined(FEAT_MULTI_LANG) || defined(PROTO)
  /*
+  * Return TRUE when "lang" starts with a valid language name.
+  * Rejects NULL, empty string, "C", "C.UTF-8" and others.
+  */
+     static int
+ is_valid_mess_lang(char_u *lang)
+ {
+     return lang != NULL && ASCII_ISALPHA(lang[0]) && ASCII_ISALPHA(lang[1]);
+ }
+ 
+ /*
   * Obtain the current messages language.  Used to set the default for
   * 'helplang'.  May return NULL or an empty string.
   */
***************
*** 5379,5395 ****
  #  endif
  # else
      p = mch_getenv((char_u *)"LC_ALL");
!     if (p == NULL || *p == NUL)
      {
  	p = mch_getenv((char_u *)"LC_MESSAGES");
! 	if (p == NULL || *p == NUL)
  	    p = mch_getenv((char_u *)"LANG");
      }
  # endif
  # ifdef WIN32
      p = gettext_lang(p);
  # endif
!     return p;
  }
  #endif
  
--- 5389,5405 ----
  #  endif
  # else
      p = mch_getenv((char_u *)"LC_ALL");
!     if (!is_valid_mess_lang(p))
      {
  	p = mch_getenv((char_u *)"LC_MESSAGES");
! 	if (!is_valid_mess_lang(p))
  	    p = mch_getenv((char_u *)"LANG");
      }
  # endif
  # ifdef WIN32
      p = gettext_lang(p);
  # endif
!     return is_valid_mess_lang(p) ? p : NULL;
  }
  #endif
  
*** ../vim-8.1.0511/src/version.c	2018-11-04 23:39:33.953644902 +0100
--- src/version.c	2018-11-05 20:24:20.654263866 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     512,
  /**/

-- 
Nothing is impossible for the man who doesn't have to do it.

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