Merge remote-tracking branch 'origin/master' into blender2.8
[blender.git] / source / blender / editors / space_text / text_draw.c
index fcb675abcf235c5878c0035afb62115cfccfcc39..62fde49cade53f95dbe8e6dbfbb092521b59b6f3 100644 (file)
@@ -596,7 +596,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
                        drawcache->total_lines = 0;
 
                        if (st->showlinenrs)
-                               st->linenrs_tot = (int)floor(log10((float)nlines)) + 1;
+                               st->linenrs_tot = integer_digits_i(nlines);
 
                        while (line) {
                                if (drawcache->valid_head) { /* we're inside valid head lines */
@@ -630,7 +630,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
                        nlines = BLI_listbase_count(&txt->lines);
 
                        if (st->showlinenrs)
-                               st->linenrs_tot = (int)floor(log10((float)nlines)) + 1;
+                               st->linenrs_tot = integer_digits_i(nlines);
                }
 
                drawcache->total_lines = nlines;