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

Also, fully exclude the function from the tiny version.
master
Benno Schulenberg 2020-07-19 10:17:21 +02:00
parent b0dcb15f94
commit dcd34b246a
4 changed files with 11 additions and 12 deletions

View File

@ -381,9 +381,10 @@ void ingraft_buffer(linestruct *topline)
} }
if (topline != botline) { if (topline != botline) {
#ifndef NANO_TINY
/* First compute the softwrapped chunks for each line in the graft. */ /* First compute the softwrapped chunks for each line in the graft. */
compute_the_extra_rows_per_line_from(topline); compute_the_extra_rows_per_line_from(topline);
#endif
/* When inserting at end-of-buffer, update the relevant pointer. */ /* When inserting at end-of-buffer, update the relevant pointer. */
if (line->next == NULL) if (line->next == NULL)
openfile->filebot = botline; openfile->filebot = botline;

View File

@ -356,16 +356,6 @@ bool has_valid_path(const char *filename)
return validity; 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 /* 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 * 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. */ * into a new buffer when requested, otherwise into the existing buffer. */

View File

@ -1009,6 +1009,14 @@ RETSIGTYPE handle_sigwinch(int signal)
the_window_resized = TRUE; 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. */ /* Reinitialize and redraw the screen completely. */
void regenerate_screen(void) void regenerate_screen(void)
{ {

View File

@ -275,7 +275,6 @@ void make_new_buffer(void);
#ifndef NANO_TINY #ifndef NANO_TINY
bool delete_lockfile(const char *lockfilename); bool delete_lockfile(const char *lockfilename);
#endif #endif
void compute_the_extra_rows_per_line_from(linestruct *fromline);
bool open_buffer(const char *filename, bool new_one); bool open_buffer(const char *filename, bool new_one);
void set_modified(void); void set_modified(void);
void prepare_for_display(void); void prepare_for_display(void);
@ -418,6 +417,7 @@ void block_sigwinch(bool blockit);
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
RETSIGTYPE handle_sigwinch(int signal); RETSIGTYPE handle_sigwinch(int signal);
void compute_the_extra_rows_per_line_from(linestruct *fromline);
void regenerate_screen(void); void regenerate_screen(void);
void do_toggle(int flag); void do_toggle(int flag);
#endif #endif