mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Apply Ui::Text::String modifications in highlighting.
This commit is contained in:
parent
f7ea0e1d00
commit
c530d7cc89
1 changed files with 21 additions and 15 deletions
|
@ -1673,21 +1673,27 @@ TextSelection Element::FindSelectionFromQuote(
|
||||||
}
|
}
|
||||||
offset = i + 1;
|
offset = i + 1;
|
||||||
}
|
}
|
||||||
//for (const auto &modification : text.modifications()) {
|
for (const auto &modification : text.modifications()) {
|
||||||
// if (modification.position >= selection.to) {
|
if (modification.position >= result.to) {
|
||||||
// break;
|
break;
|
||||||
// } else if (modification.position <= selection.from) {
|
}
|
||||||
// modified.from += modification.skipped;
|
if (modification.added) {
|
||||||
// if (modification.added
|
++result.to;
|
||||||
// && modification.position < selection.from) {
|
}
|
||||||
// --modified.from;
|
const auto shiftTo = std::min(
|
||||||
// }
|
int(modification.skipped),
|
||||||
// }
|
result.to - modification.position);
|
||||||
// modified.to += modification.skipped;
|
result.to -= shiftTo;
|
||||||
// if (modification.added && modified.to > modified.from) {
|
if (modification.position <= result.from) {
|
||||||
// --modified.to;
|
if (modification.added) {
|
||||||
// }
|
++result.from;
|
||||||
//}
|
}
|
||||||
|
const auto shiftFrom = std::min(
|
||||||
|
int(modification.skipped),
|
||||||
|
result.from - modification.position);
|
||||||
|
result.from -= shiftFrom;
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue