tweaks: swap the names of the variables 'wrap_at' and 'fill'

Now 'fill' contains the original specified value,
and 'wrap_at' the column that 'fill' translates to.
master
David Lawrence Ramsey 2018-10-22 18:01:23 -05:00 committed by Benno Schulenberg
parent 3121ee4b2e
commit 77bd8c2630
5 changed files with 18 additions and 18 deletions

View File

@ -81,10 +81,10 @@ int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
#endif
#ifdef ENABLED_WRAPORJUSTIFY
ssize_t wrap_at = -COLUMNS_FROM_EOL;
ssize_t fill = -COLUMNS_FROM_EOL;
/* The relative column where we will wrap lines. */
ssize_t fill = 0;
/* The actual column where we will wrap lines, based on wrap_at. */
ssize_t wrap_at = 0;
/* The actual column where we will wrap lines, based on fill. */
#endif
char *last_search = NULL;

View File

@ -715,11 +715,11 @@ void window_init(void)
#ifdef ENABLED_WRAPORJUSTIFY
/* Set up the wrapping point, accounting for screen width when negative. */
fill = wrap_at;
if (fill <= 0)
fill += COLS;
if (fill < 0)
fill = 0;
wrap_at = fill;
if (wrap_at <= 0)
wrap_at += COLS;
if (wrap_at < 0)
wrap_at = 0;
#endif
}
@ -2244,7 +2244,7 @@ int main(int argc, char **argv)
break;
#ifdef ENABLED_WRAPORJUSTIFY
case 'r':
if (!parse_num(optarg, &wrap_at)) {
if (!parse_num(optarg, &fill)) {
fprintf(stderr, _("Requested fill size \"%s\" is invalid"), optarg);
fprintf(stderr, "\n");
exit(1);
@ -2317,7 +2317,7 @@ int main(int argc, char **argv)
if (!no_rcfiles) {
/* Back up the command-line options, then clear the strings. */
#ifdef ENABLED_WRAPORJUSTIFY
ssize_t wrap_at_cmdline = wrap_at;
ssize_t fill_cmdline = fill;
#endif
#ifndef NANO_TINY
char *backup_dir_cmdline = backup_dir;
@ -2363,7 +2363,7 @@ int main(int argc, char **argv)
/* If the backed-up command-line options have a value, restore them. */
#ifdef ENABLED_WRAPORJUSTIFY
if (fill_used)
wrap_at = wrap_at_cmdline;
fill = fill_cmdline;
#endif
#ifndef NANO_TINY
if (backup_dir_cmdline != NULL) {

View File

@ -73,7 +73,7 @@ extern int shiftaltup, shiftaltdown;
#endif
#ifdef ENABLED_WRAPORJUSTIFY
extern ssize_t wrap_at, fill;
extern ssize_t fill, wrap_at;
#endif
extern char *last_search;

View File

@ -1101,10 +1101,10 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
#endif
#ifdef ENABLED_WRAPORJUSTIFY
if (strcasecmp(rcopts[i].name, "fill") == 0) {
if (!parse_num(option, &wrap_at)) {
if (!parse_num(option, &fill)) {
rcfile_error(N_("Requested fill size \"%s\" is invalid"),
option);
wrap_at = -COLUMNS_FROM_EOL;
fill = -COLUMNS_FROM_EOL;
} else
UNSET(NO_WRAP);
free(option);

View File

@ -1638,7 +1638,7 @@ bool do_wrap(filestruct *line)
* at the end of it! */
/* Find the last blank where we can break the line. */
wrap_loc = break_line(line->data, fill, FALSE);
wrap_loc = break_line(line->data, wrap_at, FALSE);
/* If we couldn't break the line, or we've reached the end of it, we
* don't wrap. */
@ -1699,7 +1699,7 @@ bool do_wrap(filestruct *line)
#endif
}
if (rest_length + strlen(line->next->data) <= fill) {
if (rest_length + strlen(line->next->data) <= wrap_at) {
/* Delete the LF to join the two lines. */
do_delete();
/* Delete any leading blanks from the joined-on line. */
@ -2120,13 +2120,13 @@ void justify_paragraph(filestruct **firstline, size_t quote_len,
justify_format(jusline, quote_len +
indent_length(jusline->data + quote_len));
while (par_len > 0 && strlenpt(jusline->data) > fill) {
while (par_len > 0 && strlenpt(jusline->data) > wrap_at) {
size_t line_len = strlen(jusline->data);
/* If this line is too long, try to wrap it to the next line
* to make it short enough. */
break_pos = break_line(jusline->data + lead_len,
fill - strnlenpt(jusline->data, lead_len), FALSE);
wrap_at - strnlenpt(jusline->data, lead_len), FALSE);
/* If we can't break the line, or don't need to, we're done. */
if (break_pos == -1 || break_pos + lead_len == line_len)