-
-
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(Text) Fix style transfer issue on a line that is not empty #9461
Changes from 5 commits
961c903
53c0f4b
87ca8fc
7430586
babff4c
b4ee60b
489d58f
831fcc2
71ddf31
214eedc
4fd3548
0fdb4e5
26b6e4d
29dcc2e
b84e6f8
d79b01a
5efa2df
13415f6
edfccde
f4a1eb6
ba0f3fe
e269f09
f6960b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is another major bug here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is splitByGrapheme true so this will not take care of words, will just wraps whenever it feels it has to wrap. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you look at v5 that is not the same I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting split should split the word up (as in the other split true tests). I wondered about the word grapheme since this is really a Unicode character split but apparently there's different takes on what's considered a character vs. grapheme. I think the question here is what was broken in v5 that was considered "working" and what is actually a regression. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. splitByGrapheme is an option that was introduced for languages that do not use spaces to break text. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. regarding ' I think the question here is what was broken in v5 that was considered "working" and what is actually a regression.' i think nothing broken in v5 was considered working for styles. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -805,9 +805,10 @@ export abstract class ITextBehavior< | |||||
copiedStyle?: { [index: number]: TextStyleDeclaration } | ||||||
) { | ||||||
const newLineStyles: { [index: number]: TextStyleDeclaration } = {}; | ||||||
const isEndOfLine = | ||||||
this._unwrappedTextLines[lineIndex].length === charIndex; | ||||||
let somethingAdded = false; | ||||||
const originalLineLength = this._unwrappedTextLines[lineIndex].length; | ||||||
const isEndOfLine = originalLineLength === charIndex; | ||||||
|
||||||
let someStyleIsCarringOver = false; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean someStyleIsCarryingOver? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gloriousjob you can use the suggestion markdown
Suggested change
|
||||||
qty || (qty = 1); | ||||||
this.shiftLineStyles(lineIndex, qty); | ||||||
const currentCharStyle = this.styles[lineIndex] | ||||||
|
@@ -819,7 +820,7 @@ export abstract class ITextBehavior< | |||||
for (const index in this.styles[lineIndex]) { | ||||||
const numIndex = parseInt(index, 10); | ||||||
if (numIndex >= charIndex) { | ||||||
somethingAdded = true; | ||||||
someStyleIsCarringOver = true; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
newLineStyles[numIndex - charIndex] = this.styles[lineIndex][index]; | ||||||
// remove lines from the previous line since they're on a new line now | ||||||
if (!(isEndOfLine && charIndex === 0)) { | ||||||
|
@@ -828,14 +829,16 @@ export abstract class ITextBehavior< | |||||
} | ||||||
} | ||||||
let styleCarriedOver = false; | ||||||
if (somethingAdded && !isEndOfLine) { | ||||||
if (someStyleIsCarringOver && !isEndOfLine) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// if is end of line, the extra style we copied | ||||||
// is probably not something we want | ||||||
this.styles[lineIndex + qty] = newLineStyles; | ||||||
styleCarriedOver = true; | ||||||
} | ||||||
if (styleCarriedOver) { | ||||||
if (styleCarriedOver || originalLineLength > charIndex) { | ||||||
// skip the last line of since we already prepared it. | ||||||
// or contains text without style that we don't want to style | ||||||
// just becuase it changed line | ||||||
ShaMan123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
qty--; | ||||||
} | ||||||
// for the all the lines or all the other lines | ||||||
|
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.
I suggest usign
test.step
to organize the test instead of leaving commentsIt is more clear when reading and when looking at test results
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.
85800a532aaae57a102d53213c2b8114a0cadb8e.webm
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.
Checkout src files to master