-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 15 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
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.
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.
where is this clip in the documentation? i looked for something like this.
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.
oh ok is an entirely different way to do visual comparison. the locator can't be clipped.
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.
but the image can, right?