From aee86996de26607ea009e2c0296b157b519dcc5e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 12 Jul 2015 19:27:26 +0000 Subject: [PATCH] Renaming the variable 'totsize_save' to 'size_of_surrounding', to better describe what it contains. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5294 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/text.c | 20 ++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ecb2df0..54d1b9d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2015-07-12 Benno Schulenberg * 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. 2015-07-10 Benno Schulenberg * src/nano.c (delete_opennode): Plug a small memory leak. diff --git a/src/text.c b/src/text.c index 93cad33a..4ae63b60 100644 --- a/src/text.c +++ b/src/text.c @@ -2656,9 +2656,8 @@ const char *do_alt_speller(char *tempfile_name) * the alternate spell command. The line that mark_begin points * to will be freed, so we save the line number and restore it * afterwards. */ - size_t totsize_save = openfile->totsize; - /* Our saved value of totsize, used when we spell-check a marked - * selection. */ + size_t size_of_surrounding; + /* The size of the text outside of a marked region. */ #endif /* Get the timestamp and the size of the temporary file. */ @@ -2749,9 +2748,8 @@ const char *do_alt_speller(char *tempfile_name) (const filestruct **)&bot, &bot_x, &right_side_up); filepart = partition_filestruct(top, top_x, bot, bot_x); - /* Get the number of characters in the marked text, and subtract - * it from the saved value of totsize. */ - totsize_save -= get_totsize(top, bot); + /* Compute the size of the text outside of the marked region. */ + size_of_surrounding = openfile->totsize - get_totsize(top, bot); } #endif @@ -2775,13 +2773,11 @@ const char *do_alt_speller(char *tempfile_name) * temp file. */ unpartition_filestruct(&filepart); - /* Renumber starting with the beginning line of the old - * partition. Also add the number of characters in the - * spell-checked marked text to the saved value of totsize, and - * then make that saved value the actual value. */ + /* Renumber, starting with the beginning line of the old partition. */ renumber(top_save); - totsize_save += openfile->totsize; - openfile->totsize = totsize_save; + + /* Add back the size of the text surrounding the marked region. */ + openfile->totsize += size_of_surrounding; /* Assign mark_begin to the line where the mark began before. */ openfile->mark_begin = fsfromline(mb_lineno_save); -- 2.39.5