Repository navigation
Conversation
The static Parsons path stripped leading whitespace from only the first solution line, and CodeMirror pastes multi-line text verbatim, so pasted Java (e.g. subgoal-label comments) ended up with scrambled indents. - coach.py: keep the first line's indentation in extract_parsons_code - activecode.js: normalize the copied answer (expand tabs, dedent) and, when that answer is pasted, re-indent it to the cursor's indentation (or the mode's indent when pasting at column 0) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014bZMPw1AAXTAdiAkTEKTpE
…edes-e8ednm # Conflicts: # bases/rsptx/book_server_api/routers/coach.py
main removed the `let acElement = this;` that the paste re-indent handler relied on, so after merging main every paste into the editor threw "acElement is not defined" and inserted nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The CodeTailor "Copy Answer to Clipboard" button produced code with scrambled indentation once pasted into the editor. It was most visible in Java, e.g. subgoal-label comments. There were two causes:
extract_parsons_codecalledstrip()on the whole solution text. That removed the first line's indentation but left the other lines alone, so every copied answer was misaligned before it reached the browser.Changes
coach.py:extract_parsons_codeno longer strips the whole text. It finds the-----separator by comparing stripped lines, so each line keeps its original indentation. Combined withmain's tag-stripping and<escaping.activecode.js:normalizeIndentation()cleans up the copied answer: tabs become 4 spaces, blank leading and trailing lines are dropped, and the shared indentation is removed. The cleaned text is saved ascopiedAnswer.beforeChangehandler re-indents a paste only when it matchescopiedAnswer:main()in Java);Testing
test_extract_parsons_code.pypasses, along with all activecode vitest suites.u2b-toggle6(subgoal-labels Get Help), both in Chrome and with a Playwright script: Get Help → solve → Copy → Close Help → paste on the blank line insidemain. The labels land atmain's indentation with their nesting kept.Notes
main. It's fixed in this PR.🤖 Generated with Claude Code