Skip to content

Commit a14d172

Browse files
committed
Remove indentation level special-casing in TieredLinesElider
1 parent aa57610 commit a14d172

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

lib/super_diff/core/tiered_lines_elider.rb

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ def one_dimensional_line_tree?
9999
end
100100

101101
def all_indentation_levels
102-
levels = lines.map(&:indentation_level).uniq
103-
normalized_indentation_levels(levels)
102+
lines
103+
.reject(&:complete_bookend?)
104+
.map(&:indentation_level)
105+
.uniq
104106
end
105107

106108
def find_boxes_to_elide_within(pane)
@@ -137,8 +139,7 @@ def box_groups_at_decreasing_indentation_levels_within(pane)
137139

138140
levels = boxes_within_pane.map(&:indentation_level).uniq
139141

140-
possible_indentation_levels =
141-
normalized_indentation_levels(levels).sort.reverse
142+
possible_indentation_levels = levels.sort.reverse
142143

143144
possible_indentation_levels.map do |indentation_level|
144145
boxes_within_pane.select do |box|
@@ -167,14 +168,6 @@ def filter_out_boxes_fully_contained_in_others(boxes)
167168
end
168169
end
169170

170-
def normalized_indentation_levels(levels)
171-
# For flat structures (strings), include level 0
172-
return levels if levels.all?(&:zero?)
173-
174-
# For nested structures (arrays, hashes), exclude level 0 (brackets)
175-
levels.select(&:positive?)
176-
end
177-
178171
def combine_congruent_boxes(boxes)
179172
combine(boxes, on: :indentation_level)
180173
end

0 commit comments

Comments
 (0)