tweaks: elide unneeded calls of get_last_chunk_leftedge()
And then elide the function entirely as it's called just once.master
parent
8766e7bdcb
commit
482fb352b8
|
@ -670,7 +670,6 @@ size_t get_chunk(filestruct *line, size_t column, size_t *leftedge);
|
||||||
size_t get_chunk_row(filestruct *line, size_t column);
|
size_t get_chunk_row(filestruct *line, size_t column);
|
||||||
size_t get_chunk_leftedge(filestruct *line, size_t column);
|
size_t get_chunk_leftedge(filestruct *line, size_t column);
|
||||||
size_t get_last_chunk_row(filestruct *line);
|
size_t get_last_chunk_row(filestruct *line);
|
||||||
size_t get_last_chunk_leftedge(filestruct *line);
|
|
||||||
void ensure_firstcolumn_is_aligned(void);
|
void ensure_firstcolumn_is_aligned(void);
|
||||||
#endif
|
#endif
|
||||||
void edit_redraw(filestruct *old_current);
|
void edit_redraw(filestruct *old_current);
|
||||||
|
|
21
src/winio.c
21
src/winio.c
|
@ -2834,7 +2834,7 @@ int go_back_chunks(int nrows, filestruct **line, size_t *leftedge)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
*line = (*line)->prev;
|
*line = (*line)->prev;
|
||||||
current_leftedge = get_last_chunk_leftedge(*line);
|
current_leftedge = get_chunk_leftedge(*line, (size_t)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only change leftedge when we actually could move. */
|
/* Only change leftedge when we actually could move. */
|
||||||
|
@ -2863,24 +2863,22 @@ int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge)
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (ISSET(SOFTWRAP)) {
|
if (ISSET(SOFTWRAP)) {
|
||||||
size_t current_leftedge = *leftedge;
|
size_t current_leftedge = *leftedge;
|
||||||
size_t last_leftedge = get_last_chunk_leftedge(*line);
|
|
||||||
|
|
||||||
/* Advance through the requested number of chunks. */
|
/* Advance through the requested number of chunks. */
|
||||||
for (i = nrows; i > 0; i--) {
|
for (i = nrows; i > 0; i--) {
|
||||||
if (current_leftedge < last_leftedge) {
|
bool end_of_line = FALSE;
|
||||||
bool dummy;
|
|
||||||
|
|
||||||
current_leftedge = get_softwrap_breakpoint((*line)->data,
|
current_leftedge = get_softwrap_breakpoint((*line)->data,
|
||||||
current_leftedge, &dummy);
|
current_leftedge, &end_of_line);
|
||||||
|
|
||||||
|
if (!end_of_line)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (*line == openfile->filebot)
|
if (*line == openfile->filebot)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
*line = (*line)->next;
|
*line = (*line)->next;
|
||||||
current_leftedge = 0;
|
current_leftedge = 0;
|
||||||
last_leftedge = get_last_chunk_leftedge(*line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only change leftedge when we actually could move. */
|
/* Only change leftedge when we actually could move. */
|
||||||
|
@ -3130,13 +3128,6 @@ size_t get_last_chunk_row(filestruct *line)
|
||||||
return get_chunk_row(line, (size_t)-1);
|
return get_chunk_row(line, (size_t)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the leftmost column of the last softwrapped chunk of the given
|
|
||||||
* line. */
|
|
||||||
size_t get_last_chunk_leftedge(filestruct *line)
|
|
||||||
{
|
|
||||||
return get_chunk_leftedge(line, (size_t)-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure that firstcolumn is at the starting column of the softwrapped chunk
|
/* Ensure that firstcolumn is at the starting column of the softwrapped chunk
|
||||||
* it's on. We need to do this when the number of columns of the edit window
|
* it's on. We need to do this when the number of columns of the edit window
|
||||||
* has changed, because then the width of softwrapped chunks has changed. */
|
* has changed, because then the width of softwrapped chunks has changed. */
|
||||||
|
|
Loading…
Reference in New Issue