tweaks: rename three variables, for more contrast and variety
parent
6abb551fdd
commit
9066a96dde
26
src/text.c
26
src/text.c
|
@ -1545,10 +1545,10 @@ bool do_wrap(filestruct *line)
|
||||||
/* The length of the line we wrap. */
|
/* The length of the line we wrap. */
|
||||||
ssize_t wrap_loc;
|
ssize_t wrap_loc;
|
||||||
/* The index of line->data where we wrap. */
|
/* The index of line->data where we wrap. */
|
||||||
const char *after_break;
|
const char *remainder;
|
||||||
/* The text after the wrap point. */
|
/* The text after the wrap point. */
|
||||||
size_t after_break_len;
|
size_t rest_length;
|
||||||
/* The length of after_break. */
|
/* The length of the remainder. */
|
||||||
const char *next_line = NULL;
|
const char *next_line = NULL;
|
||||||
/* The next line, minus indentation. */
|
/* The next line, minus indentation. */
|
||||||
size_t next_line_len = 0;
|
size_t next_line_len = 0;
|
||||||
|
@ -1603,31 +1603,29 @@ bool do_wrap(filestruct *line)
|
||||||
* and the text of the next line, if they can fit without wrapping,
|
* and the text of the next line, if they can fit without wrapping,
|
||||||
* the next line exists, and the prepend_wrap flag is set. */
|
* the next line exists, and the prepend_wrap flag is set. */
|
||||||
|
|
||||||
/* after_break is the text that will be wrapped to the next line. */
|
/* The remainder is the text that will be wrapped to the next line. */
|
||||||
after_break = line->data + wrap_loc;
|
remainder = line->data + wrap_loc;
|
||||||
after_break_len = line_len - wrap_loc;
|
rest_length = line_len - wrap_loc;
|
||||||
|
|
||||||
/* We prepend the wrapped text to the next line, if the prepend_wrap
|
/* We prepend the wrapped text to the next line, if the prepend_wrap
|
||||||
* flag is set, there is a next line, and prepending would not make
|
* flag is set, there is a next line, and prepending would not make
|
||||||
* the line too long. */
|
* the line too long. */
|
||||||
if (prepend_wrap && line != openfile->filebot) {
|
if (prepend_wrap && line != openfile->filebot) {
|
||||||
const char *end = after_break + move_mbleft(after_break,
|
const char *tail = remainder + move_mbleft(remainder, rest_length);
|
||||||
after_break_len);
|
|
||||||
|
|
||||||
/* Go to the end of the line. */
|
/* Go to the end of the line. */
|
||||||
openfile->current_x = line_len;
|
openfile->current_x = line_len;
|
||||||
|
|
||||||
/* If after_break doesn't end in a blank, make sure it ends in a
|
/* If the remainder doesn't end in a blank, add a space. */
|
||||||
* space. */
|
if (!is_blank_mbchar(tail) && !ISSET(JUSTIFY_TRIM)) {
|
||||||
if (!is_blank_mbchar(end) && !ISSET(JUSTIFY_TRIM)) {
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(ADD);
|
add_undo(ADD);
|
||||||
#endif
|
#endif
|
||||||
line->data = charealloc(line->data, line_len + 2);
|
line->data = charealloc(line->data, line_len + 2);
|
||||||
line->data[line_len] = ' ';
|
line->data[line_len] = ' ';
|
||||||
line->data[line_len + 1] = '\0';
|
line->data[line_len + 1] = '\0';
|
||||||
after_break = line->data + wrap_loc;
|
remainder = line->data + wrap_loc;
|
||||||
after_break_len++;
|
rest_length++;
|
||||||
openfile->totsize++;
|
openfile->totsize++;
|
||||||
openfile->current_x++;
|
openfile->current_x++;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
@ -1638,7 +1636,7 @@ bool do_wrap(filestruct *line)
|
||||||
next_line = line->next->data;
|
next_line = line->next->data;
|
||||||
next_line_len = strlen(next_line);
|
next_line_len = strlen(next_line);
|
||||||
|
|
||||||
if (after_break_len + next_line_len <= fill) {
|
if (rest_length + next_line_len <= fill) {
|
||||||
/* Delete the LF to join the two lines. */
|
/* Delete the LF to join the two lines. */
|
||||||
do_delete();
|
do_delete();
|
||||||
/* Delete any leading blanks from the joined-on line. */
|
/* Delete any leading blanks from the joined-on line. */
|
||||||
|
|
Loading…
Reference in New Issue