Skip to content

Commit 1b5de52

Browse files
committed
Fix broken tests.
The default_mods have to be the same in the formatting_stack and the current_section or we lose the first set of formatting flags when we add the second set of formatting flags to the stack.
1 parent a610c4b commit 1b5de52

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/ruby-rtf/parser.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ class Parser
1111
attr_reader :doc
1212

1313
def initialize
14-
@formatting_stack = []
15-
@current_section = {:text => '', :modifiers => {}}
14+
# default_mods needs to be the same has in the formatting stack and in
15+
# the current_section modifiers or the first stack ends up getting lost.
16+
default_mods = {}
17+
@formatting_stack = [default_mods]
18+
@current_section = {:text => '', :modifiers => default_mods}
1619

1720
@seen = {}
1821

0 commit comments

Comments
 (0)