-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: copy the current formats when insertings a character #187
fix: copy the current formats when insertings a character #187
Conversation
Previously we would just insert the character at the point, however, when a character was inserted within a text format they would split the format and insert the character with no formats. With this commit we copy the current `value` and insert out character here which preserves the surrounding formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the PR!
I tested the changes and it has worked partially for me.
The formatting doesn't seem to work when the string is partially formatted.
Please watch the 2 videos below:
Working
ISC-W.mp4
Not working
ISC-NW.mp4
Let us know if you need any assistance with this PR.
Updates newValue.formats to be the length of the new text string by duplicating the formats at value.start; this fixes an issue where it breaks the remaining format if it is added within the middle
hey @Sidsector9 thanks for testing! I believe i have fixed this by copying the current positions formats :) Screen.Recording.2023-02-28.at.11.29.29.mov |
@jrmd welcome to Insert Special Characters and thanks for the PR, this is definitely a nice improvement in maintaining formatting... many thanks for the contribution! |
Description of the Change
Previously we would just insert the character at the point, however, when a character was inserted within a text format they would split the format and insert the character with no formats.
With this commit we copy the current
value
and insert out character here which preserves the surrounding formattingOld Behaviour
Old.Insert.Behaviour.mov
New Behaviour
New.Behaviour.mov
How to test the Change
Create some text with a text format (bold/italic) put cursor in the middle add a special character ensure that the format isnt split by the special character
Changelog Entry
Credits
@jrmd
Checklist: