Skip to content

fix(playground): handle trailing newlines correctly - #38

Merged
ohnishant merged 3 commits into
mainfrom
fix/playground-editor-newlines
Aug 29, 2026
Merged

ohnishant merged 3 commits into
mainfrom
fix/playground-editor-newlines

Conversation

@ohnishant

Copy link
Copy Markdown
Owner

Fixes two related editor behaviors in the playground.

  • One Enter keypress now inserts exactly one source newline, instead of the browser's default block markup creating two.
  • Deleting all content leaves the editor truly empty, rather than a stranded <br> keeping the source as \n.

The Enter handler still leaves autocomplete and Ctrl+Enter run alone. I also added an e.isComposing guard so IME users can confirm composition with Enter.

Closes #35
Closes #36
Supersedes #37 (branch renamed to follow the fix/... convention).

Verification:

  • go test ./...
  • go vet ./...
  • gofmt -l .
  • Manual browser checks in Chromium at desktop and iPhone 12 Pro sizes.

@ohnishant
ohnishant merged commit 10eccc6 into main Aug 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

playground: final empty line cannot be deleted playground: Enter at end inserts two newlines

1 participant