commit 5a6caf0ca835c0b774705ba3128bfe596a90c3e3
parent da72453859733296f49cbcb0465bd58e73acae2c
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 15 Jun 2005 19:21:04 +0000
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
Diffstat:
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -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).
diff --git a/src/nano.c b/src/nano.c
@@ -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--;