чување e257772180568343938307f3e3cab1c6339a0cf6
родитељ b7b287120b09b845411652b2841286080fddcadd
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Wed, 17 Jul 2024 11:40:44 +0200
sled.c(position_to): Limit first_shown_col updating, when moving to the
right of last character or to the left of the first, to bottom and top
of screen respectively
Diffstat:
измењених датотека: 1, додавања: 7(+), брисања: 3(-)
diff --git a/sled.c b/sled.c
@@ -1722,7 +1722,9 @@ position_to(struct DrawState* state, const int row, const int column)
if (state->coord.row > 0)
{
state->coord.row--;
- if (state->first_shown.row > 0)
+ if (state->first_shown.row > 0
+ && state->first_shown.row
+ > state->coord.row)
state->first_shown.row--;
state->coord.col
= state->buffer[state->coord.row].length;
@@ -1736,8 +1738,10 @@ position_to(struct DrawState* state, const int row, const int column)
if ((state->coord.row + 1) < state->rows_count)
{
state->coord.row++;
- if (state->first_shown.row + 1
- < state->rows_count)
+ if (state->first_shown.row + (state->maxy - 2)
+ < state->coord.row
+ && state->first_shown.row + 1
+ < state->rows_count)
state->first_shown.row++;
state->coord.col = 0;
}