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-d3aeb78583b8master
parent
da72453859
commit
5a6caf0ca8
|
@ -171,6 +171,9 @@ CVS code -
|
||||||
erroneously translated twice. (DLR)
|
erroneously translated twice. (DLR)
|
||||||
do_tab()
|
do_tab()
|
||||||
- Remove unneeded variable kbinput. (DLR)
|
- 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()
|
do_alt_speller()
|
||||||
- Replace a set_modified() with SET(MODIFIED) to avoid an
|
- Replace a set_modified() with SET(MODIFIED) to avoid an
|
||||||
unnecessary update, and remove an unneeded clearok(FALSE).
|
unnecessary update, and remove an unneeded clearok(FALSE).
|
||||||
|
|
15
src/nano.c
15
src/nano.c
|
@ -1920,6 +1920,7 @@ bool do_wrap(filestruct *line)
|
||||||
bool do_int_spell_fix(const char *word)
|
bool do_int_spell_fix(const char *word)
|
||||||
{
|
{
|
||||||
char *save_search, *save_replace;
|
char *save_search, *save_replace;
|
||||||
|
size_t match_len;
|
||||||
size_t current_x_save = current_x, pww_save = placewewant;
|
size_t current_x_save = current_x, pww_save = placewewant;
|
||||||
filestruct *edittop_save = edittop, *current_save = current;
|
filestruct *edittop_save = edittop, *current_save = current;
|
||||||
/* Save where we are. */
|
/* Save where we are. */
|
||||||
|
@ -1986,11 +1987,17 @@ bool do_int_spell_fix(const char *word)
|
||||||
|
|
||||||
/* Find the first whole-word occurrence of word. */
|
/* Find the first whole-word occurrence of word. */
|
||||||
findnextstr_wrap_reset();
|
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)) {
|
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();
|
edit_refresh();
|
||||||
|
|
||||||
do_replace_highlight(TRUE, word);
|
do_replace_highlight(TRUE, exp_word);
|
||||||
|
|
||||||
/* Allow all instances of the word to be corrected. */
|
/* Allow all instances of the word to be corrected. */
|
||||||
canceled = (statusq(FALSE, spell_list, word,
|
canceled = (statusq(FALSE, spell_list, word,
|
||||||
|
@ -1999,7 +2006,9 @@ bool do_int_spell_fix(const char *word)
|
||||||
#endif
|
#endif
|
||||||
_("Edit a replacement")) == -1);
|
_("Edit a replacement")) == -1);
|
||||||
|
|
||||||
do_replace_highlight(FALSE, word);
|
do_replace_highlight(FALSE, exp_word);
|
||||||
|
|
||||||
|
free(exp_word);
|
||||||
|
|
||||||
if (!canceled && strcmp(word, answer) != 0) {
|
if (!canceled && strcmp(word, answer) != 0) {
|
||||||
current_x--;
|
current_x--;
|
||||||
|
|
Loading…
Reference in New Issue