Hi,
When I use spell checking on Windows and use zG (or zW) to add a word to
the internal wordlist, the wordlist files are not deleted when Vim exits.
It doesn't seem to occur on Linux, because the wordlist files are created
in a newly created directory in the /tmp and the directory is deleted
by ml_close_all(). On Windows, the wordlist files are created under the
top of the temporary directory.
Attached patch fixes this problem. Please check it.
(The patch is a little bit ugly maybe because of the algorithm of diff.
I just extract a block from spell_free_all() and make it a new function
spell_delete_wordlist().)
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
# HG changeset patch
# Parent 66ab935e1113f6fdf5ce8d7b903654374efe1dfa
diff --git a/src/memline.c b/src/memline.c
--- a/src/memline.c
+++ b/src/memline.c
@@ -841,6 +841,9 @@
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0
|| vim_strchr(p_cpo, CPO_PRESERVE) == NULL));
+#ifdef FEAT_SPELL
+ spell_delete_wordlist(); /* delete the internal wordlist */
+#endif
#ifdef TEMPDIRNAMES
vim_deltempdir(); /* delete created temp directory */
#endif
diff --git a/src/proto/spell.pro b/src/proto/spell.pro
--- a/src/proto/spell.pro
+++ b/src/proto/spell.pro
@@ -3,6 +3,7 @@
int spell_move_to __ARGS((win_T *wp, int dir, int allwords, int curline, hlf_T *attrp));
void spell_cat_line __ARGS((char_u *buf, char_u *line, int maxlen));
char_u *did_set_spelllang __ARGS((win_T *wp));
+void spell_delete_wordlist __ARGS((void));
void spell_free_all __ARGS((void));
void spell_reload __ARGS((void));
int spell_check_msm __ARGS((void));
diff --git a/src/spell.c b/src/spell.c
--- a/src/spell.c
+++ b/src/spell.c
@@ -2180,9 +2180,9 @@
char_u *endp;
hlf_T attr;
int len;
-# ifdef FEAT_SYN_HL
+#ifdef FEAT_SYN_HL
int has_syntax = syntax_present(wp);
-# endif
+#endif
int col;
int can_spell;
char_u *buf = NULL;
@@ -2280,7 +2280,7 @@
: p - buf)
> wp->w_cursor.col)))
{
-# ifdef FEAT_SYN_HL
+#ifdef FEAT_SYN_HL
if (has_syntax)
{
col = (int)(p - buf);
@@ -4701,46 +4701,55 @@
return flags;
}
-# if defined(FEAT_MBYTE) || defined(EXITFREE) || defined(PROTO)
-/*
- * Free all languages.
+/*
+ * Delete the internal wordlist and its .spl file.
*/
void
-spell_free_all()
-{
- slang_T *slang;
- buf_T *buf;
+spell_delete_wordlist()
+{
char_u fname[MAXPATHL];
- /* Go through all buffers and handle 'spelllang'. <VN> */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- ga_clear(&buf->b_s.b_langp);
-
- while (first_lang != NULL)
- {
- slang = first_lang;
- first_lang = slang->sl_next;
- slang_free(slang);
- }
-
if (int_wordlist != NULL)
{
- /* Delete the internal wordlist and its .spl file */
mch_remove(int_wordlist);
int_wordlist_spl(fname);
mch_remove(fname);
vim_free(int_wordlist);
int_wordlist = NULL;
}
+}
+
+#if defined(FEAT_MBYTE) || defined(EXITFREE) || defined(PROTO)
+/*
+ * Free all languages.
+ */
+ void
+spell_free_all()
+{
+ slang_T *slang;
+ buf_T *buf;
+
+ /* Go through all buffers and handle 'spelllang'. <VN> */
+ for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ ga_clear(&buf->b_s.b_langp);
+
+ while (first_lang != NULL)
+ {
+ slang = first_lang;
+ first_lang = slang->sl_next;
+ slang_free(slang);
+ }
+
+ spell_delete_wordlist();
vim_free(repl_to);
repl_to = NULL;
vim_free(repl_from);
repl_from = NULL;
}
-# endif
-
-# if defined(FEAT_MBYTE) || defined(PROTO)
+#endif
+
+#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Clear all spelling tables and reload them.
* Used after 'encoding' is set and when ":mkspell" was used.
@@ -4773,7 +4782,7 @@
}
}
}
-# endif
+#endif
/*
* Reload the spell file "fname" if it's loaded.