aboutsummaryrefslogtreecommitdiffstats
path: root/src/getstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/getstring.c')
-rw-r--r--src/getstring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/getstring.c b/src/getstring.c
index 3b9e865..8633ef3 100644
--- a/src/getstring.c
+++ b/src/getstring.c
@@ -154,7 +154,7 @@ getstr_fixscr (struct getstr_status *st)
while (st->pos < st->scrpos)
{
pgskip = 0;
- while (pgskip < pgsize)
+ while (pgskip < pgsize && st->scrpos > 0)
{
st->scrpos--;
pgskip += st->ci[st->scrpos + 1].dpyoff - st->ci[st->scrpos].dpyoff;
@@ -163,7 +163,7 @@ getstr_fixscr (struct getstr_status *st)
while (st->ci[st->pos].dpyoff - st->ci[st->scrpos].dpyoff > col - 2)
{
pgskip = 0;
- while (pgskip < pgsize)
+ while (pgskip < pgsize && st->scrpos < st->len)
{
pgskip += st->ci[st->scrpos + 1].dpyoff - st->ci[st->scrpos].dpyoff;
st->scrpos++;