Rewrapping some lines and tweaking some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
ba8f806705
commit
f2da466388
|
@ -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/proto.h: Avoid a compilation warning.
|
||||||
* src/color.c (reset_multis_for_id, reset_multis_before/after):
|
* src/color.c (reset_multis_for_id, reset_multis_before/after):
|
||||||
Fuse these three functions into a single one.
|
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>
|
2015-12-03 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/text.c (discard_until): Move the trimming of the undo stack
|
* src/text.c (discard_until): Move the trimming of the undo stack
|
||||||
|
|
12
src/files.c
12
src/files.c
|
@ -1174,8 +1174,7 @@ void do_insertfile(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convert newlines to nulls, just before we insert the file
|
/* Convert newlines to nulls in the given filename. */
|
||||||
* or execute the command. */
|
|
||||||
sunder(answer);
|
sunder(answer);
|
||||||
align(&answer);
|
align(&answer);
|
||||||
|
|
||||||
|
@ -1235,9 +1234,9 @@ void do_insertfile(
|
||||||
|
|
||||||
/* Update the current x-coordinate to account for the
|
/* Update the current x-coordinate to account for the
|
||||||
* number of characters inserted on the current line.
|
* number of characters inserted on the current line.
|
||||||
* If the mark begins inside the partition, adjust the
|
* If the mark was positioned after the cursor and on the
|
||||||
* mark coordinates to compensate for the change in the
|
* same line, adjust the mark's coordinates to compensate
|
||||||
* current line. */
|
* for the change in this line. */
|
||||||
openfile->current_x = strlen(openfile->filebot->data);
|
openfile->current_x = strlen(openfile->filebot->data);
|
||||||
if (openfile->fileage == openfile->filebot) {
|
if (openfile->fileage == openfile->filebot) {
|
||||||
#ifndef NANO_TINY
|
#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. */
|
/* Match against files relative to the current working directory. */
|
||||||
if (matches == NULL)
|
if (matches == NULL)
|
||||||
matches = cwd_tab_completion(buf, allow_files, &num_matches,
|
matches = cwd_tab_completion(buf, allow_files, &num_matches, *place);
|
||||||
*place);
|
|
||||||
|
|
||||||
buf_len = strlen(buf);
|
buf_len = strlen(buf);
|
||||||
|
|
||||||
|
|
24
src/nano.c
24
src/nano.c
|
@ -2009,8 +2009,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (i < output_len) {
|
while (i < output_len) {
|
||||||
/* If allow_cntrls is TRUE, convert nulls and newlines
|
/* If allow_cntrls is TRUE, convert nulls and newlines properly. */
|
||||||
* properly. */
|
|
||||||
if (allow_cntrls) {
|
if (allow_cntrls) {
|
||||||
/* Null to newline, if needed. */
|
/* Null to newline, if needed. */
|
||||||
if (output[i] == '\0')
|
if (output[i] == '\0')
|
||||||
|
@ -2028,16 +2027,13 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||||
|
|
||||||
i += char_buf_len;
|
i += char_buf_len;
|
||||||
|
|
||||||
/* If allow_cntrls is FALSE, filter out an ASCII control
|
/* If allow_cntrls is FALSE, filter out an ASCII control character. */
|
||||||
* character. */
|
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i - char_buf_len)))
|
||||||
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i -
|
|
||||||
char_buf_len)))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If the NO_NEWLINES flag isn't set, when a character is
|
/* If the NO_NEWLINES flag isn't set, when a character is
|
||||||
* added to the magicline, it means we need a new magicline. */
|
* added to the magicline, it means we need a new magicline. */
|
||||||
if (!ISSET(NO_NEWLINES) && openfile->filebot ==
|
if (!ISSET(NO_NEWLINES) && openfile->filebot == openfile->current)
|
||||||
openfile->current)
|
|
||||||
new_magicline();
|
new_magicline();
|
||||||
|
|
||||||
/* More dangerousness fun =) */
|
/* More dangerousness fun =) */
|
||||||
|
@ -2046,10 +2042,9 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||||
|
|
||||||
assert(openfile->current_x <= current_len);
|
assert(openfile->current_x <= current_len);
|
||||||
|
|
||||||
charmove(openfile->current->data + openfile->current_x +
|
charmove(openfile->current->data + openfile->current_x + char_buf_len,
|
||||||
char_buf_len, openfile->current->data +
|
openfile->current->data + openfile->current_x,
|
||||||
openfile->current_x, current_len - openfile->current_x +
|
current_len - openfile->current_x + char_buf_len);
|
||||||
char_buf_len);
|
|
||||||
strncpy(openfile->current->data + openfile->current_x, char_buf,
|
strncpy(openfile->current->data + openfile->current_x, char_buf,
|
||||||
char_buf_len);
|
char_buf_len);
|
||||||
current_len += 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);
|
add_undo(ADD);
|
||||||
|
|
||||||
/* Note that current_x has not yet been incremented. */
|
/* Note that current_x has not yet been incremented. */
|
||||||
if (openfile->mark_set && openfile->current ==
|
if (openfile->mark_set && openfile->current == openfile->mark_begin &&
|
||||||
openfile->mark_begin && openfile->current_x <
|
openfile->current_x < openfile->mark_begin_x)
|
||||||
openfile->mark_begin_x)
|
|
||||||
openfile->mark_begin_x += char_buf_len;
|
openfile->mark_begin_x += char_buf_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -644,8 +644,8 @@ void do_redo(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#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
|
#endif
|
||||||
|
|
||||||
switch (u->type) {
|
switch (u->type) {
|
||||||
|
@ -1142,11 +1142,12 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
|
||||||
} else
|
} else
|
||||||
u->xflags = WAS_MARKED_FORWARD;
|
u->xflags = WAS_MARKED_FORWARD;
|
||||||
} else {
|
} 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;
|
u->cutbottom = u->cutbuffer;
|
||||||
while (u->cutbottom->next != NULL)
|
while (u->cutbottom->next != NULL)
|
||||||
u->cutbottom = u->cutbottom->next;
|
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) {
|
if (ISSET(CUT_TO_END) || u->type == CUT_EOF) {
|
||||||
u->begin = strlen(u->cutbottom->data);
|
u->begin = strlen(u->cutbottom->data);
|
||||||
if (u->lineno == u->mark_begin_lineno)
|
if (u->lineno == u->mark_begin_lineno)
|
||||||
|
|
|
@ -404,8 +404,7 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the first n characters of one malloc()ed string to another
|
/* Copy the first n characters of one malloc()ed string to another
|
||||||
* pointer. Should be used as: "dest = mallocstrncpy(dest, src,
|
* pointer. Should be used as: "dest = mallocstrncpy(dest, src, n);". */
|
||||||
* n);". */
|
|
||||||
char *mallocstrncpy(char *dest, const char *src, size_t n)
|
char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||||
{
|
{
|
||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
|
@ -424,8 +423,7 @@ char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||||
* "dest = mallocstrcpy(dest, src);". */
|
* "dest = mallocstrcpy(dest, src);". */
|
||||||
char *mallocstrcpy(char *dest, const char *src)
|
char *mallocstrcpy(char *dest, const char *src)
|
||||||
{
|
{
|
||||||
return mallocstrncpy(dest, src, (src == NULL) ? 1 :
|
return mallocstrncpy(dest, src, (src == NULL) ? 1 : strlen(src) + 1);
|
||||||
strlen(src) + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the malloc()ed string at dest and return the malloc()ed string
|
/* Free the malloc()ed string at dest and return the malloc()ed string
|
||||||
|
|
|
@ -2298,8 +2298,8 @@ void statusbar(const char *msg, ...)
|
||||||
26;
|
26;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display the shortcut list in s on the last two rows of the bottom
|
/* Display the shortcut list corresponding to menu on the last two rows
|
||||||
* portion of the window. */
|
* of the bottom portion of the window. */
|
||||||
void bottombars(int menu)
|
void bottombars(int menu)
|
||||||
{
|
{
|
||||||
size_t i, colwidth, slen;
|
size_t i, colwidth, slen;
|
||||||
|
|
Loading…
Reference in New Issue