fix: expand tabs on paste to match tab-width setting - #17
Merged
Conversation
When code with tab characters is pasted into the textarea, the raw tabs now get expanded to spaces based on the current tab-width setting. Previously, pressing Tab inserted spaces correctly, but pasting code with actual tab characters left them as-is in the textarea, causing a visual mismatch between the textarea display and the canvas output. Changes: - Add on:paste handler to both code textareas - Expand tabs to spaces using current tab_width before inserting - Add ClipboardEvent and DataTransfer web-sys features
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
canvas_ref.get() inside spawn_local async block was outside reactive tracking context, causing a Leptos warning. Changed to get_untracked() since NodeRef access here doesn't need reactive tracking.
Tab width setting was causing bugs with pasted code and wasn't essential. Hardcode tab_width=4 in ExportOptions. Tab key in textarea still inserts 4 spaces. Remove paste handlers and ClipboardEvent/DataTransfer features.
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.
Bug
When code with tab characters is pasted into the textarea, the raw tabs are left as-is, causing a visual mismatch between the textarea display and the canvas output.
Before: Pressing Tab inserts spaces (correct), but pasting code with \t characters leaves them as narrow single chars in textarea while canvas expands them.
After: Both Tab key and paste expand tabs to spaces based on the current tab-width setting.
Changes
Test
Closes the tab-width paste bug found after Phase 6 merge.