| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import '../widgets/wrappers.dart'; | 7 import '../widgets/wrappers.dart'; |
| 8 import 'editable_string.dart'; | 8 import 'editable_string.dart'; |
| 9 | 9 |
| 10 class EditableText extends Component { | 10 class EditableText extends Component { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 else if (!focused && _cursorTimer != null) | 64 else if (!focused && _cursorTimer != null) |
| 65 _stopCursorTimer(); | 65 _stopCursorTimer(); |
| 66 | 66 |
| 67 //List<UINode> children = new List<UINode>(); | 67 //List<UINode> children = new List<UINode>(); |
| 68 String hack = ""; | 68 String hack = ""; |
| 69 | 69 |
| 70 if (!value.composing.isValid) { | 70 if (!value.composing.isValid) { |
| 71 // children.add(new TextFragment(value.text)); | 71 // children.add(new TextFragment(value.text)); |
| 72 hack += value.text; | 72 hack += value.text; |
| 73 } else { | 73 } else { |
| 74 String beforeComposing = value.textBefore(value.composing); | 74 hack += value.textBefore(value.composing); |
| 75 if (!beforeComposing.isEmpty) { | 75 hack += value.textInside(value.composing); |
| 76 // children.add(new TextFragment(beforeComposing)); | 76 hack += value.textAfter(value.composing); |
| 77 hack += value.beforeComposing; | |
| 78 } | |
| 79 | |
| 80 String composing = value.textInside(value.composing); | |
| 81 hack += value.composing; | |
| 82 hack += value.afterComposing; | |
| 83 // if (!composing.isEmpty) { | 77 // if (!composing.isEmpty) { |
| 84 // children.add(new TextFragment( | 78 // children.add(new TextFragment( |
| 85 // composing, | 79 // composing, |
| 86 // key: 'composing', | 80 // key: 'composing', |
| 87 // style: _composingStyle | 81 // style: _composingStyle |
| 88 // )); | 82 // )); |
| 89 // } | 83 // } |
| 90 | 84 |
| 91 // String afterComposing = value.textAfter(value.composing); | 85 // String afterComposing = value.textAfter(value.composing); |
| 92 // if (!afterComposing.isEmpty) | 86 // if (!afterComposing.isEmpty) |
| 93 // children.add(new TextFragment(afterComposing)); | 87 // children.add(new TextFragment(afterComposing)); |
| 94 } | 88 } |
| 95 | 89 |
| 96 // if (_showCursor) | 90 // if (_showCursor) |
| 97 // children.add(new Container( | 91 // children.add(new Container( |
| 98 // key: 'cursor', | 92 // key: 'cursor', |
| 99 // // style: _cursorStyle | 93 // // style: _cursorStyle |
| 100 // )); | 94 // )); |
| 101 | 95 |
| 102 return new Paragraph( | 96 return new Paragraph( |
| 103 text: hack | 97 text: hack |
| 104 ); | 98 ); |
| 105 } | 99 } |
| 106 } | 100 } |
| OLD | NEW |