commit 74e75214787e72e325e77baa38ddc59f84fc2082
parent 3f1878d9a97b946276c8a0a86261e02c38460877
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sat, 18 Jul 2015 10:32:01 +0000
Adjusting some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5308 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
4 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -2,6 +2,7 @@
* src/winio.c (edit_draw): When looking for multiline-regex matches,
look for a new start only after an end, instead of right after the
last start. This fixes bug #45525 and bug #41313 on Savannah.
+ * src/nano.c, src/text.c, src/winio.c: Adjust some comments.
2015-07-17 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (open_buffer): Verify that a named and existing file
diff --git a/src/nano.c b/src/nano.c
@@ -2511,7 +2511,7 @@ int main(int argc, char **argv)
#endif /* !DISABLE_NANORC */
#ifndef DISABLE_WRAPPING
- /* Overwrite an rcfile "set nowrap" or --disable-wrapping-as-root
+ /* Override an rcfile "set nowrap" or --disable-wrapping-as-root
* if a --fill option was given on the command line. */
if (fill_used)
UNSET(NO_WRAP);
diff --git a/src/text.c b/src/text.c
@@ -2357,16 +2357,16 @@ bool do_int_spell_fix(const char *word)
#ifndef NANO_TINY
if (old_mark_set) {
- /* 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. */
+ /* Trim the filestruct so that it contains only the marked text. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
+
+ /* Foresay whether spell correction will add a magicline. */
if (!ISSET(NO_NEWLINES))
added_magicline = (openfile->filebot->data[0] != '\0');
+
+ /* Turn the mark off. */
openfile->mark_set = FALSE;
}
#endif
@@ -2749,13 +2749,13 @@ const char *do_alt_speller(char *tempfile_name)
#ifndef NANO_TINY
if (old_mark_set) {
- /* 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. */
+ /* Trim the filestruct so that it contains only the marked text. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
+
+ /* Foresay whether a magicline will be added when the
+ * spell-checked text is read back in. */
if (!ISSET(NO_NEWLINES))
added_magicline = (openfile->filebot->data[0] != '\0');
@@ -3357,9 +3357,9 @@ void do_wordlinechar_count(void)
filestruct *top, *bot;
size_t top_x, bot_x;
+ /* If the mark is on, partition the filestruct so that it
+ * contains only the marked text, and turn the mark off. */
if (old_mark_set) {
- /* If the mark is on, partition the filestruct so that it
- * contains only the marked text, and turn the mark off. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
filepart = partition_filestruct(top, top_x, bot, bot_x);
@@ -3384,8 +3384,7 @@ void do_wordlinechar_count(void)
/* Get the total line and character counts, as "wc -l" and "wc -c"
* do, but get the latter in multibyte characters. */
if (old_mark_set) {
- nlines = openfile->filebot->lineno -
- openfile->fileage->lineno + 1;
+ nlines = openfile->filebot->lineno - openfile->fileage->lineno + 1;
chars = get_totsize(openfile->fileage, openfile->filebot);
/* Unpartition the filestruct so that it contains all the text
@@ -3402,8 +3401,7 @@ void do_wordlinechar_count(void)
openfile->current_x = current_x_save;
openfile->placewewant = pww_save;
- /* Display the total word, line, and character counts on the
- * statusbar. */
+ /* Display the total word, line, and character counts on the statusbar. */
statusbar(_("%sWords: %lu Lines: %ld Chars: %lu"), old_mark_set ?
_("In Selection: ") : "", (unsigned long)words, (long)nlines,
(unsigned long)chars);
diff --git a/src/winio.c b/src/winio.c
@@ -2611,7 +2611,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (startmatch.rm_so == startmatch.rm_eo)
startmatch.rm_eo++;
else {
- /* No start found, so skip to the next step. */
+ /* If no start was found, skip to the next step. */
if (start_line == NULL)
goto step_two;
/* Now start_line is the first line before fileptr
@@ -2646,7 +2646,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
end_line->data, 1, &endmatch, 0) == REG_NOMATCH)
end_line = end_line->next;
- /* No end found, or it is too early. */
+ /* If no end was found, or it is too early, next step. */
if (end_line == NULL || (end_line == fileptr &&
endmatch.rm_eo <= startpos))
goto step_two;
@@ -2747,13 +2747,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
mvwaddnstr(edit, line, x_start,
converted + index, -1);
- /* We painted to the end of the line, so
- * don't bother checking any more
- * starts. */
+ fileptr->multidata[tmpcolor->id] = CENDAFTER;
#ifdef DEBUG
fprintf(stderr, " Marking for id %i line %i as CENDAFTER\n", tmpcolor->id, line);
#endif
- fileptr->multidata[tmpcolor->id] = CENDAFTER;
+ /* We painted to the end of the line, so
+ * don't bother checking any more starts. */
break;
}
start_col = startmatch.rm_so + 1;