Skip to content

Commit ed189cb

Browse files
committed
Fixes
1 parent 4698cee commit ed189cb

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/cedarscript_editor/cedarscript_editor.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ def identifier_resolver(m: Marker):
179179
case (region, relindent):
180180
dest_indent = search_range.indent
181181
content_range = restrict_search_range_for_marker(
182-
region, action, lines, search_range, identifier_resolver
182+
region, action, lines, RangeSpec.EMPTY, identifier_resolver
183183
)
184184
content = content_range.read(lines)
185185
count = dest_indent + (relindent or 0)
186-
# TODO IndentationInfo.from_content(content) ?
187-
content = IndentationInfo.from_content(lines).shift_indentation(
186+
content = IndentationInfo.from_content(content).shift_indentation(
188187
content, count
189188
)
189+
content = (region, content)
190190
case _:
191191
match action:
192192
case MoveClause(insert_position=region, relative_indentation=relindent):
@@ -219,9 +219,13 @@ def _apply_action(self, action: EditingAction, lines: Sequence[str], range_spec:
219219
range_spec.delete(lines)
220220

221221
case ReplaceClause() | InsertClause():
222-
content = IndentationInfo.from_content(lines).apply_relative_indents(
223-
content, range_spec.indent
224-
)
222+
match content:
223+
case (region, processed_content):
224+
content = processed_content
225+
case str():
226+
content = IndentationInfo.from_content(lines).apply_relative_indents(
227+
content, range_spec.indent
228+
)
225229

226230
range_spec.write(content, lines)
227231

0 commit comments

Comments
 (0)