| @@ -39,19 +39,20 @@ struct TextAtom | |||||
| { | { | ||||
| if (passwordCharacter == 0) | if (passwordCharacter == 0) | ||||
| return atomText; | return atomText; | ||||
| else | |||||
| return String::repeatedString (String::charToString (passwordCharacter), | |||||
| atomText.length()); | |||||
| return String::repeatedString (String::charToString (passwordCharacter), | |||||
| atomText.length()); | |||||
| } | } | ||||
| String getTrimmedText (const juce_wchar passwordCharacter) const | String getTrimmedText (const juce_wchar passwordCharacter) const | ||||
| { | { | ||||
| if (passwordCharacter == 0) | if (passwordCharacter == 0) | ||||
| return atomText.substring (0, numChars); | return atomText.substring (0, numChars); | ||||
| else if (isNewLine()) | |||||
| if (isNewLine()) | |||||
| return String::empty; | return String::empty; | ||||
| else | |||||
| return String::repeatedString (String::charToString (passwordCharacter), numChars); | |||||
| return String::repeatedString (String::charToString (passwordCharacter), numChars); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -647,10 +648,15 @@ public: | |||||
| atom->getText (passwordCharacter), | atom->getText (passwordCharacter), | ||||
| atomX, 0.0f); | atomX, 0.0f); | ||||
| const int numGlyphs = g.getNumGlyphs(); | |||||
| int j; | int j; | ||||
| for (j = 0; j < g.getNumGlyphs(); ++j) | |||||
| if ((g.getGlyph(j).getLeft() + g.getGlyph(j).getRight()) / 2 > xToFind) | |||||
| for (j = 0; j < numGlyphs; ++j) | |||||
| { | |||||
| const PositionedGlyph& pg = g.getGlyph(j); | |||||
| if ((pg.getLeft() + pg.getRight()) / 2 > xToFind) | |||||
| break; | break; | ||||
| } | |||||
| return indexInText + j; | return indexInText + j; | ||||
| } | } | ||||
| @@ -1384,9 +1390,11 @@ Rectangle<int> TextEditor::getCaretRectangle() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| enum { rightEdgeSpace = 2 }; | |||||
| float TextEditor::getWordWrapWidth() const | float TextEditor::getWordWrapWidth() const | ||||
| { | { | ||||
| return wordWrap ? (float) (viewport->getMaximumVisibleWidth() - leftIndent - leftIndent / 2) | |||||
| return wordWrap ? (float) (viewport->getMaximumVisibleWidth() - (leftIndent + rightEdgeSpace + 1)) | |||||
| : std::numeric_limits<float>::max(); | : std::numeric_limits<float>::max(); | ||||
| } | } | ||||
| @@ -1407,7 +1415,7 @@ void TextEditor::updateTextHolderSize() | |||||
| const int h = topIndent + roundToInt (jmax (i.lineY + i.lineHeight, | const int h = topIndent + roundToInt (jmax (i.lineY + i.lineHeight, | ||||
| currentFont.getHeight())); | currentFont.getHeight())); | ||||
| textHolder->setSize (w + 2, h + 1); // (the +2 allows a bit of space for the cursor to be at the right-hand-edge) | |||||
| textHolder->setSize (w + rightEdgeSpace, h + 1); // (allows a bit of space for the cursor to be at the right-hand-edge) | |||||
| } | } | ||||
| } | } | ||||