Skip to content

Commit 8e54542

Browse files
committed
fix: bug in 'segment_to_search_range' when end_relpos.marker_subtype == 'number'
1 parent 612be9a commit 8e54542

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/text_manipulation/text_editor_kit.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,17 @@ def segment_to_search_range(
181181
)
182182

183183
start_index_for_end_marker = start_match_result.as_index
184-
match start_relpos:
185-
case RelativeMarker(qualifier=RelativePositionType.AFTER):
186-
start_index_for_end_marker += -1
187-
end_match_result = RangeSpec.from_line_marker(lines, end_relpos, RangeSpec(
188-
start_index_for_end_marker, search_range.end, start_match_result.indent
189-
))
184+
search_range_for_end_marker = search_range
185+
if end_relpos.marker_subtype != 'number':
186+
match start_relpos:
187+
case RelativeMarker(qualifier=RelativePositionType.AFTER):
188+
start_index_for_end_marker += -1
189+
search_range_for_end_marker = RangeSpec(
190+
start_index_for_end_marker,
191+
search_range.end,
192+
start_match_result.indent
193+
)
194+
end_match_result = RangeSpec.from_line_marker(lines, end_relpos, search_range_for_end_marker)
190195
assert end_match_result, (
191196
f"Unable to find segment end: {end_relpos}; Try: "
192197
f"1) Using *exactly* the same characters from source; or "

0 commit comments

Comments
 (0)