tweaks: adjust two comments, and reshuffle two fragments

Also rename two variables, to be more fitting.
master
Benno Schulenberg 2021-04-21 16:51:33 +02:00
parent 49d8b99e4f
commit 2cdff6c32c
4 changed files with 14 additions and 20 deletions

View File

@ -49,12 +49,9 @@ void do_deletion(undo_type action)
&openfile->current->data[openfile->current_x + charlen],
line_len - charlen + 1);
#ifndef NANO_TINY
/* When softwrapping, recompute the number of chunks in the line,
* and schedule a refresh if the number changed. */
if (ISSET(SOFTWRAP)) {
if (extra_chunks_in(openfile->current) != old_amount)
refresh_needed = TRUE;
}
/* When softwrapping, a changed number of chunks requires a refresh. */
if (ISSET(SOFTWRAP) && extra_chunks_in(openfile->current) != old_amount)
refresh_needed = TRUE;
/* Adjust the mark if it is after the cursor on the current line. */
if (openfile->mark == openfile->current &&

View File

@ -544,9 +544,8 @@ void redecorate_after_switch(void)
}
#ifndef NANO_TINY
/* While in a different buffer, the effective width of the screen may
* have changed, so make sure that
* the starting column for the first row get corresponding values. */
/* While in a different buffer, the width of the screen may have changed,
* so make sure that the starting column for the first row is fitting. */
ensure_firstcolumn_is_aligned();
#endif

View File

@ -1468,13 +1468,11 @@ void inject(char *burst, size_t count)
/* When softwrapping and the number of chunks in the current line changed,
* or we were on the last row of the edit window and moved to a new chunk,
* we need a full refresh. */
if (ISSET(SOFTWRAP)) {
if (extra_chunks_in(openfile->current) != old_amount ||
if (ISSET(SOFTWRAP) && (extra_chunks_in(openfile->current) != old_amount ||
(openfile->current_y == editwinrows - 1 &&
chunk_for(xplustabs(), openfile->current) > original_row)) {
refresh_needed = TRUE;
focusing = FALSE;
}
chunk_for(xplustabs(), openfile->current) > original_row))) {
refresh_needed = TRUE;
focusing = FALSE;
}
#endif

View File

@ -3055,12 +3055,12 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
/* Draw a scroll bar on the righthand side of the screen. */
void draw_scrollbar(void)
{
int totalrows = openfile->filebot->lineno;
int first_row = openfile->edittop->lineno;
int lowest = ((first_row - 1) * editwinrows) / totalrows;
int highest = lowest + (editwinrows * editwinrows) / totalrows;
int totallines = openfile->filebot->lineno;
int fromline = openfile->edittop->lineno - 1;
int lowest = (fromline * editwinrows) / totallines;
int highest = lowest + (editwinrows * editwinrows) / totallines;
if (editwinrows > totalrows)
if (editwinrows > totallines)
highest = editwinrows;
for (int row = 0; row < editwinrows; row++) {