tweaks: avoid an empty function call in tiny version with line numbers

This commit is contained in:
Benno Schulenberg 2017-05-05 12:33:25 +02:00
parent 7b5cc1dcda
commit 5a3de7f117
3 changed files with 6 additions and 3 deletions

View File

@ -2637,9 +2637,10 @@ int main(int argc, char **argv)
margin = needed_margin;
editwincols = COLS - margin;
#ifndef NANO_TINY
/* Ensure that firstcolumn is the starting column of its chunk. */
ensure_firstcolumn_is_aligned();
#endif
/* The margin has changed -- schedule a full refresh. */
refresh_needed = TRUE;
}

View File

@ -662,7 +662,9 @@ int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
void edit_scroll(scroll_dir direction, int nrows);
#ifndef NANO_TINY
void ensure_firstcolumn_is_aligned(void);
#endif
void edit_redraw(filestruct *old_current);
void edit_refresh(void);
void adjust_viewport(update_type location);

View File

@ -2951,19 +2951,19 @@ void edit_scroll(scroll_dir direction, int nrows)
}
}
#ifndef NANO_TINY
/* 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
* has changed, because then the width of softwrapped chunks has changed. */
void ensure_firstcolumn_is_aligned(void)
{
#ifndef NANO_TINY
if (openfile->firstcolumn % editwincols != 0)
openfile->firstcolumn -= (openfile->firstcolumn % editwincols);
/* If smooth scrolling is on, make sure the viewport doesn't center. */
focusing = FALSE;
#endif
}
#endif
/* Return TRUE if current[current_x] is above the top of the screen, and FALSE
* otherwise. */