Mercurial > vim
comparison src/spell.c @ 31996:ca6bc7c04163 v9.0.1330
patch 9.0.1330: handling new value of an option has a long "else if" chain
Commit: https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon Feb 20 12:16:39 2023 +0000
patch 9.0.1330: handling new value of an option has a long "else if" chain
Problem: Handling new value of an option has a long "else if" chain.
Solution: Use a function pointer. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/12015)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 Feb 2023 13:30:05 +0100 |
parents | 9f28cca2410a |
children | 0632606a2530 |
comparison
equal
deleted
inserted
replaced
31995:95971aa5e525 | 31996:ca6bc7c04163 |
---|---|
1985 /* | 1985 /* |
1986 * Parse 'spelllang' and set w_s->b_langp accordingly. | 1986 * Parse 'spelllang' and set w_s->b_langp accordingly. |
1987 * Returns NULL if it's OK, an untranslated error message otherwise. | 1987 * Returns NULL if it's OK, an untranslated error message otherwise. |
1988 */ | 1988 */ |
1989 char * | 1989 char * |
1990 did_set_spelllang(win_T *wp) | 1990 parse_spelllang(win_T *wp) |
1991 { | 1991 { |
1992 garray_T ga; | 1992 garray_T ga; |
1993 char_u *splp; | 1993 char_u *splp; |
1994 char_u *region; | 1994 char_u *region; |
1995 char_u region_cp[3]; | 1995 char_u region_cp[3]; |
2501 // window for this buffer in which 'spell' is set. | 2501 // window for this buffer in which 'spell' is set. |
2502 if (*wp->w_s->b_p_spl != NUL) | 2502 if (*wp->w_s->b_p_spl != NUL) |
2503 { | 2503 { |
2504 if (wp->w_p_spell) | 2504 if (wp->w_p_spell) |
2505 { | 2505 { |
2506 (void)did_set_spelllang(wp); | 2506 (void)parse_spelllang(wp); |
2507 break; | 2507 break; |
2508 } | 2508 } |
2509 } | 2509 } |
2510 } | 2510 } |
2511 } | 2511 } |
4408 return errmsg; | 4408 return errmsg; |
4409 | 4409 |
4410 FOR_ALL_WINDOWS(wp) | 4410 FOR_ALL_WINDOWS(wp) |
4411 if (wp->w_buffer == curbuf && wp->w_p_spell) | 4411 if (wp->w_buffer == curbuf && wp->w_p_spell) |
4412 { | 4412 { |
4413 errmsg = did_set_spelllang(wp); | 4413 errmsg = parse_spelllang(wp); |
4414 break; | 4414 break; |
4415 } | 4415 } |
4416 return errmsg; | 4416 return errmsg; |
4417 } | 4417 } |
4418 | 4418 |