Arh! I tested that without actually making any spell correction.

That wasn't very clever.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5296 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-07-13 05:32:17 +00:00
parent badbc676fb
commit 674ab835e8
2 changed files with 20 additions and 4 deletions

View File

@ -1,8 +1,6 @@
2015-07-12 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_int_spell_fix, do_alt_speller): Remove the variable
'added_magicline', as it will always be FALSE and thus does nothing.
* src/text.c (do_alt_speller): Rename the variable 'totsize_save' to
'size_of_surrounding', to better describe what it contains.
* src/text.c (do_alt_speller): Rename the variable 'totsize_save'
to 'size_of_surrounding', to better describe what it contains.
* src/files.c (read_file): Remove a stray space from a message.
2015-07-10 Benno Schulenberg <bensberg@justemail.net>

View File

@ -2321,6 +2321,8 @@ bool do_int_spell_fix(const char *word)
/* A storage place for the current flag settings. */
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
bool added_magicline = FALSE;
/* Whether we added a magicline after filebot. */
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
@ -2363,6 +2365,8 @@ bool do_int_spell_fix(const char *word)
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
if (!ISSET(NO_NEWLINES))
added_magicline = (openfile->filebot->data[0] != '\0');
openfile->mark_set = FALSE;
}
#endif
@ -2414,6 +2418,11 @@ bool do_int_spell_fix(const char *word)
#ifndef NANO_TINY
if (old_mark_set) {
/* If the mark was on, the NO_NEWLINES flag isn't set, and we
* added a magicline, remove it now. */
if (!ISSET(NO_NEWLINES) && added_magicline)
remove_magicline();
/* Put the beginning and the end of the mark at the beginning
* and the end of the spell-checked text. */
if (openfile->fileage == openfile->filebot)
@ -2648,6 +2657,8 @@ const char *do_alt_speller(char *tempfile_name)
static char **spellargs = NULL;
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
bool added_magicline = FALSE;
/* Whether we added a magicline after filebot. */
filestruct *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
@ -2747,6 +2758,8 @@ const char *do_alt_speller(char *tempfile_name)
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
if (!ISSET(NO_NEWLINES))
added_magicline = (openfile->filebot->data[0] != '\0');
/* Compute the size of the text outside of the marked region. */
size_of_surrounding = openfile->totsize - get_totsize(top, bot);
@ -2767,6 +2780,11 @@ const char *do_alt_speller(char *tempfile_name)
else
openfile->mark_begin_x = strlen(openfile->filebot->data);
/* If the mark was on, the NO_NEWLINES flag isn't set, and we
* added a magicline, remove it now. */
if (!ISSET(NO_NEWLINES) && added_magicline)
remove_magicline();
/* Unpartition the filestruct so that it contains all the text
* again. Note that we've replaced the marked text originally
* in the partition with the spell-checked marked text in the