comparison src/screen.c @ 29090:9b292596a332 v8.2.5066

patch 8.2.5066: timer_create is not available on every Mac system Commit: https://github.com/vim/vim/commit/aca12fd89b082dd9cc12ae085a84f1805747bbdf Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 7 10:16:15 2022 +0100 patch 8.2.5066: timer_create is not available on every Mac system Problem: Timer_create is not available on every Mac system. (Hisashi T Fujinaka) Solution: Adjust #ifdef.
author Bram Moolenaar <Bram@vim.org>
date Tue, 07 Jun 2022 11:30:04 +0200
parents b90bca860b5a
children cff23287478f
comparison
equal deleted inserted replaced
29089:71d4dc25eb4b 29090:9b292596a332
4829 * Returns error message, NULL if it's OK. 4829 * Returns error message, NULL if it's OK.
4830 */ 4830 */
4831 char * 4831 char *
4832 set_chars_option(win_T *wp, char_u **varp) 4832 set_chars_option(win_T *wp, char_u **varp)
4833 { 4833 {
4834 int round, i, len, entries; 4834 int round, i, len, len2, entries;
4835 char_u *p, *s; 4835 char_u *p, *s;
4836 int c1 = 0, c2 = 0, c3 = 0; 4836 int c1 = 0, c2 = 0, c3 = 0;
4837 char_u *last_multispace = NULL; // Last occurrence of "multispace:" 4837 char_u *last_multispace = NULL; // Last occurrence of "multispace:"
4838 char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
4838 int multispace_len = 0; // Length of lcs-multispace string 4839 int multispace_len = 0; // Length of lcs-multispace string
4840 int lead_multispace_len = 0; // Length of lcs-leadmultispace string
4839 struct charstab 4841 struct charstab
4840 { 4842 {
4841 int *cp; 4843 int *cp;
4842 char *name; 4844 char *name;
4843 }; 4845 };
4907 lcs_chars.multispace = ALLOC_MULT(int, multispace_len + 1); 4909 lcs_chars.multispace = ALLOC_MULT(int, multispace_len + 1);
4908 lcs_chars.multispace[multispace_len] = NUL; 4910 lcs_chars.multispace[multispace_len] = NUL;
4909 } 4911 }
4910 else 4912 else
4911 lcs_chars.multispace = NULL; 4913 lcs_chars.multispace = NULL;
4914
4915 if (lead_multispace_len > 0)
4916 {
4917 lcs_chars.leadmultispace = ALLOC_MULT(int, lead_multispace_len + 1);
4918 lcs_chars.leadmultispace[lead_multispace_len] = NUL;
4919 }
4920 else
4921 lcs_chars.leadmultispace = NULL;
4912 } 4922 }
4913 else 4923 else
4914 { 4924 {
4915 fill_diff = '-'; 4925 fill_diff = '-';
4916 fill_foldopen = '-'; 4926 fill_foldopen = '-';
4970 } 4980 }
4971 4981
4972 if (i == entries) 4982 if (i == entries)
4973 { 4983 {
4974 len = (int)STRLEN("multispace"); 4984 len = (int)STRLEN("multispace");
4985 len2 = (int)STRLEN("leadmultispace");
4975 if ((varp == &p_lcs || varp == &wp->w_p_lcs) 4986 if ((varp == &p_lcs || varp == &wp->w_p_lcs)
4976 && STRNCMP(p, "multispace", len) == 0 4987 && STRNCMP(p, "multispace", len) == 0
4977 && p[len] == ':' 4988 && p[len] == ':'
4978 && p[len + 1] != NUL) 4989 && p[len + 1] != NUL)
4979 { 4990 {
5006 lcs_chars.multispace[multispace_pos++] = c1; 5017 lcs_chars.multispace[multispace_pos++] = c1;
5007 } 5018 }
5008 p = s; 5019 p = s;
5009 } 5020 }
5010 } 5021 }
5022
5023 else if ((varp == &p_lcs || varp == &wp->w_p_lcs)
5024 && STRNCMP(p, "leadmultispace", len2) == 0
5025 && p[len2] == ':'
5026 && p[len2 + 1] != NUL)
5027 {
5028 s = p + len2 + 1;
5029 if (round == 0)
5030 {
5031 // Get length of lcsmultispace string in first round
5032 last_lmultispace = p;
5033 lead_multispace_len = 0;
5034 while (*s != NUL && *s != ',')
5035 {
5036 c1 = get_encoded_char_adv(&s);
5037 if (char2cells(c1) > 1)
5038 return e_invalid_argument;
5039 ++lead_multispace_len;
5040 }
5041 if (lead_multispace_len == 0)
5042 // lcsmultispace cannot be an empty string
5043 return e_invalid_argument;
5044 p = s;
5045 }
5046 else
5047 {
5048 int multispace_pos = 0;
5049
5050 while (*s != NUL && *s != ',')
5051 {
5052 c1 = get_encoded_char_adv(&s);
5053 if (p == last_lmultispace)
5054 lcs_chars.leadmultispace[multispace_pos++] = c1;
5055 }
5056 p = s;
5057 }
5058 }
5011 else 5059 else
5012 return e_invalid_argument; 5060 return e_invalid_argument;
5013 } 5061 }
5014 5062
5015 if (*p == ',') 5063 if (*p == ',')
5018 } 5066 }
5019 if (tab == lcstab) 5067 if (tab == lcstab)
5020 { 5068 {
5021 if (wp->w_lcs_chars.multispace != NULL) 5069 if (wp->w_lcs_chars.multispace != NULL)
5022 vim_free(wp->w_lcs_chars.multispace); 5070 vim_free(wp->w_lcs_chars.multispace);
5071 if (wp->w_lcs_chars.leadmultispace != NULL)
5072 vim_free(wp->w_lcs_chars.leadmultispace);
5023 wp->w_lcs_chars = lcs_chars; 5073 wp->w_lcs_chars = lcs_chars;
5024 } 5074 }
5025 5075
5026 return NULL; // no error 5076 return NULL; // no error
5027 } 5077 }