nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 77bd8c2630bcf500529492fa2d9e8ae52d112647
parent 3121ee4b2e00ea836ce292b55b2d183d451a9485
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Mon, 22 Oct 2018 18:01:23 -0500

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.

Diffstat:
Msrc/global.c | 6+++---
Msrc/nano.c | 16++++++++--------
Msrc/proto.h | 2+-
Msrc/rcfile.c | 4++--
Msrc/text.c | 8++++----
5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -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; diff --git a/src/nano.c b/src/nano.c @@ -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) { diff --git a/src/proto.h b/src/proto.h @@ -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; diff --git a/src/rcfile.c b/src/rcfile.c @@ -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); diff --git a/src/text.c b/src/text.c @@ -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)