### Eclipse Workspace Patch 1.0
#P org.sophie2.main.func.text
|
|
|
7 | 7 | import org.sophie2.base.model.text.mvc.SelectionInfo; |
8 | 8 | import org.sophie2.base.model.text.mvc.TextModel; |
9 | 9 | import org.sophie2.base.model.text.mvc.TextView; |
| 10 | import org.sophie2.base.model.text.style.HotStyleDef; |
10 | 11 | import org.sophie2.core.mvc.LogicR3; |
11 | 12 | import org.sophie2.main.app.commons.page.PageWorkArea; |
12 | 13 | import org.sophie2.main.func.text.view.TextFrameView; |
… |
… |
|
99 | 100 | SelectionInfo caretInfo = flow.getSelectionInfo(); |
100 | 101 | int caretPos = caretInfo.getCaret(); |
101 | 102 | int markPos = caretInfo.getMarkIndex(); |
| 103 | ImmText text = flow.getRawText(); |
102 | 104 | if (caretPos == markPos) { |
103 | | return flow.inputStyle().get().getValue(attribute); |
| 105 | HotStyleDef style = HotStyleDef.getEmpty(); |
| 106 | if (caretPos > text.getBegin()) { |
| 107 | style = text.unitAt(caretPos - 1).getStyle(); |
| 108 | } |
| 109 | style = style.derive(flow.inputStyle().get()); |
| 110 | return style.getValue(attribute); |
104 | 111 | } |
105 | | ImmText text = flow.getRawText(); |
106 | 112 | |
107 | 113 | assert caretPos <= text.getEnd() : |
108 | 114 | "Inconsistent caret position: " + caretPos + " " + text.getEnd(); |