diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-06-25 23:04:51 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-06-25 23:04:51 +0000 |
commit | f461c8e7f8ce2fd2ac3367680ec4c540f04ab259 (patch) | |
tree | bfacc7b1f4c7b6087026c9e8c39bb1f7b305d22f | |
parent | ea408854a8360b6925122ce7709b424ab3005209 (diff) |
updated for version 7.0093v7.0093
49 files changed, 1557 insertions, 304 deletions
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 31feaf56e0..83f50f1831 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.0aa. Last change: 2005 Jun 16 +*change.txt* For Vim version 7.0aa. Last change: 2005 Jun 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1527,4 +1527,8 @@ found here: |sort()|. Note that using ":sort" with ":global" doesn't sort the matching lines, it's quite useless. +The details about sorting depend on the library function used. There is no +guarantee that sorting is "stable" or obeys the current locale. You will have +to try it out. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 83f81ad680..8a96f9875b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 20 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3775,10 +3775,16 @@ spellsuggest({word} [, {max}]) {word} can be a badly spelled word followed by other text. This allows for joining two words that were split. The - suggestions then also include the following text. + suggestions also include the following text, thus you can + replace a line. + + {word} may also be a good word. Similar words will then be + returned. {word} itself is also included, most likely as the + first entry, thus this can be used to check spelling. The spelling information for the current window is used. The - 'spell' option must be set and 'spelllang' is relevant. + 'spell' option must be set and the value of 'spelllang' is + used. split({expr} [, {pattern} [, {keepempty}]]) *split()* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 5b9a541071..c08f123032 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.0aa. Last change: 2005 Jun 16 +*repeat.txt* For Vim version 7.0aa. Last change: 2005 Jun 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -515,6 +515,9 @@ DELETING BREAKPOINTS Delete breakpoint {nr}. Use |:breaklist| to see the number of each breakpoint. +:breakd[el] * + Delete all breakpoints. + :breakd[el] func [lnum] {name} Delete a breakpoint in a function. diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 399fc679ca..aaef05f10e 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.0aa. Last change: 2005 Jun 23 +*spell.txt* For Vim version 7.0aa. Last change: 2005 Jun 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -71,9 +71,15 @@ zw Add word under the cursor as a wrong (bad) word to *:spellw* *:spellwrong* :spellw[rong] {word} Add [word} as a wrong (bad) word to 'spellfile'. -After adding a word to 'spellfile' its associated ".spl" file will -automatically be updated. More details about the 'spellfile' format below -|spell-wordlist-format|. +After adding a word to 'spellfile' with the above commands its associated +".spl" file will automatically be updated. If you edit 'spellfile' manually +you need to use the |:mkspell| command. This sequence of commands mostly +works well: > + :exe 'e ' . &spellfile +< (make changes to the spell file) > + :mkspell! % + +More details about the 'spellfile' format below |spell-wordlist-format|. Finding suggestions for bad words: @@ -208,7 +214,7 @@ include characters like '-' in 'iskeyword'. The word characters do depend on The table with word characters is stored in the main .spl file. Therefore it matters what the current locale is when generating it! A .add.spl file does -not contain a word table. +not contain a word table though. A word that starts with a digit is always ignored. That includes hex numbers in the form 0xff and 0XFF. diff --git a/runtime/doc/tags b/runtime/doc/tags index c4d5d78ff6..3f0df20b7b 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2408,6 +2408,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :source_crnl repeat.txt /*:source_crnl* :sp windows.txt /*:sp* :spe spell.txt /*:spe* +:spelld spell.txt /*:spelld* +:spelldump spell.txt /*:spelldump* :spellgood spell.txt /*:spellgood* :spellw spell.txt /*:spellw* :spellwrong spell.txt /*:spellwrong* @@ -3703,6 +3705,7 @@ E748 repeat.txt /*E748* E749 eval.txt /*E749* E75 vi_diff.txt /*E75* E750 repeat.txt /*E750* +E751 spell.txt /*E751* E754 spell.txt /*E754* E756 spell.txt /*E756* E758 spell.txt /*E758* @@ -6272,6 +6275,7 @@ spell-affix-mbyte spell.txt /*spell-affix-mbyte* spell-affix-vim spell.txt /*spell-affix-vim* spell-dic-format spell.txt /*spell-dic-format* spell-file-format spell.txt /*spell-file-format* +spell-load spell.txt /*spell-load* spell-mkspell spell.txt /*spell-mkspell* spell-quickstart spell.txt /*spell-quickstart* spell-syntax spell.txt /*spell-syntax* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 9b617802af..f9a221754c 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -98,6 +98,12 @@ PLANNED FOR VERSION 7.0: - Add SPELLCHECKER, with support for many languages. - Spell checking code todo's: + - Special handling of ' and -: define in the .aff file. + Aspell does this with "special". + - Support user function to make suggestions: + :set spellsuggest=MySuggest,fast + Also support a list with common mistakes? + - For "z?" a "replace all" mechanism would be welcome. - Add hl groups to 'spelllang'? :set spelllang=en_us,en-rare/SpellRare,en-math/SpellMath More complicated: Regions with different languages? E.g. comments diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index 40002dddb8..f9a634c94d 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2005 Jun 21 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Jun 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -681,6 +681,11 @@ file. When running the tests and one of them fails to produce "test.out" the following tests are still executed. This helps when running out of memory. +When compiling with EXITFREE defined and the ccmalloc library it is possible +to detect memory leaks. Some memory will always reported as leaked, such as +allocated by X11 library functions and the memory allocated in alloc_cmdbuff() +to store the ":quit" command. + ============================================================================== BUG FIXES *bug-fixes-7* diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index ace7fd1a7f..ffe03be4a9 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -2,7 +2,7 @@ " Language: Lua script " Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br> " First Author: Max Ischenko <mfi 'at' ukr.net> -" Last Change: 2005 Jun 09 +" Last Change: 2005 Jun 23 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -10,19 +10,19 @@ if exists("b:did_indent") endif let b:did_indent = 1 -" Only define the function once. -if exists("*GetLuaIndent") - finish -endif - setlocal indentexpr=GetLuaIndent() " To make Vim call GetLuaIndent() when it finds '\s*end' or '\s*until' -" on the current line (else is default). +" on the current line ('else' is default and includes 'elseif'). setlocal indentkeys+=0=end,0=until setlocal autoindent +" Only define the function once. +if exists("*GetLuaIndent") + finish +endif + function! GetLuaIndent() " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) @@ -32,18 +32,19 @@ function! GetLuaIndent() return 0 endif - " Add a 'shiftwidth' after lines beginning with: - " function, if, for, while, repeat, else, elseif, '{' + " Add a 'shiftwidth' after lines that start a block: + " 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{' let ind = indent(lnum) let flag = 0 let prevline = getline(lnum) - if prevline =~ '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\)' || prevline =~ '{\s*$' || prevline =~ '\<function\>\s*\%(\k\|[.:]\)\{-}\s*(' + if prevline =~ '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\|then\>\)' + \ || prevline =~ '{\s*$' || prevline =~ '\<function\>\s*\%(\k\|[.:]\)\{-}\s*(' let ind = ind + &shiftwidth let flag = 1 endif " Subtract a 'shiftwidth' after lines ending with - " 'end' when they begin with while, if, for, etc. + " 'end' when they begin with 'while', 'if', 'for', etc. too. if flag == 1 && prevline =~ '\<end\>\|\<until\>' let ind = ind - &shiftwidth endif diff --git a/runtime/spell/en.ascii.spl b/runtime/spell/en.ascii.spl Binary files differindex 739899cd1d..54630e7a6c 100644 --- a/runtime/spell/en.ascii.spl +++ b/runtime/spell/en.ascii.spl diff --git a/src/edit.c b/src/edit.c index ebfe7fd699..c91170215d 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4985,6 +4985,15 @@ set_last_insert(c) } } +#if defined(EXITFREE) || defined(PROTO) + void +free_last_insert() +{ + vim_free(last_insert); + last_insert = NULL; +} +#endif + /* * Add character "c" to buffer "s". Escape the special meaning of K_SPECIAL * and CSI. Handle multi-byte characters. diff --git a/src/eval.c b/src/eval.c index dc38936aa4..f3e31e2812 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2588,7 +2588,10 @@ eval_for_line(arg, errp, nextcmdp, skip) { l = tv.vval.v_list; if (tv.v_type != VAR_LIST || l == NULL) + { EMSG(_(e_listreq)); + clear_tv(&tv); + } else { fi->fi_list = l; @@ -2640,7 +2643,10 @@ free_for_info(fi_void) forinfo_T *fi = (forinfo_T *)fi_void; if (fi != NULL && fi->fi_list != NULL) + { list_rem_watch(fi->fi_list, &fi->fi_lw); + list_unref(fi->fi_list); + } vim_free(fi); } diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 8346145663..9daa8f671a 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -789,6 +789,16 @@ ex_copy(line1, line2, n) msgmore((long)count); } +static char_u *prevcmd = NULL; /* the previous command */ + +#if defined(EXITFREE) || defined(PROTO) + void +free_prev_shellcmd() +{ + vim_free(prevcmd); +} +#endif + /* * Handle the ":!cmd" command. Also for ":r !cmd" and ":w !cmd" * Bangs in the argument are replaced with the previously entered command. @@ -807,7 +817,6 @@ do_bang(addr_count, eap, forceit, do_in, do_out) char_u *arg = eap->arg; /* command */ linenr_T line1 = eap->line1; /* start of range */ linenr_T line2 = eap->line2; /* end of range */ - static char_u *prevcmd = NULL; /* the previous command */ char_u *newcmd = NULL; /* the new command */ int free_newcmd = FALSE; /* need to free() newcmd */ int ins_prevcmd; @@ -5001,6 +5010,14 @@ write_viminfo_sub_string(fp) } #endif /* FEAT_VIMINFO */ +#if defined(EXITFREE) || defined(PROTO) + void +free_old_sub() +{ + vim_free(old_sub); +} +#endif + #if (defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)) || defined(PROTO) /* * Set up for a tagpreview. diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index b86e4812ea..45bd2ee63f 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -600,6 +600,7 @@ ex_breakdel(eap) struct debuggy *bp, *bpi; int nr; int todel = -1; + int del_all = FALSE; int i; linenr_T best_lnum = 0; @@ -614,6 +615,11 @@ ex_breakdel(eap) break; } } + else if (*eap->arg == '*') + { + todel = 0; + del_all = TRUE; + } else { /* ":breakdel {func|file} [lnum] {name}" */ @@ -640,15 +646,18 @@ ex_breakdel(eap) if (todel < 0) EMSG2(_("E161: Breakpoint not found: %s"), eap->arg); else - { - vim_free(BREAKP(todel).dbg_name); - vim_free(BREAKP(todel).dbg_prog); - --dbg_breakp.ga_len; - if (todel < dbg_breakp.ga_len) - mch_memmove(&BREAKP(todel), &BREAKP(todel + 1), - (dbg_breakp.ga_len - todel) * sizeof(struct debuggy)); - ++debug_tick; - } + while (dbg_breakp.ga_len > 0) + { + vim_free(BREAKP(todel).dbg_name); + vim_free(BREAKP(todel).dbg_prog); + --dbg_breakp.ga_len; + if (todel < dbg_breakp.ga_len) + mch_memmove(&BREAKP(todel), &BREAKP(todel + 1), + (dbg_breakp.ga_len - todel) * sizeof(struct debuggy)); + ++debug_tick; + if (!del_all) + break; + } } /* diff --git a/src/ex_eval.c b/src/ex_eval.c index 485721b9c8..eaa5dec8cb 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -917,8 +917,8 @@ ex_endif(eap) * Doing this here prevents an exception for a parsing error being * discarded by throwing the interrupt exception later on. */ - if (!(eap->cstack->cs_flags[eap->cstack->cs_idx] & CSF_TRUE) && - dbg_check_skipped(eap)) + if (!(eap->cstack->cs_flags[eap->cstack->cs_idx] & CSF_TRUE) + && dbg_check_skipped(eap)) (void)do_intthrow(eap->cstack); --eap->cstack->cs_idx; @@ -2108,8 +2108,7 @@ cleanup_conditionals(cstack, searched_cond, inclusive) * ":return", or ":finish" before the finally clause. We must not * discard it, unless an error or interrupt occurred afterwards. */ - if (did_emsg || got_int || - (cstack->cs_flags[idx] & CSF_FINALLY)) + if (did_emsg || got_int || (cstack->cs_flags[idx] & CSF_FINALLY)) { switch (cstack->cs_pending[idx]) { @@ -2194,7 +2193,7 @@ cleanup_conditionals(cstack, searched_cond, inclusive) * memory used to store it. */ if ((cstack->cs_flags[idx] & CSF_TRY) - && (cstack->cs_flags[idx] & CSF_SILENT)) + && (cstack->cs_flags[idx] & CSF_SILENT)) { eslist_T *elem; diff --git a/src/ex_getln.c b/src/ex_getln.c index 86da1aa88a..d221249e7e 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -2307,6 +2307,18 @@ realloc_cmdbuff(len) return OK; } +#if defined(FEAT_ARABIC) || defined(PROTO) +static char_u *arshape_buf = NULL; + +# if defined(EXITFREE) || defined(PROTO) + void +free_cmdline_buf() +{ + vim_free(arshape_buf); +} +# endif +#endif + /* * Draw part of the cmdline at the current cursor position. But draw stars * when cmdline_star is TRUE. @@ -2333,7 +2345,6 @@ draw_cmdline(start, len) #ifdef FEAT_ARABIC if (p_arshape && !p_tbidi && enc_utf8 && len > 0) { - static char_u *buf; static int buflen = 0; char_u *p; int j; @@ -2354,10 +2365,10 @@ draw_cmdline(start, len) { /* Re-allocate the buffer. We keep it around to avoid a lot of * alloc()/free() calls. */ - vim_free(buf); + vim_free(arshape_buf); buflen = len * 2; - buf = alloc(buflen); - if (buf == NULL) + arshape_buf = alloc(buflen); + if (arshape_buf == NULL) return; /* out of memory */ } @@ -2394,23 +2405,24 @@ draw_cmdline(start, len) u8c = arabic_shape(u8c, NULL, &u8c_c1, pc, pc1, nc); - newlen += (*mb_char2bytes)(u8c, buf + newlen); + newlen += (*mb_char2bytes)(u8c, arshape_buf + newlen); if (u8c_c1 != 0) { - newlen += (*mb_char2bytes)(u8c_c1, buf + newlen); + newlen += (*mb_char2bytes)(u8c_c1, arshape_buf + newlen); if (u8c_c2 != 0) - newlen += (*mb_char2bytes)(u8c_c2, buf + newlen); + newlen += (*mb_char2bytes)(u8c_c2, + arshape_buf + newlen); } } else { prev_c = u8c; - mch_memmove(buf + newlen, p, mb_l); + mch_memmove(arshape_buf + newlen, p, mb_l); newlen += mb_l; } } - msg_outtrans_len(buf, newlen); + msg_outtrans_len(arshape_buf, newlen); } else #endif diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 37858dcc89..cd306093dc 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -598,6 +598,14 @@ gui_mch_prepare(int *argc, char **argv) gui_argv[gui_argc] = NULL; } +#if defined(EXITFREE) || defined(PROTO) + void +gui_mch_free_all() +{ + vim_free(gui_argv); +} +#endif + /* * This should be maybe completely removed. * Doesn't seem possible, since check_copy_area() relies on diff --git a/src/main.c b/src/main.c index 2bed192816..1b64c34354 100644 --- a/src/main.c +++ b/src/main.c @@ -104,6 +104,7 @@ main #endif int n_commands = 0; /* no. of commands from + or -c */ char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c option */ + char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */ #ifdef FEAT_PRECOMMANDS int p_commands = 0; /* no. of commands from --cmd */ char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd option */ @@ -191,6 +192,8 @@ main TIME_MSG("GUI prepared"); #endif + vim_memset(cmds_tofree, 0, sizeof(cmds_tofree)); + /* Init the table of Normal mode commands. */ init_normal_cmds(); @@ -930,6 +933,7 @@ main if (p == NULL) mch_exit(2); sprintf((char *)p, "so %s", a); + cmds_tofree[n_commands] = TRUE; commands[n_commands++] = p; } else @@ -2013,7 +2017,11 @@ scripterror: current_SID = SID_CARG; #endif for (i = 0; i < n_commands; ++i) + { do_cmdline_cmd(commands[i]); + if (cmds_tofree[i]) + vim_free(commands[i]); + } sourcing_name = NULL; #ifdef FEAT_EVAL current_SID = 0; diff --git a/src/misc1.c b/src/misc1.c index 30d7696bd9..87c0f1a0a1 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3406,6 +3406,14 @@ init_homedir() } } +#if defined(EXITFREE) || defined(PROTO) + void +free_homedir() +{ + vim_free(homedir); +} +#endif + /* * Expand environment variable with path name. * "~/" is also expanded, using $HOME. For Unix "~user/" is expanded. diff --git a/src/misc2.c b/src/misc2.c index 4fdbc2798a..fd882ff991 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -16,6 +16,10 @@ # include <fcntl.h> /* for chdir() */ #endif +static char_u *username = NULL; /* cached result of mch_get_user_name() */ + +static char_u *ff_expand_buffer = NULL; /* used for expanding filenames */ + #if defined(FEAT_VIRTUALEDIT) || defined(PROTO) static int coladvance2 __ARGS((pos_T *pos, int addspaces, int finetune, colnr_T wcol)); @@ -922,15 +926,29 @@ do_outofmem_msg(size) } #if defined(EXITFREE) || defined(PROTO) + +# if defined(FEAT_SEARCHPATH) +static void free_findfile __ARGS((void)); +# endif + /* * Free everything that we allocated. * Can be used to detect memory leaks, e.g., with ccmalloc. - * Doesn't do nearly all that is required... + * NOTE: This is tricky! Things are freed that functions depend on. Don't be + * surprised if Vim crashes... + * Some things can't be freed, esp. things local to a library function. */ void free_all_mem() { buf_T *buf, *nextbuf; + static int entered = FALSE; + + /* When we cause a crash here it is caught and Vim tries to exit cleanly. + * Don't try freeing everything again. */ + if (entered) + return; + entered = TRUE; ++autocmd_block; /* don't want to trigger autocommands here */ @@ -939,20 +957,30 @@ free_all_mem() spell_free_all(); # endif -#if defined(FEAT_USR_CMDS) +# if defined(FEAT_USR_CMDS) /* Clear user commands (before deleting buffers). */ ex_comclear(NULL); -#endif +# endif # ifdef FEAT_MENU /* Clear menus. */ do_cmdline_cmd((char_u *)"aunmenu *"); # endif - /* Clear mappings and abbreviations. */ + /* Clear mappings, abbreviations, breakpoints. */ do_cmdline_cmd((char_u *)"mapclear"); do_cmdline_cmd((char_u *)"mapclear!"); do_cmdline_cmd((char_u *)"abclear"); +# if defined(FEAT_EVAL) + do_cmdline_cmd((char_u *)"breakdel *"); +# endif + +# ifdef FEAT_TITLE + free_titles(); +# endif +# if defined(FEAT_SEARCHPATH) + free_findfile(); +# endif /* Obviously named calls. */ # if defined(FEAT_EVAL) @@ -963,11 +991,44 @@ free_all_mem() free_all_autocmds(); # endif clear_termcodes(); + free_all_options(); + free_all_marks(); + alist_clear(&global_alist); + free_homedir(); + free_search_patterns(); + free_old_sub(); + free_last_insert(); + free_prev_shellcmd(); + free_regexp_stuff(); + free_tag_stuff(); + free_cd_dir(); + set_expr_line(NULL); + diff_clear(); + + /* Free some global vars. */ + vim_free(username); + vim_free(clip_exclude_prog); + vim_free(last_cmdline); + vim_free(new_last_cmdline); + vim_free(keep_msg); + vim_free(ff_expand_buffer); /* Clear cmdline history. */ p_hi = 0; init_history(); +#ifdef FEAT_QUICKFIX + qf_free_all(); +#endif + + /* Close all script inputs. */ + close_all_scripts(); + +#if defined(FEAT_WINDOWS) + /* Destroy all windows. Must come before freeing buffers. */ + win_free_all(); +#endif + /* Free all buffers. */ for (buf = firstbuf; buf != NULL; ) { @@ -979,9 +1040,8 @@ free_all_mem() buf = firstbuf; } -#if defined(FEAT_WINDOWS) - /* Destroy all windows. */ - win_free_all(); +#ifdef FEAT_ARABIC + free_cmdline_buf(); #endif /* Clear registers. */ @@ -989,6 +1049,10 @@ free_all_mem() ResetRedobuff(); ResetRedobuff(); +#ifdef FEAT_CLIENTSERVER + vim_free(serverDelayedStartName); +#endif + < |