浏览代码

add protection for textediting composition

/main
xingwei.zhu 5 年前
当前提交
1e1427be
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3
      Runtime/service/text_input.cs

3
Runtime/service/text_input.cs


D.assert(!string.IsNullOrEmpty(composeText));
var composeStart = this.composing == TextRange.empty ? this.selection.start : this.composing.start;
var lastComposeEnd = this.composing == TextRange.empty ? this.selection.end : this.composing.end;
composeStart = Mathf.Clamp(composeStart, 0, this.text.Length);
lastComposeEnd = Mathf.Clamp(lastComposeEnd, 0, this.text.Length);
var newText = this.text.Substring(0, composeStart) + composeText + this.text.Substring(lastComposeEnd);
var componseEnd = composeStart + composeText.Length;
return new TextEditingValue(

正在加载...
取消
保存