Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/screen.c +++ b/src/screen.c @@ -4831,11 +4831,13 @@ get_encoded_char_adv(char_u **p) 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 @@ set_chars_option(win_T *wp, char_u **var } 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 @@ set_chars_option(win_T *wp, char_u **var 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 @@ set_chars_option(win_T *wp, char_u **var 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 @@ set_chars_option(win_T *wp, char_u **var { 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; }