File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,8 @@ def __init__(
226
226
)
227
227
self .add (self .line_numbers )
228
228
229
+ for line in self .code_lines :
230
+ line .submobjects = [c for c in line if not isinstance (c , Dot )]
229
231
self .add (self .code_lines )
230
232
231
233
if background_config is None :
Original file line number Diff line number Diff line change
1
+ import numpy as np
2
+
1
3
from manim .mobject .text .code_mobject import Code
2
4
from manim .utils .color .core import ManimColor
3
5
@@ -29,3 +31,17 @@ def test_code_initialization_from_file():
29
31
)
30
32
assert len (rendered_code .code_lines ) == len (rendered_code .line_numbers )
31
33
assert rendered_code .background .fill_color == ManimColor ("#101010" )
34
+
35
+
36
+ def test_line_heights_initial_whitespace ():
37
+ rendered_code = Code (
38
+ code_string = """print('Hello, World!')
39
+ for _ in range(42):
40
+ print('Hello, World!')
41
+ """ ,
42
+ language = "python" ,
43
+ )
44
+ np .testing .assert_almost_equal (
45
+ rendered_code .code_lines [0 ].height ,
46
+ rendered_code .code_lines [2 ].height ,
47
+ )
You can’t perform that action at this time.
0 commit comments