diff --git a/adia/renderingplans.py b/adia/renderingplans.py index 6a05c51..c111b49 100644 --- a/adia/renderingplans.py +++ b/adia/renderingplans.py @@ -198,11 +198,11 @@ def text(self): def _calc_singlemodule(self): self.start = self.startmodule.col - linelen = 0 + linelen = len(self.kind) + 5 if self.item.text: - linelen = len(self.item.text) + linelen += len(self.item.text) - self.length = linelen + 7 + self.length = linelen self.end = self.start + self.length self.end -= 1 return 0, 3, 0 diff --git a/tests/test_sequence_selfcall.py b/tests/test_sequence_selfcall.py index c7d1803..2aeaebc 100644 --- a/tests/test_sequence_selfcall.py +++ b/tests/test_sequence_selfcall.py @@ -264,3 +264,52 @@ def test_sequence_condition_inside_selfcall_issue5_test4(): . +-----+ +-----+ +-----+ . ............................................... ''') + + +def test_sequence_loop_over_selfcall_issue44(): + d = Diagram(''' + diagram: foo + sequence: + while: Lorem ipsum + foo -> foo + + for: Lorem Ipsum + foo -> foo + ''') + assert eqdia(d, ''' + ......................... + . DIAGRAM: foo . + . . + . +-----+ . + . | foo | . + . +-----+ . + . | . + . ********************* . + . * while Lorem ipsum * . + . ********************* . + . | . + . |~~~~~~+ . + . | | . + . |<-----+ . + . | . + . ********************* . + . * end while * . + . ********************* . + . | . + . ******************* . + . * for Lorem Ipsum * . + . ******************* . + . | . + . |~~~~~~+ . + . | | . + . |<-----+ . + . | . + . ******************* . + . * end for * . + . ******************* . + . | . + . +-----+ . + . | foo | . + . +-----+ . + ......................... + ''')