Skip to content

Commit 10fbf33

Browse files
committed
fix: Simplify text editing logic by removing leading spaces handling in ExampleGenerationPage
1 parent 515450a commit 10fbf33

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

page-objects/example-generation-page.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -810,16 +810,15 @@ export class ExampleGenerationPage extends BasePage {
810810

811811
await expect(line).toBeVisible({ timeout: 10000 });
812812

813-
const originalText = await line.innerText();
814-
const leadingSpaces = originalText.match(/^\s*/)?.[0] ?? "";
815-
816813
await line.scrollIntoViewIfNeeded();
817814
await line.click();
818815

816+
// In CodeMirror, Home lands at first non-whitespace for indented lines.
817+
// Replacing from there keeps existing indentation unchanged.
819818
await this.page.keyboard.press("Home");
820819
await this.page.keyboard.press("Shift+End");
821820

822-
await this.page.keyboard.type(leadingSpaces + edit.changeTo);
821+
await this.page.keyboard.type(edit.changeTo);
823822

824823
takeAndAttachScreenshot(
825824
this.page,

0 commit comments

Comments
 (0)