浏览代码

Handle Back Delete.

/main
Yuncong Zhang 5 年前
当前提交
f72fe6d4
共有 1 个文件被更改,包括 14 次插入5 次删除
  1. 19
      Runtime/rendering/editable.cs

19
Runtime/rendering/editable.cs


void _handleDelete() {
var selection = this.selection;
if (selection.textAfter(this.text.text).isNotEmpty()) {
this.textSelectionDelegate.textEditingValue = new TextEditingValue(
text: selection.textBefore(this.text.text)
+ selection.textAfter(this.text.text).Substring(1),
selection: TextSelection.collapsed(offset: selection.start)
);
if (char.IsLowSurrogate(this.text.text[selection.end])) {
this.textSelectionDelegate.textEditingValue = new TextEditingValue(
text: selection.textBefore(this.text.text)
+ selection.textAfter(this.text.text).Substring(2),
selection: TextSelection.collapsed(offset: selection.start)
);
}
else {
this.textSelectionDelegate.textEditingValue = new TextEditingValue(
text: selection.textBefore(this.text.text)
+ selection.textAfter(this.text.text).Substring(1),
selection: TextSelection.collapsed(offset: selection.start)
);
}
}
else {
this.textSelectionDelegate.textEditingValue = new TextEditingValue(

正在加载...
取消
保存