From f6527043d9fd12fd9d9281d45ddbd1b0c3d5997e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Aug 2013 08:13:32 +0000 Subject: fix for glitch where the text editor could be clamped to scroll above line 1 (would flicker on scroll). --- source/blender/editors/space_text/text_ops.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_text') diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index dec61a0e1ca..d4ebd6f273b 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2086,10 +2086,17 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot) static void txt_screen_clamp(SpaceText *st, ARegion *ar) { - int last; - last = text_get_total_lines(st, ar); - last = last - (st->viewlines / 2); - CLAMP(st->top, 0, last); + if (st->top < 0) { + st->top = 0; + } + else { + int last; + last = text_get_total_lines(st, ar); + last = last - (st->viewlines / 2); + if (last > 0 && st->top > last) { + st->top = last; + } + } } /* Moves the view vertically by the specified number of lines */ -- cgit v1.2.3