mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	refactor(optionstr.c): break up did_set_string_option 47
This commit is contained in:
		| @@ -1187,6 +1187,43 @@ static void did_set_clipboard(char **errmsg) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void did_set_spellfile(char **varp, char **errmsg) | ||||||
|  | { | ||||||
|  |   // When there is a window for this buffer in which 'spell' | ||||||
|  |   // is set load the wordlists. | ||||||
|  |  | ||||||
|  |   if ((!valid_spellfile(*varp))) { | ||||||
|  |     *errmsg = e_invarg; | ||||||
|  |   } else { | ||||||
|  |     *errmsg = did_set_spell_option(true); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void did_set_spell(char **varp, char **errmsg) | ||||||
|  | { | ||||||
|  |   // When there is a window for this buffer in which 'spell' | ||||||
|  |   // is set load the wordlists. | ||||||
|  |   if (!valid_spelllang(*varp)) { | ||||||
|  |     *errmsg = e_invarg; | ||||||
|  |   } else { | ||||||
|  |     *errmsg = did_set_spell_option(false); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void did_set_spellcapcheck(win_T *win, char **errmsg) | ||||||
|  | { | ||||||
|  |   // When 'spellcapcheck' is set compile the regexp program. | ||||||
|  |   *errmsg = compile_cap_prog(win->w_s); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static void did_set_spelloptions(win_T *win, char **errmsg) | ||||||
|  | { | ||||||
|  |   if (opt_strings_flags(win->w_s->b_p_spo, p_spo_values, &(win->w_s->b_p_spo_flags), | ||||||
|  |                         true) != OK) { | ||||||
|  |     *errmsg = e_invarg; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
| static void did_set_spellsuggest(char **errmsg) | static void did_set_spellsuggest(char **errmsg) | ||||||
| { | { | ||||||
|   if (spell_check_sps() != OK) { |   if (spell_check_sps() != OK) { | ||||||
| @@ -1201,6 +1238,14 @@ static void did_set_mkspellmem(char **errmsg) | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void did_set_bufhidden(buf_T *buf, char **errmsg) | ||||||
|  | { | ||||||
|  |   // When 'bufhidden' is set, check for valid value. | ||||||
|  |   if (check_opt_strings(buf->b_p_bh, p_bufhidden_values, false) != OK) { | ||||||
|  |     *errmsg = e_invarg; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
| static void did_set_buftype(buf_T *buf, win_T *win, char **errmsg) | static void did_set_buftype(buf_T *buf, win_T *win, char **errmsg) | ||||||
| { | { | ||||||
|   // When 'buftype' is set, check for valid value. |   // When 'buftype' is set, check for valid value. | ||||||
| @@ -1672,35 +1717,20 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf | |||||||
|     did_set_eoddirection(&errmsg); |     did_set_eoddirection(&errmsg); | ||||||
|   } else if (varp == &p_cb) {  // 'clipboard' |   } else if (varp == &p_cb) {  // 'clipboard' | ||||||
|     did_set_clipboard(&errmsg); |     did_set_clipboard(&errmsg); | ||||||
|   } else if (varp == &(curwin->w_s->b_p_spl)  // 'spell' |   } else if (varp == &(curwin->w_s->b_p_spf)) { | ||||||
|              || varp == &(curwin->w_s->b_p_spf)) { |     did_set_spellfile(varp, &errmsg); | ||||||
|     // When 'spelllang' or 'spellfile' is set and there is a window for this |   } else if (varp == &(curwin->w_s->b_p_spl)) {  // 'spell' | ||||||
|     // buffer in which 'spell' is set load the wordlists. |     did_set_spell(varp, &errmsg); | ||||||
|     const bool is_spellfile = varp == &(curwin->w_s->b_p_spf); |  | ||||||
|  |  | ||||||
|     if ((is_spellfile && !valid_spellfile(*varp)) |  | ||||||
|         || (!is_spellfile && !valid_spelllang(*varp))) { |  | ||||||
|       errmsg = e_invarg; |  | ||||||
|     } else { |  | ||||||
|       errmsg = did_set_spell_option(is_spellfile); |  | ||||||
|     } |  | ||||||
|   } else if (varp == &(curwin->w_s->b_p_spc)) { |   } else if (varp == &(curwin->w_s->b_p_spc)) { | ||||||
|     // When 'spellcapcheck' is set compile the regexp program. |     did_set_spellcapcheck(curwin, &errmsg); | ||||||
|     errmsg = compile_cap_prog(curwin->w_s); |  | ||||||
|   } else if (varp == &(curwin->w_s->b_p_spo)) {  // 'spelloptions' |   } else if (varp == &(curwin->w_s->b_p_spo)) {  // 'spelloptions' | ||||||
|     if (opt_strings_flags(curwin->w_s->b_p_spo, p_spo_values, &(curwin->w_s->b_p_spo_flags), |     did_set_spelloptions(curwin, &errmsg); | ||||||
|                           true) != OK) { |  | ||||||
|       errmsg = e_invarg; |  | ||||||
|     } |  | ||||||
|   } else if (varp == &p_sps) {  // 'spellsuggest' |   } else if (varp == &p_sps) {  // 'spellsuggest' | ||||||
|     did_set_spellsuggest(&errmsg); |     did_set_spellsuggest(&errmsg); | ||||||
|   } else if (varp == &p_msm) {  // 'mkspellmem' |   } else if (varp == &p_msm) {  // 'mkspellmem' | ||||||
|     did_set_mkspellmem(&errmsg); |     did_set_mkspellmem(&errmsg); | ||||||
|   } else if (gvarp == &p_bh) { |   } else if (gvarp == &p_bh) { | ||||||
|     // When 'bufhidden' is set, check for valid value. |     did_set_bufhidden(curbuf, &errmsg); | ||||||
|     if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, false) != OK) { |  | ||||||
|       errmsg = e_invarg; |  | ||||||
|     } |  | ||||||
|   } else if (gvarp == &p_bt) {  // 'buftype' |   } else if (gvarp == &p_bt) {  // 'buftype' | ||||||
|     did_set_buftype(curbuf, curwin, &errmsg); |     did_set_buftype(curbuf, curwin, &errmsg); | ||||||
|   } else if (gvarp == &p_stl || gvarp == &p_wbr || varp == &p_tal |   } else if (gvarp == &p_stl || gvarp == &p_wbr || varp == &p_tal | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Lewis Russell
					Lewis Russell