Rewrapping some lines and tweaking some comments.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-12-04 21:11:10 +00:00
parent ba8f806705
commit f2da466388
6 changed files with 27 additions and 35 deletions

View File

@ -1,7 +1,8 @@
2015-12-03 Benno Schulenberg <bensberg@justemail.net>
2015-12-04 Benno Schulenberg <bensberg@justemail.net>
* src/proto.h: Avoid a compilation warning.
* src/color.c (reset_multis_for_id, reset_multis_before/after):
Fuse these three functions into a single one.
* src/*.c: Rewrap some lines and tweak some comments.
2015-12-03 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (discard_until): Move the trimming of the undo stack

View File

@ -1174,8 +1174,7 @@ void do_insertfile(
}
#endif
/* Convert newlines to nulls, just before we insert the file
* or execute the command. */
/* Convert newlines to nulls in the given filename. */
sunder(answer);
align(&answer);
@ -1235,9 +1234,9 @@ void do_insertfile(
/* Update the current x-coordinate to account for the
* number of characters inserted on the current line.
* If the mark begins inside the partition, adjust the
* mark coordinates to compensate for the change in the
* current line. */
* If the mark was positioned after the cursor and on the
* same line, adjust the mark's coordinates to compensate
* for the change in this line. */
openfile->current_x = strlen(openfile->filebot->data);
if (openfile->fileage == openfile->filebot) {
#ifndef NANO_TINY
@ -2759,8 +2758,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
/* Match against files relative to the current working directory. */
if (matches == NULL)
matches = cwd_tab_completion(buf, allow_files, &num_matches,
*place);
matches = cwd_tab_completion(buf, allow_files, &num_matches, *place);
buf_len = strlen(buf);

View File

@ -2009,8 +2009,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#endif
while (i < output_len) {
/* If allow_cntrls is TRUE, convert nulls and newlines
* properly. */
/* If allow_cntrls is TRUE, convert nulls and newlines properly. */
if (allow_cntrls) {
/* Null to newline, if needed. */
if (output[i] == '\0')
@ -2028,28 +2027,24 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
i += char_buf_len;
/* If allow_cntrls is FALSE, filter out an ASCII control
* character. */
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
char_buf_len)))
/* If allow_cntrls is FALSE, filter out an ASCII control character. */
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i - char_buf_len)))
continue;
/* If the NO_NEWLINES flag isn't set, when a character is
* added to the magicline, it means we need a new magicline. */
if (!ISSET(NO_NEWLINES) && openfile->filebot ==
openfile->current)
if (!ISSET(NO_NEWLINES) && openfile->filebot == openfile->current)
new_magicline();
/* More dangerousness fun =) */
openfile->current->data = charealloc(openfile->current->data,
current_len + (char_buf_len * 2));
current_len + (char_buf_len * 2));
assert(openfile->current_x <= current_len);
charmove(openfile->current->data + openfile->current_x +
char_buf_len, openfile->current->data +
openfile->current_x, current_len - openfile->current_x +
char_buf_len);
charmove(openfile->current->data + openfile->current_x + char_buf_len,
openfile->current->data + openfile->current_x,
current_len - openfile->current_x + char_buf_len);
strncpy(openfile->current->data + openfile->current_x, char_buf,
char_buf_len);
current_len += char_buf_len;
@ -2060,9 +2055,8 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
add_undo(ADD);
/* Note that current_x has not yet been incremented. */
if (openfile->mark_set && openfile->current ==
openfile->mark_begin && openfile->current_x <
openfile->mark_begin_x)
if (openfile->mark_set && openfile->current == openfile->mark_begin &&
openfile->current_x < openfile->mark_begin_x)
openfile->mark_begin_x += char_buf_len;
#endif

View File

@ -533,7 +533,7 @@ void do_undo(void)
/* When the join was done by a Backspace at the tail of the file,
* and the nonewlines flag isn't set, do not re-add a newline that
* wasn't actually deleted; just position the cursor. */
if (u->xflags == WAS_FINAL_BACKSPACE && !ISSET(NO_NEWLINES)) {
if (u->xflags == WAS_FINAL_BACKSPACE && !ISSET(NO_NEWLINES)) {
goto_line_posx(openfile->filebot->lineno, 0);
break;
}
@ -644,8 +644,8 @@ void do_redo(void)
return;
}
#ifdef DEBUG
fprintf(stderr, "data we're about to redo = \"%s\"\n", f->data);
fprintf(stderr, "Redo running for type %d\n", u->type);
fprintf(stderr, " >> Redo running for type %d\n", u->type);
fprintf(stderr, " >> Data we're about to redo = \"%s\"\n", f->data);
#endif
switch (u->type) {
@ -1142,11 +1142,12 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
} else
u->xflags = WAS_MARKED_FORWARD;
} else {
/* Compute cutbottom for the uncut using our copy. */
/* Compute the end of the cut for the undo, using our copy. */
u->cutbottom = u->cutbuffer;
while (u->cutbottom->next != NULL)
u->cutbottom = u->cutbottom->next;
u->lineno = u->mark_begin_lineno + u->cutbottom->lineno - u->cutbuffer->lineno;
u->lineno = u->mark_begin_lineno + u->cutbottom->lineno -
u->cutbuffer->lineno;
if (ISSET(CUT_TO_END) || u->type == CUT_EOF) {
u->begin = strlen(u->cutbottom->data);
if (u->lineno == u->mark_begin_lineno)

View File

@ -404,8 +404,7 @@ void *nrealloc(void *ptr, size_t howmuch)
}
/* Copy the first n characters of one malloc()ed string to another
* pointer. Should be used as: "dest = mallocstrncpy(dest, src,
* n);". */
* pointer. Should be used as: "dest = mallocstrncpy(dest, src, n);". */
char *mallocstrncpy(char *dest, const char *src, size_t n)
{
if (src == NULL)
@ -424,8 +423,7 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
* "dest = mallocstrcpy(dest, src);". */
char *mallocstrcpy(char *dest, const char *src)
{
return mallocstrncpy(dest, src, (src == NULL) ? 1 :
strlen(src) + 1);
return mallocstrncpy(dest, src, (src == NULL) ? 1 : strlen(src) + 1);
}
/* Free the malloc()ed string at dest and return the malloc()ed string

View File

@ -2298,8 +2298,8 @@ void statusbar(const char *msg, ...)
26;
}
/* Display the shortcut list in s on the last two rows of the bottom
* portion of the window. */
/* Display the shortcut list corresponding to menu on the last two rows
* of the bottom portion of the window. */
void bottombars(int menu)
{
size_t i, colwidth, slen;