| 38 | } |
| 39 | |
| 40 | void CtrlrTextEditor::insertAttributedText (const AttributedString &text) |
| 41 | { |
| 42 | if (!getText().endsWithChar('\n')) |
| 43 | { |
| 44 | setCaretPosition (getText().length()); |
| 45 | insertTextAtCaret ("\n"); |
| 46 | } |
| 47 | |
| 48 | Range<int> lastRange, currentRange; |
| 49 | |
| 50 | currentRange = text.getAttribute(0).range; |
| 51 | |
| 52 | for (int i=0; i<text.getNumAttributes(); i++) |
| 53 | { |
| 54 | const AttributedString::Attribute a = text.getAttribute(i); |
| 55 | |
| 56 | if (currentRange != a.range) |
| 57 | { |
| 58 | insertTextAtCaret (text.getText().substring (currentRange.getStart(), currentRange.getEnd())); |
| 59 | } |
| 60 | |
| 61 | currentRange = a.range; |
| 62 | |
| 63 | setFont (a.font); |
| 64 | setColour (TextEditor::textColourId, a.colour); |
| 65 | } |
| 66 | |
| 67 | insertTextAtCaret (text.getText().substring (currentRange.getStart(), currentRange.getEnd())); |
| 68 | } |
| 69 | |
| 70 | const String CtrlrTextEditor::getLineAtPosition(const int index) |
| 71 | { |
no test coverage detected