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

Also, fully exclude the function from the tiny version.
This commit is contained in:
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) {
#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;

View File

@ -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. */

View File

@ -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)
{

View File

@ -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