1
1

tweaks: condense three comments, drop another, and rewrap a line

Этот коммит содержится в:
Benno Schulenberg 2021-04-23 12:04:19 +02:00
родитель 588022ab8c
Коммит af90f03ac5

Просмотреть файл

@ -3288,14 +3288,11 @@ size_t actual_last_column(size_t leftedge, size_t column)
return leftedge + column; return leftedge + column;
} }
/* Return TRUE if current[current_x] is above the top of the screen, and FALSE /* Return TRUE if current[current_x] is before the viewport. */
* otherwise. */
bool current_is_above_screen(void) bool current_is_above_screen(void)
{ {
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(SOFTWRAP)) if (ISSET(SOFTWRAP))
/* The cursor is above screen when current[current_x] is before edittop
* at column firstcolumn. */
return (openfile->current->lineno < openfile->edittop->lineno || return (openfile->current->lineno < openfile->edittop->lineno ||
(openfile->current->lineno == openfile->edittop->lineno && (openfile->current->lineno == openfile->edittop->lineno &&
xplustabs() < openfile->firstcolumn)); xplustabs() < openfile->firstcolumn));
@ -3304,8 +3301,7 @@ bool current_is_above_screen(void)
return (openfile->current->lineno < openfile->edittop->lineno); return (openfile->current->lineno < openfile->edittop->lineno);
} }
/* Return TRUE if current[current_x] is below the bottom of the screen, and /* Return TRUE if current[current_x] is beyond the viewport. */
* FALSE otherwise. */
bool current_is_below_screen(void) bool current_is_below_screen(void)
{ {
#ifndef NANO_TINY #ifndef NANO_TINY
@ -3318,16 +3314,14 @@ bool current_is_below_screen(void)
return (go_forward_chunks(editwinrows - 1, &line, &leftedge) == 0 && return (go_forward_chunks(editwinrows - 1, &line, &leftedge) == 0 &&
(line->lineno < openfile->current->lineno || (line->lineno < openfile->current->lineno ||
(line->lineno == openfile->current->lineno && (line->lineno == openfile->current->lineno &&
leftedge < leftedge_for(xplustabs(), leftedge < leftedge_for(xplustabs(), openfile->current))));
openfile->current))));
} else } else
#endif #endif
return (openfile->current->lineno >= return (openfile->current->lineno >=
openfile->edittop->lineno + editwinrows); openfile->edittop->lineno + editwinrows);
} }
/* Return TRUE if current[current_x] is offscreen relative to edittop, and /* Return TRUE if current[current_x] is outside the viewport. */
* FALSE otherwise. */
bool current_is_offscreen(void) bool current_is_offscreen(void)
{ {
return (current_is_above_screen() || current_is_below_screen()); return (current_is_above_screen() || current_is_below_screen());