Skip to content

Commit

Permalink
Bug fix for copying text with new lines (singerdmx#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtallenca authored and renntbenrennt committed Mar 17, 2022
1 parent 72b8cd8 commit 7489ac4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/models/documents/nodes/line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,16 @@ class Line extends Container<Leaf?> {
total.add(text.substring(text.length - firstNodeLen));
}

var middleNodesLen = 0;
for (var i = 1; i < res.length - 1; i++) {
if (res[i].item2 != Embed.kObjectReplacementCharacter) {
middleNodesLen += res[i].item1;
total.add(res[i].item2);
}
}

// Adjust last node
final lastNodeLen = len - res[res.length - 1].item1;
final lastNodeLen = len - middleNodesLen - res[res.length - 1].item1;
text = res[res.length - 1].item2;
if (text != Embed.kObjectReplacementCharacter) {
total.add(text.substring(0, lastNodeLen));
Expand Down

0 comments on commit 7489ac4

Please sign in to comment.