mirror of
https://github.com/wgh136/flutter_qjs.git
synced 2025-09-27 13:27:24 +00:00
update doc
This commit is contained in:
@@ -72,7 +72,8 @@ class CodeInputController extends TextEditingController {
|
||||
InlineSpan leftSpan;
|
||||
oldSpan.children?.indexWhere((element) {
|
||||
String elementText = element.toPlainText();
|
||||
if (start + elementText.length > splitAt || !newText.startsWith(elementText, start)) {
|
||||
if (start + elementText.length > splitAt ||
|
||||
!newText.startsWith(elementText, start)) {
|
||||
leftSpan = element;
|
||||
return true;
|
||||
}
|
||||
@@ -86,7 +87,9 @@ class CodeInputController extends TextEditingController {
|
||||
oldSpan.children?.sublist(beforeSpans.length)?.lastIndexWhere((element) {
|
||||
String elementText = element.toPlainText();
|
||||
if (splitAt + end + elementText.length >= newText.length ||
|
||||
!newText.substring(start, newText.length - end).endsWith(elementText)) {
|
||||
!newText
|
||||
.substring(start, newText.length - end)
|
||||
.endsWith(elementText)) {
|
||||
rightSpan = element;
|
||||
return true;
|
||||
}
|
||||
@@ -98,7 +101,9 @@ class CodeInputController extends TextEditingController {
|
||||
return TextSpan(style: style, children: [
|
||||
...beforeSpans,
|
||||
TextSpan(
|
||||
style: leftSpan != null && leftSpan == rightSpan ? leftSpan.style : style,
|
||||
style: leftSpan != null && leftSpan == rightSpan
|
||||
? leftSpan.style
|
||||
: style,
|
||||
text: newText.substring(start, max(start, newText.length - end))),
|
||||
...endSpans.reversed
|
||||
]);
|
||||
|
Reference in New Issue
Block a user