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__(
226226 )
227227 self .add (self .line_numbers )
228228
229+ for line in self .code_lines :
230+ line .submobjects = [c for c in line if not isinstance (c , Dot )]
229231 self .add (self .code_lines )
230232
231233 if background_config is None :
Original file line number Diff line number Diff line change 1+ import numpy as np
2+
13from manim .mobject .text .code_mobject import Code
24from manim .utils .color .core import ManimColor
35
@@ -29,3 +31,17 @@ def test_code_initialization_from_file():
2931 )
3032 assert len (rendered_code .code_lines ) == len (rendered_code .line_numbers )
3133 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