diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp index 19abd3ff27..526cac1a9b 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.cpp +++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp @@ -525,15 +525,17 @@ namespace TextLayoutHelpers } } - if ((i > 0 && newFontAndColour != lastFontAndColour) || i == stringLength - 1) + if (i > 0 && newFontAndColour != lastFontAndColour) { - runAttributes.add (RunAttribute (lastFontAndColour, - Range (rangeStart, (i < stringLength - 1) ? i : (i + 1)))); + runAttributes.add (RunAttribute (lastFontAndColour, Range (rangeStart, i))); rangeStart = i; } lastFontAndColour = newFontAndColour; } + + if (rangeStart < stringLength) + runAttributes.add (RunAttribute (lastFontAndColour, Range (rangeStart, stringLength))); } for (int i = 0; i < runAttributes.size(); ++i) diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp index e751d515bf..571957eef5 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp @@ -91,8 +91,6 @@ public: const float rightClip, const float x, const int y, const int lineH, const float characterWidth) const { - Colour lastColour (0x00000001); - AttributedString as; as.setJustification (Justification::centredLeft);