nano

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

commit dcd34b246abd9a055fa4c53043c94121ef013827
parent b0dcb15f94f509500f3f28308f38f260164618da
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 19 Jul 2020 10:17:21 +0200

tweaks: move a function to the file where it is used the most

Also, fully exclude the function from the tiny version.

Diffstat:
Msrc/cut.c | 3++-
Msrc/files.c | 10----------
Msrc/nano.c | 8++++++++
Msrc/prototypes.h | 2+-
4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/cut.c b/src/cut.c @@ -381,9 +381,10 @@ void ingraft_buffer(linestruct *topline) } if (topline != botline) { +#ifndef NANO_TINY /* First compute the softwrapped chunks for each line in the graft. */ compute_the_extra_rows_per_line_from(topline); - +#endif /* When inserting at end-of-buffer, update the relevant pointer. */ if (line->next == NULL) openfile->filebot = botline; diff --git a/src/files.c b/src/files.c @@ -356,16 +356,6 @@ bool has_valid_path(const char *filename) return validity; } -/* Compute and store how many extra rows each line needs when softwrapping. */ -void compute_the_extra_rows_per_line_from(linestruct *fromline) -{ -#ifndef NANO_TINY - if (ISSET(SOFTWRAP)) - for (linestruct *line = fromline; line != NULL; line = line->next) - line->extrarows = extra_chunks_in(line); -#endif -} - /* This does one of three things. If the filename is "", it just creates * a new empty buffer. When the filename is not empty, it reads that file * into a new buffer when requested, otherwise into the existing buffer. */ diff --git a/src/nano.c b/src/nano.c @@ -1009,6 +1009,14 @@ RETSIGTYPE handle_sigwinch(int signal) the_window_resized = TRUE; } +/* Compute and store how many extra rows each line needs when softwrapping. */ +void compute_the_extra_rows_per_line_from(linestruct *fromline) +{ + if (ISSET(SOFTWRAP)) + for (linestruct *line = fromline; line != NULL; line = line->next) + line->extrarows = extra_chunks_in(line); +} + /* Reinitialize and redraw the screen completely. */ void regenerate_screen(void) { diff --git a/src/prototypes.h b/src/prototypes.h @@ -275,7 +275,6 @@ void make_new_buffer(void); #ifndef NANO_TINY bool delete_lockfile(const char *lockfilename); #endif -void compute_the_extra_rows_per_line_from(linestruct *fromline); bool open_buffer(const char *filename, bool new_one); void set_modified(void); void prepare_for_display(void); @@ -418,6 +417,7 @@ void block_sigwinch(bool blockit); #endif #ifndef NANO_TINY RETSIGTYPE handle_sigwinch(int signal); +void compute_the_extra_rows_per_line_from(linestruct *fromline); void regenerate_screen(void); void do_toggle(int flag); #endif