[Bf-blender-cvs] [7c54de4ab38] master: Fix T73696: Text editor scroll glitch

Kai Jægersen noreply at git.blender.org
Mon Feb 10 07:06:16 CET 2020


Commit: 7c54de4ab38171c2555e608c70cc02e1d08b893f
Author: Kai Jægersen
Date:   Mon Feb 10 17:04:01 2020 +1100
Branches: master
https://developer.blender.org/rB7c54de4ab38171c2555e608c70cc02e1d08b893f

Fix T73696: Text editor scroll glitch

Scrolling a short text buffer could show the cursor offset.

===================================================================

M	source/blender/editors/space_text/text_ops.c

===================================================================

diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index eea3e4d7958..2187338f2d2 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -29,6 +29,7 @@
 #include "DNA_text_types.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_math_base.h"
 
 #include "BLT_translation.h"
 
@@ -2544,7 +2545,7 @@ static void text_scroll_state_init(TextScroll *tsc, SpaceText *st, ARegion *ar)
   tsc->state.ofs_init[1] = st->top;
 
   tsc->state.ofs_max[0] = INT_MAX;
-  tsc->state.ofs_max[1] = text_get_total_lines(st, ar) - (st->runtime.viewlines / 2);
+  tsc->state.ofs_max[1] = max_ii(0, text_get_total_lines(st, ar) - (st->runtime.viewlines / 2));
 
   tsc->state.size_px[0] = st->runtime.cwidth_px;
   tsc->state.size_px[1] = TXT_LINE_HEIGHT(st);



More information about the Bf-blender-cvs mailing list