Mercurial > vim
changeset 744:07f7b4a7755c
updated for version 7.0222
author | vimboss |
---|---|
date | Sun, 12 Mar 2006 22:08:12 +0000 |
parents | afac7b58ed46 |
children | d41f5f59266e |
files | src/edit.c src/globals.h src/hardcopy.c src/option.c src/option.h src/structs.h |
diffstat | 6 files changed, 110 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/src/edit.c +++ b/src/edit.c @@ -169,7 +169,7 @@ static void internal_format __ARGS((int static void check_auto_format __ARGS((int)); static void redo_literal __ARGS((int c)); static void start_arrow __ARGS((pos_T *end_insert_pos)); -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL static void check_spell_redraw __ARGS((void)); static void spell_back_to_badword __ARGS((void)); static int spell_bad_len = 0; /* length of located bad word */ @@ -1911,7 +1911,10 @@ has_compl_option(dict_opt) int dict_opt; { if (dict_opt ? (*curbuf->b_p_dict == NUL && *p_dict == NUL - && !curwin->w_p_spell) +# ifdef FEAT_SPELL + && !curwin->w_p_spell +# endif + ) : (*curbuf->b_p_tsr == NUL && *p_tsr == NUL)) { ctrl_x_mode = 0; @@ -2333,7 +2336,7 @@ set_completion(startcol, list) if (stop_arrow() == FAIL) return; - if (startcol > curwin->w_cursor.col) + if (startcol > (int)curwin->w_cursor.col) startcol = curwin->w_cursor.col; compl_col = startcol; compl_length = curwin->w_cursor.col - startcol; @@ -2589,7 +2592,7 @@ ins_compl_dictionaries(dict_start, pat, if (*dict == NUL) { -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL /* When 'dictionary' is empty and spell checking is enabled use * "spell". */ if (!thesaurus && curwin->w_p_spell) @@ -2644,14 +2647,18 @@ ins_compl_dictionaries(dict_start, pat, * backticks (for security, the 'dict' option may have been set in * a modeline). */ copy_option_part(&dict, buf, LSIZE, ","); +# ifdef FEAT_SPELL if (!thesaurus && STRCMP(buf, "spell") == 0) count = -1; - else if (vim_strchr(buf, '`') != NULL + else +# endif + if (vim_strchr(buf, '`') != NULL || expand_wildcards(1, &buf, &count, &files, EW_FILE|EW_SILENT) != OK) count = 0; } +# ifdef FEAT_SPELL if (count == -1) { /* Complete from active spelling. Skip "\<" in the pattern, we @@ -2663,6 +2670,7 @@ ins_compl_dictionaries(dict_start, pat, spell_dump_compl(curbuf, ptr, regmatch.rm_ic, &dir, 0); } else +# endif { ins_compl_files(count, files, thesaurus, flags, ®match, buf, &dir); @@ -3116,7 +3124,7 @@ ins_compl_prep(c) case 's': case Ctrl_S: ctrl_x_mode = CTRL_X_SPELL; -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL spell_back_to_badword(); #endif break; @@ -3646,7 +3654,7 @@ ins_compl_get_exp(ini) #endif case CTRL_X_SPELL: -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL num_matches = expand_spelling(first_match_pos.lnum, first_match_pos.col, compl_pattern, &matches); if (num_matches > 0) @@ -4445,7 +4453,7 @@ ins_complete(c) } else if (ctrl_x_mode == CTRL_X_SPELL) { -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL if (spell_bad_len > 0) compl_col = curs_col - spell_bad_len; else @@ -5718,12 +5726,12 @@ start_arrow(end_insert_pos) stop_insert(end_insert_pos, FALSE); arrow_used = TRUE; /* this means we stopped the current insert */ } -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL check_spell_redraw(); #endif } -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL /* * If we skipped highlighting word at cursor, do it now. * It may be skipped again, thus reset spell_redraw_lnum first. @@ -7303,7 +7311,7 @@ ins_esc(count, cmdchar, nomove) int temp; static int disabled_redraw = FALSE; -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL check_spell_redraw(); #endif #if defined(FEAT_HANGULIN)
--- a/src/globals.h +++ b/src/globals.h @@ -1271,7 +1271,9 @@ EXTERN int virtual_op INIT(= MAYBE); #ifdef FEAT_SYN_HL /* Display tick, incremented for each call to update_screen() */ EXTERN disptick_T display_tick INIT(= 0); +#endif +#ifdef FEAT_SPELL /* Line in which spell checking wasn't highlighted because it touched the * cursor position in Insert mode. */ EXTERN linenr_T spell_redraw_lnum INIT(= 0);
--- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -148,7 +148,9 @@ static void prt_line_number __ARGS((prt_ static void prt_header __ARGS((prt_settings_T *psettings, int pagenum, linenr_T lnum)); static void prt_message __ARGS((char_u *s)); static colnr_T hardcopy_line __ARGS((prt_settings_T *psettings, int page_line, prt_pos_T *ppos)); +#ifdef FEAT_SYN_HL static void prt_get_attr __ARGS((int hl_id, prt_text_attr_T* pattr, int modec)); +#endif /* * Parse 'printoptions' and set the flags in "printer_opts". @@ -566,7 +568,6 @@ ex_hardcopy(eap) long_u bytes_to_print = 0; int page_line; int jobsplit; - int id; memset(&settings, 0, sizeof(prt_settings_T)); settings.has_color = TRUE; @@ -638,13 +639,15 @@ ex_hardcopy(eap) */ if (prt_use_number() && settings.do_syntax) { + int id; + id = syn_name2id((char_u *)"LineNr"); if (id > 0) id = syn_get_final_id(id); prt_get_attr(id, &settings.number, settings.modec); } -#endif /* FEAT_SYN_HL */ +#endif /* * Estimate the total lines to be printed @@ -890,7 +893,7 @@ hardcopy_line(psettings, page_line, ppos prt_set_bg(attr.bg_color); } } -#endif /* FEAT_SYN_HL */ +#endif /* * Appropriately expand any tabs to spaces.
--- a/src/option.c +++ b/src/option.c @@ -156,10 +156,12 @@ #endif #ifdef FEAT_SYN_HL # define PV_SMC OPT_BUF(BV_SMC) +# define PV_SYN OPT_BUF(BV_SYN) +#endif +#ifdef FEAT_SPELL # define PV_SPC OPT_BUF(BV_SPC) # define PV_SPF OPT_BUF(BV_SPF) # define PV_SPL OPT_BUF(BV_SPL) -# define PV_SYN OPT_BUF(BV_SYN) #endif #define PV_STS OPT_BUF(BV_STS) #ifdef FEAT_SEARCHPATH @@ -216,8 +218,12 @@ # define PV_SCBIND OPT_WIN(WV_SCBIND) #endif #define PV_SCROLL OPT_WIN(WV_SCROLL) +#ifdef FEAT_SPELL +# define PV_SPELL OPT_WIN(WV_SPELL) +#endif #ifdef FEAT_SYN_HL -# define PV_SPELL OPT_WIN(WV_SPELL) +# define PV_CUC OPT_WIN(WV_CUC) +# define PV_CUL OPT_WIN(WV_CUL) #endif #ifdef FEAT_STL_OPT # define PV_STL OPT_BOTH(OPT_WIN(WV_STL)) @@ -335,6 +341,8 @@ static int p_swf; #ifdef FEAT_SYN_HL static long p_smc; static char_u *p_syn; +#endif +#ifdef FEAT_SPELL static char_u *p_spc; static char_u *p_spf; static char_u *p_spl; @@ -840,6 +848,20 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)0L, (char_u *)0L}}, + {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWIN, +#ifdef FEAT_SYN_HL + (char_u *)VAR_WIN, PV_CUC, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)FALSE, (char_u *)0L}}, + {"cursorline", "cul", P_BOOL|P_VI_DEF|P_RWIN, +#ifdef FEAT_SYN_HL + (char_u *)VAR_WIN, PV_CUL, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)FALSE, (char_u *)0L}}, {"debug", NULL, P_STRING|P_VI_DEF, (char_u *)&p_debug, PV_NONE, {(char_u *)"", (char_u *)0L}}, @@ -1251,7 +1273,7 @@ static struct vimoption {(char_u *)FALSE, (char_u *)0L}}, {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, (char_u *)&p_hl, PV_NONE, - {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill", + {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine", (char_u *)0L}}, {"history", "hi", P_NUM|P_VIM, (char_u *)&p_hi, PV_NONE, @@ -1648,7 +1670,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L}}, {"mkspellmem", "msm", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE, -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (char_u *)&p_msm, PV_NONE, {(char_u *)"460000,2000,500", (char_u *)0L} #else @@ -2198,14 +2220,14 @@ static struct vimoption (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L}}, {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN, -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (char_u *)VAR_WIN, PV_SPELL, #else (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L}}, {"spellcapcheck", "spc", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF, -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (char_u *)&p_spc, PV_SPC, {(char_u *)"[.?!]\\_[\\])'\" ]\\+", (char_u *)0L} #else @@ -2214,7 +2236,7 @@ static struct vimoption #endif }, {"spellfile", "spf", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE|P_COMMA, -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (char_u *)&p_spf, PV_SPF, {(char_u *)"", (char_u *)0L} #else @@ -2223,7 +2245,7 @@ static struct vimoption #endif }, {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF|P_EXPAND, -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (char_u *)&p_spl, PV_SPL, {(char_u *)"en", (char_u *)0L} #else @@ -2232,7 +2254,7 @@ static struct vimoption #endif }, {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE, -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (char_u *)&p_sps, PV_NONE, {(char_u *)"best", (char_u *)0L} #else @@ -2808,7 +2830,7 @@ static char_u *set_chars_option __ARGS(( #ifdef FEAT_CLIPBOARD static char_u *check_clipboard_option __ARGS((void)); #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL static char_u *compile_cap_prog __ARGS((buf_T *buf)); #endif #ifdef FEAT_EVAL @@ -3069,7 +3091,7 @@ set_init_1() /* Must be before option_expand(), because that one needs vim_isIDc() */ didset_options(); -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL /* Use the current chartab for the generic chartab. */ init_spell_chartab(); #endif @@ -4866,7 +4888,7 @@ option_expand(opt_idx, val) */ expand_env_esc(val, NameBuff, MAXPATHL, (char_u **)options[opt_idx].var == &p_tags, -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : #endif NULL); @@ -4902,7 +4924,7 @@ didset_options() #if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS)) (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE); #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL (void)spell_check_msm(); (void)spell_check_sps(); (void)compile_cap_prog(curbuf); @@ -4981,6 +5003,8 @@ check_buf_options(buf) #endif #ifdef FEAT_SYN_HL check_string_option(&buf->b_p_syn); +#endif +#ifdef FEAT_SPELL check_string_option(&buf->b_p_spc); check_string_option(&buf->b_p_spf); check_string_option(&buf->b_p_spl); @@ -6115,7 +6139,7 @@ did_set_string_option(opt_idx, varp, new errmsg = check_clipboard_option(); #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL /* When 'spelllang' or 'spellfile' is set and there is a window for this * buffer in which 'spell' is set load the wordlists. */ else if (varp == &(curbuf->b_p_spl) || varp == &(curbuf->b_p_spf)) @@ -6537,7 +6561,7 @@ did_set_string_option(opt_idx, varp, new curbuf->b_fname, TRUE, curbuf); } #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL if (varp == &(curbuf->b_p_spl)) { char_u fname[200]; @@ -6837,7 +6861,7 @@ check_clipboard_option() } #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL /* * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'. * Return error message when failed, NULL when OK. @@ -7043,7 +7067,7 @@ set_bool_option(opt_idx, varp, value, op /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */ else if ((int *)varp == &p_ic && p_hls) { - redraw_all_later(NOT_VALID); + redraw_all_later(SOME_VALID); } #ifdef FEAT_SEARCH_EXTRA @@ -7225,7 +7249,7 @@ set_bool_option(opt_idx, varp, value, op } #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL /* 'spell' */ else if ((int *)varp == &curwin->w_p_spell) { @@ -8807,8 +8831,12 @@ get_varp(p) case PV_ARAB: return (char_u *)&(curwin->w_p_arab); #endif case PV_LIST: return (char_u *)&(curwin->w_p_list); +#ifdef FEAT_SPELL + case PV_SPELL: return (char_u *)&(curwin->w_p_spell); +#endif #ifdef FEAT_SYN_HL - case PV_SPELL: return (char_u *)&(curwin->w_p_spell); + case PV_CUC: return (char_u *)&(curwin->w_p_cuc); + case PV_CUL: return (char_u *)&(curwin->w_p_cul); #endif #ifdef FEAT_DIFF case PV_DIFF: return (char_u *)&(curwin->w_p_diff); @@ -8941,10 +8969,12 @@ get_varp(p) case PV_SWF: return (char_u *)&(curbuf->b_p_swf); #ifdef FEAT_SYN_HL case PV_SMC: return (char_u *)&(curbuf->b_p_smc); + case PV_SYN: return (char_u *)&(curbuf->b_p_syn); +#endif +#ifdef FEAT_SPELL case PV_SPC: return (char_u *)&(curbuf->b_p_spc); case PV_SPF: return (char_u *)&(curbuf->b_p_spf); case PV_SPL: return (char_u *)&(curbuf->b_p_spl); - case PV_SYN: return (char_u *)&(curbuf->b_p_syn); #endif case PV_SW: return (char_u *)&(curbuf->b_p_sw); case PV_TS: return (char_u *)&(curbuf->b_p_ts); @@ -9025,8 +9055,12 @@ copy_winopt(from, to) #ifdef FEAT_SCROLLBIND to->wo_scb = from->wo_scb; #endif +#ifdef FEAT_SPELL + to->wo_spell = from->wo_spell; +#endif #ifdef FEAT_SYN_HL - to->wo_spell = from->wo_spell; + to->wo_cuc = from->wo_cuc; + to->wo_cul = from->wo_cul; #endif #ifdef FEAT_DIFF to->wo_diff = from->wo_diff; @@ -9259,6 +9293,8 @@ buf_copy_options(buf, flags) /* Don't copy 'syntax', it must be set */ buf->b_p_syn = empty_option; buf->b_p_smc = p_smc; +#endif +#ifdef FEAT_SPELL buf->b_p_spc = vim_strsave(p_spc); (void)compile_cap_prog(buf); buf->b_p_spf = vim_strsave(p_spf); @@ -9577,7 +9613,7 @@ set_context_in_set_cmd(xp, arg, opt_flag } } -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL /* for 'spellsuggest' start at "file:" */ if (options[opt_idx].var == (char_u *)&p_sps && STRNCMP(p, "file:", 5) == 0)
--- a/src/option.h +++ b/src/option.h @@ -596,7 +596,7 @@ EXTERN long p_mmt; /* 'maxmemtot' */ #ifdef FEAT_MENU EXTERN long p_mis; /* 'menuitems' */ #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL EXTERN char_u *p_msm; /* 'mkspellmem' */ #endif EXTERN long p_mls; /* 'modelines' */ @@ -718,7 +718,7 @@ EXTERN long p_tpm; /* 'tabpagemax' */ EXTERN char_u *p_tal; /* 'tabline' */ # endif #endif -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL EXTERN char_u *p_sps; /* 'spellsuggest' */ #endif #ifdef FEAT_VERTSPLIT @@ -962,10 +962,12 @@ enum #endif #ifdef FEAT_SYN_HL , BV_SMC + , BV_SYN +#endif +#ifdef FEAT_SPELL , BV_SPC , BV_SPF , BV_SPL - , BV_SYN #endif , BV_STS #ifdef FEAT_SEARCHPATH @@ -1027,10 +1029,12 @@ enum , WV_SCBIND #endif , WV_SCROLL -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL , WV_SPELL - , WV_SPC - , WV_SYN +#endif +#ifdef FEAT_SYN_HL + , WV_CUC + , WV_CUL #endif #ifdef FEAT_STL_OPT , WV_STL
--- a/src/structs.h +++ b/src/structs.h @@ -189,9 +189,15 @@ typedef struct #endif long wo_scr; #define w_p_scr w_onebuf_opt.wo_scr /* 'scroll' */ -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL int wo_spell; -#define w_p_spell w_onebuf_opt.wo_spell /* 'spell' */ +# define w_p_spell w_onebuf_opt.wo_spell /* 'spell' */ +#endif +#ifdef FEAT_SYN_HL + int wo_cuc; +# define w_p_cuc w_onebuf_opt.wo_cuc /* 'cursorcolumn' */ + int wo_cul; +# define w_p_cul w_onebuf_opt.wo_cul /* 'cursorline' */ #endif #ifdef FEAT_STL_OPT char_u *wo_stl; @@ -1099,7 +1105,7 @@ struct dictvar_S #define SYNSPL_NOTOP 2 /* don't spell check toplevel text */ /* avoid #ifdefs for when b_spell is not available */ -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL # define B_SPELL(buf) ((buf)->b_spell) #else # define B_SPELL(buf) (0) @@ -1393,6 +1399,8 @@ struct file_buffer #ifdef FEAT_SYN_HL long b_p_smc; /* 'synmaxcol' */ char_u *b_p_syn; /* 'syntax' */ +#endif +#ifdef FEAT_SPELL char_u *b_p_spc; /* 'spellcapcheck' */ regprog_T *b_cap_prog; /* program for 'spellcapcheck' */ char_u *b_p_spf; /* 'spellfile' */ @@ -1454,7 +1462,7 @@ struct file_buffer */ int b_help; /* TRUE for help file buffer (when set b_p_bt is "help") */ -#ifdef FEAT_SYN_HL +#ifdef FEAT_SPELL int b_spell; /* TRUE for a spell file buffer, most fields are not used! Use the B_SPELL macro to access b_spell without #ifdef. */ @@ -1530,14 +1538,16 @@ struct file_buffer int b_sst_freecount; linenr_T b_sst_check_lnum; short_u b_sst_lasttick; /* last display tick */ +#endif /* FEAT_SYN_HL */ +#ifdef FEAT_SPELL /* for spell checking */ garray_T b_langp; /* list of pointers to slang_T, see spell.c */ char_u b_spell_ismw[256];/* flags: is midword char */ # ifdef FEAT_MBYTE char_u *b_spell_ismw_mb; /* multi-byte midword chars */ # endif -#endif /* FEAT_SYN_HL */ +#endif #ifdef FEAT_SIGNS signlist_T *b_signlist; /* list of signs to draw */