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.
diff --git a/src/screen.c b/src/screen.c
index 29ccd3e..5035879 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4831,11 +4831,13 @@
char *
set_chars_option(win_T *wp, char_u **varp)
{
- int round, i, len, entries;
+ int round, i, len, len2, entries;
char_u *p, *s;
int c1 = 0, c2 = 0, c3 = 0;
char_u *last_multispace = NULL; // Last occurrence of "multispace:"
+ char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
int multispace_len = 0; // Length of lcs-multispace string
+ int lead_multispace_len = 0; // Length of lcs-leadmultispace string
struct charstab
{
int *cp;
@@ -4909,6 +4911,14 @@
}
else
lcs_chars.multispace = NULL;
+
+ if (lead_multispace_len > 0)
+ {
+ lcs_chars.leadmultispace = ALLOC_MULT(int, lead_multispace_len + 1);
+ lcs_chars.leadmultispace[lead_multispace_len] = NUL;
+ }
+ else
+ lcs_chars.leadmultispace = NULL;
}
else
{
@@ -4972,6 +4982,7 @@
if (i == entries)
{
len = (int)STRLEN("multispace");
+ len2 = (int)STRLEN("leadmultispace");
if ((varp == &p_lcs || varp == &wp->w_p_lcs)
&& STRNCMP(p, "multispace", len) == 0
&& p[len] == ':'
@@ -5008,6 +5019,43 @@
p = s;
}
}
+
+ else if ((varp == &p_lcs || varp == &wp->w_p_lcs)
+ && STRNCMP(p, "leadmultispace", len2) == 0
+ && p[len2] == ':'
+ && p[len2 + 1] != NUL)
+ {
+ s = p + len2 + 1;
+ if (round == 0)
+ {
+ // Get length of lcsmultispace string in first round
+ last_lmultispace = p;
+ lead_multispace_len = 0;
+ while (*s != NUL && *s != ',')
+ {
+ c1 = get_encoded_char_adv(&s);
+ if (char2cells(c1) > 1)
+ return e_invalid_argument;
+ ++lead_multispace_len;
+ }
+ if (lead_multispace_len == 0)
+ // lcsmultispace cannot be an empty string
+ return e_invalid_argument;
+ p = s;
+ }
+ else
+ {
+ int multispace_pos = 0;
+
+ while (*s != NUL && *s != ',')
+ {
+ c1 = get_encoded_char_adv(&s);
+ if (p == last_lmultispace)
+ lcs_chars.leadmultispace[multispace_pos++] = c1;
+ }
+ p = s;
+ }
+ }
else
return e_invalid_argument;
}
@@ -5020,6 +5068,8 @@
{
if (wp->w_lcs_chars.multispace != NULL)
vim_free(wp->w_lcs_chars.multispace);
+ if (wp->w_lcs_chars.leadmultispace != NULL)
+ vim_free(wp->w_lcs_chars.leadmultispace);
wp->w_lcs_chars = lcs_chars;
}