From 1e0e235cbbb69dd330e33a5a3db6155aafd2b95b Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 8 Nov 2005 18:34:12 +0000 Subject: [PATCH] make do_int_spell_fix() and do_alt_speller() take the NO_NEWLINES flag into account git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3108 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 5 +++-- src/text.c | 34 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index e836203e..a41b98d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,8 +52,9 @@ CVS code - magiclines to the ends of files. Changes to read_file(), write_marked_file(), move_to_filestruct(), copy_from_filestruct(), usage(), do_output(), main(), - do_replace_loop(), do_delete(), nano.1, nanorc.5, nano.texi, - and nanorc.sample. (DLR, suggested by Jaime + do_replace_loop(), do_delete(), do_int_spell_fix(), + do_alt_speller(), nano.1, nanorc.5, nano.texi, and + nanorc.sample. (DLR, suggested by Jaime ) - Move functions specific to the file browser to their own source file, and adjust related variables accordingly. New diff --git a/src/text.c b/src/text.c index 252ced8a..5cd4f77e 100644 --- a/src/text.c +++ b/src/text.c @@ -1530,13 +1530,15 @@ bool do_int_spell_fix(const char *word) #ifndef NANO_SMALL if (old_mark_set) { /* If the mark is on, partition the filestruct so that it - * contains only the marked text, keep track of whether the text - * will have a magicline added when we're done correcting - * misspelled words, and turn the mark off. */ + * contains only the marked text; if the NO_NEWLINES flag isn't + * set, keep track of whether the text will have a magicline + * added when we're done correcting misspelled words; and + * turn the mark off. */ mark_order((const filestruct **)&top, &top_x, (const filestruct **)&bot, &bot_x, &right_side_up); filepart = partition_filestruct(top, top_x, bot, bot_x); - added_magicline = (openfile->filebot->data[0] != '\0'); + if (!ISSET(NO_NEWLINES)) + added_magicline = (openfile->filebot->data[0] != '\0'); openfile->mark_set = FALSE; } #endif @@ -1585,9 +1587,9 @@ bool do_int_spell_fix(const char *word) #ifndef NANO_SMALL if (old_mark_set) { - /* If the mark was on and we added a magicline, remove it - * now. */ - if (added_magicline) + /* 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 @@ -1932,14 +1934,16 @@ const char *do_alt_speller(char *tempfile_name) #ifndef NANO_SMALL if (old_mark_set) { - /* If the mark was on, partition the filestruct so that it - * contains only the marked text, and keep track of whether the - * temp file (which should contain the spell-checked marked - * text) will have a magicline added when it's reloaded. */ + /* If the mark is on, partition the filestruct so that it + * contains only the marked text; if the NO_NEWLINES flag isn't + * set, keep track of whether the text will have a magicline + * added when we're done correcting misspelled words; and + * turn the mark off. */ mark_order((const filestruct **)&top, &top_x, (const filestruct **)&bot, &bot_x, &right_side_up); filepart = partition_filestruct(top, top_x, bot, bot_x); - added_magicline = (openfile->filebot->data[0] != '\0'); + if (!ISSET(NO_NEWLINES)) + added_magicline = (openfile->filebot->data[0] != '\0'); /* Get the number of characters in the marked text, and subtract * it from the saved value of totsize. */ @@ -1963,9 +1967,9 @@ const char *do_alt_speller(char *tempfile_name) if (old_mark_set) { filestruct *top_save = openfile->fileage; - /* If the mark was on and we added a magicline, remove it - * now. */ - if (added_magicline) + /* 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 -- 2.39.5