Mercurial > vim
comparison src/option.c @ 18068:1101eacc1444 v8.1.2029
patch 8.1.2029: cannot control 'cursorline' highlighting well
Commit: https://github.com/vim/vim/commit/017ba07fa2cdc578245618717229444fd50c470d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 14 21:01:23 2019 +0200
patch 8.1.2029: cannot control 'cursorline' highlighting well
Problem: Cannot control 'cursorline' highlighting well.
Solution: Add "screenline". (Christian Brabandt, closes https://github.com/vim/vim/issues/4933)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 14 Sep 2019 21:15:04 +0200 |
parents | 88b5c2b4e3d2 |
children | df5778d73320 |
comparison
equal
deleted
inserted
replaced
18067:9e20b59dd8ab | 18068:1101eacc1444 |
---|---|
85 static int opt_strings_flags(char_u *val, char **values, unsigned *flagp, int list); | 85 static int opt_strings_flags(char_u *val, char **values, unsigned *flagp, int list); |
86 static int check_opt_strings(char_u *val, char **values, int); | 86 static int check_opt_strings(char_u *val, char **values, int); |
87 static int check_opt_wim(void); | 87 static int check_opt_wim(void); |
88 #ifdef FEAT_LINEBREAK | 88 #ifdef FEAT_LINEBREAK |
89 static int briopt_check(win_T *wp); | 89 static int briopt_check(win_T *wp); |
90 #endif | |
91 #ifdef FEAT_SYN_HL | |
92 static int fill_culopt_flags(char_u *val, win_T *wp); | |
90 #endif | 93 #endif |
91 | 94 |
92 /* | 95 /* |
93 * Initialize the options, first part. | 96 * Initialize the options, first part. |
94 * | 97 * |
2445 #endif | 2448 #endif |
2446 #ifdef FEAT_LINEBREAK | 2449 #ifdef FEAT_LINEBREAK |
2447 /* initialize the table for 'breakat'. */ | 2450 /* initialize the table for 'breakat'. */ |
2448 fill_breakat_flags(); | 2451 fill_breakat_flags(); |
2449 #endif | 2452 #endif |
2450 | 2453 #ifdef FEAT_SYN_HL |
2454 fill_culopt_flags(NULL, curwin); | |
2455 #endif | |
2451 } | 2456 } |
2452 | 2457 |
2453 /* | 2458 /* |
2454 * More side effects of setting options. | 2459 * More side effects of setting options. |
2455 */ | 2460 */ |
3134 #ifdef FEAT_SYN_HL | 3139 #ifdef FEAT_SYN_HL |
3135 /* 'cursorlineopt' */ | 3140 /* 'cursorlineopt' */ |
3136 else if (varp == &curwin->w_p_culopt | 3141 else if (varp == &curwin->w_p_culopt |
3137 || gvarp == &curwin->w_allbuf_opt.wo_culopt) | 3142 || gvarp == &curwin->w_allbuf_opt.wo_culopt) |
3138 { | 3143 { |
3139 if (**varp == NUL | 3144 if (**varp == NUL || fill_culopt_flags(*varp, curwin) != OK) |
3140 || check_opt_strings(*varp, p_culopt_values, FALSE) != OK) | |
3141 errmsg = e_invarg; | 3145 errmsg = e_invarg; |
3142 } | 3146 } |
3143 | 3147 |
3144 /* 'colorcolumn' */ | 3148 /* 'colorcolumn' */ |
3145 else if (varp == &curwin->w_p_cc) | 3149 else if (varp == &curwin->w_p_cc) |
7779 copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt); | 7783 copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt); |
7780 copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt); | 7784 copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt); |
7781 #if defined(FEAT_LINEBREAK) | 7785 #if defined(FEAT_LINEBREAK) |
7782 briopt_check(wp_to); | 7786 briopt_check(wp_to); |
7783 #endif | 7787 #endif |
7788 #ifdef FEAT_SYN_HL | |
7789 fill_culopt_flags(NULL, wp_to); | |
7790 #endif | |
7784 } | 7791 } |
7785 | 7792 |
7786 /* | 7793 /* |
7787 * Copy the options from one winopt_T to another. | 7794 * Copy the options from one winopt_T to another. |
7788 * Doesn't free the old option values in "to", use clear_winopt() for that. | 7795 * Doesn't free the old option values in "to", use clear_winopt() for that. |
9513 } | 9520 } |
9514 | 9521 |
9515 return d; | 9522 return d; |
9516 } | 9523 } |
9517 #endif | 9524 #endif |
9525 | |
9526 #ifdef FEAT_SYN_HL | |
9527 /* | |
9528 * This is called when 'culopt' is changed | |
9529 */ | |
9530 static int | |
9531 fill_culopt_flags(char_u *val, win_T *wp) | |
9532 { | |
9533 char_u *p; | |
9534 char_u culopt_flags_new = 0; | |
9535 | |
9536 if (val == NULL) | |
9537 p = wp->w_p_culopt; | |
9538 else | |
9539 p = val; | |
9540 while (*p != NUL) | |
9541 { | |
9542 if (STRNCMP(p, "line", 4) == 0) | |
9543 { | |
9544 p += 4; | |
9545 culopt_flags_new |= CULOPT_LINE; | |
9546 } | |
9547 else if (STRNCMP(p, "both", 4) == 0) | |
9548 { | |
9549 p += 4; | |
9550 culopt_flags_new |= CULOPT_LINE | CULOPT_NBR; | |
9551 } | |
9552 else if (STRNCMP(p, "number", 6) == 0) | |
9553 { | |
9554 p += 6; | |
9555 culopt_flags_new |= CULOPT_NBR; | |
9556 } | |
9557 else if (STRNCMP(p, "screenline", 10) == 0) | |
9558 { | |
9559 p += 10; | |
9560 culopt_flags_new |= CULOPT_SCRLINE; | |
9561 } | |
9562 | |
9563 if (*p != ',' && *p != NUL) | |
9564 return FAIL; | |
9565 if (*p == ',') | |
9566 ++p; | |
9567 } | |
9568 | |
9569 // Can't have both "line" and "screenline". | |
9570 if ((culopt_flags_new & CULOPT_LINE) && (culopt_flags_new & CULOPT_SCRLINE)) | |
9571 return FAIL; | |
9572 wp->w_p_culopt_flags = culopt_flags_new; | |
9573 | |
9574 return OK; | |
9575 } | |
9576 #endif |