in do_int_spell_fix(), display highlighted misspelled words using

display_string(), as do_replace_loop() does


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2679 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-06-15 19:21:04 +00:00
parent da72453859
commit 5a6caf0ca8
2 changed files with 15 additions and 3 deletions

View File

@ -171,6 +171,9 @@ CVS code -
erroneously translated twice. (DLR)
do_tab()
- Remove unneeded variable kbinput. (DLR)
do_int_spell_fix()
- Display highlighted misspelled words using display_string(),
as do_replace_loop() does. (DLR)
do_alt_speller()
- Replace a set_modified() with SET(MODIFIED) to avoid an
unnecessary update, and remove an unneeded clearok(FALSE).

View File

@ -1920,6 +1920,7 @@ bool do_wrap(filestruct *line)
bool do_int_spell_fix(const char *word)
{
char *save_search, *save_replace;
size_t match_len;
size_t current_x_save = current_x, pww_save = placewewant;
filestruct *edittop_save = edittop, *current_save = current;
/* Save where we are. */
@ -1986,11 +1987,17 @@ bool do_int_spell_fix(const char *word)
/* Find the first whole-word occurrence of word. */
findnextstr_wrap_reset();
while (findnextstr(TRUE, TRUE, FALSE, fileage, 0, word, NULL)) {
while (findnextstr(TRUE, TRUE, FALSE, fileage, 0, word,
&match_len)) {
if (is_whole_word(current_x, current->data, word)) {
size_t xpt = xplustabs();
char *exp_word = display_string(current->data, xpt,
strnlenpt(current->data, current_x + match_len) - xpt,
FALSE);
edit_refresh();
do_replace_highlight(TRUE, word);
do_replace_highlight(TRUE, exp_word);
/* Allow all instances of the word to be corrected. */
canceled = (statusq(FALSE, spell_list, word,
@ -1999,7 +2006,9 @@ bool do_int_spell_fix(const char *word)
#endif
_("Edit a replacement")) == -1);
do_replace_highlight(FALSE, word);
do_replace_highlight(FALSE, exp_word);
free(exp_word);
if (!canceled && strcmp(word, answer) != 0) {
current_x--;