forked from aniani/vim
patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Problem: There is :spellwrong and :spellgood but not :spellrare. Solution: Add :spellrare. (Martin Tournoij, closes #4291)
This commit is contained in:
@@ -6125,28 +6125,31 @@ spell_message(spellinfo_T *spin, char_u *str)
|
||||
|
||||
/*
|
||||
* ":[count]spellgood {word}"
|
||||
* ":[count]spellwrong {word}"
|
||||
* ":[count]spellwrong {word}"
|
||||
* ":[count]spellundo {word}"
|
||||
* ":[count]spellrare {word}"
|
||||
*/
|
||||
void
|
||||
ex_spell(exarg_T *eap)
|
||||
{
|
||||
spell_add_word(eap->arg, (int)STRLEN(eap->arg), eap->cmdidx == CMD_spellwrong,
|
||||
spell_add_word(eap->arg, (int)STRLEN(eap->arg),
|
||||
eap->cmdidx == CMD_spellwrong ? SPELL_ADD_BAD :
|
||||
eap->cmdidx == CMD_spellrare ? SPELL_ADD_RARE : SPELL_ADD_GOOD,
|
||||
eap->forceit ? 0 : (int)eap->line2,
|
||||
eap->cmdidx == CMD_spellundo);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add "word[len]" to 'spellfile' as a good or bad word.
|
||||
* Add "word[len]" to 'spellfile' as a good, rare or bad word.
|
||||
*/
|
||||
void
|
||||
spell_add_word(
|
||||
char_u *word,
|
||||
int len,
|
||||
int bad,
|
||||
int idx, /* "zG" and "zW": zero, otherwise index in
|
||||
'spellfile' */
|
||||
int undo) /* TRUE for "zug", "zuG", "zuw" and "zuW" */
|
||||
int what, // SPELL_ADD_ values
|
||||
int idx, // "zG" and "zW": zero, otherwise index in
|
||||
// 'spellfile'
|
||||
int undo) // TRUE for "zug", "zuG", "zuw" and "zuW"
|
||||
{
|
||||
FILE *fd = NULL;
|
||||
buf_T *buf = NULL;
|
||||
@@ -6213,7 +6216,7 @@ spell_add_word(
|
||||
fname = fnamebuf;
|
||||
}
|
||||
|
||||
if (bad || undo)
|
||||
if (what == SPELL_ADD_BAD || undo)
|
||||
{
|
||||
/* When the word appears as good word we need to remove that one,
|
||||
* since its flags sort before the one with WF_BANNED. */
|
||||
@@ -6280,8 +6283,10 @@ spell_add_word(
|
||||
semsg(_(e_notopen), fname);
|
||||
else
|
||||
{
|
||||
if (bad)
|
||||
if (what == SPELL_ADD_BAD)
|
||||
fprintf(fd, "%.*s/!\n", len, word);
|
||||
else if (what == SPELL_ADD_RARE)
|
||||
fprintf(fd, "%.*s/?\n", len, word);
|
||||
else
|
||||
fprintf(fd, "%.*s\n", len, word);
|
||||
fclose(fd);
|
||||
|
Reference in New Issue
Block a user