-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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(Textbox): implemente a fix for the style shifting issues on new lines #9197
Conversation
Build Stats
|
I'll wait resolution of #9192 in order to write a test for this |
needs a different test to show what is fixing. |
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.
hard to review this thing.
there is still confusion around usage of wrapped/unwrapped as we discussed.
good luck
@@ -6,7 +6,9 @@ import { TextUtil } from '../../../utils/TextUtil'; | |||
|
|||
setup(); | |||
|
|||
[false, true].forEach((splitByGrapheme) => { | |||
test.describe.configure({ mode: 'serial' }); |
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.
what is this, looks cool
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.
this is to avoid that we run 2 fabricJS tests in the same browser window and we mix up the copy paste status that is stored globally.
Or at least it solved that for me since code that was behaving normally when using my hands wasn't behaving the same when using the tests in parallel.
Should affect ONLY this file here.
I can add more explanations. Every new line added with If the text is wrapping inside the textbox, the Now get2dCursorLocation is used both on wrapped and unwrapped lines and that is done with the skipWrapping boolean. Now yes there is still confusion about that and text could be way better, but is not going to be refactored live there is too much risks of bugs and breakage and text is one of the most important features for apps. The text code is confusing, but this change is made in a way that is not confusing to review because is focused on the exact problem that is causing styling disruption. |
Motivation
not sure this is 100% safe and needs to be tested rigorously.
When using get2dCursorLocation ignoring wrapping, the
missingnewlineoffset
is not influent, because is a wrapping only issue. get2dCursorLocation is used in insertNewStyleBlock to determine the style to copy, and in that case we have to ignore the specific of splitByGrapheme because we are making counts on unwrapped text lines.But what about all the other times we call
missingnewlineoffset
outside the get2dCursorLocation? that we need to find out.It would be probably better to just have
get2dCursorLocation
call a specific function that is different, or have get2dCursorLocation different for textbox.Note:
As pointed out by @ShaMan123 this is a bug from 5.x not a regression
Description
Changes
Gist
In Action