mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-19 01:04:20 +00:00
This commit is contained in:
parent
012f4f38bd
commit
7c42389287
1 changed files with 9 additions and 14 deletions
|
|
@ -217,6 +217,7 @@ public:
|
|||
const String getAllText() const throw()
|
||||
{
|
||||
String s;
|
||||
s.preallocateStorage (getTotalLength());
|
||||
|
||||
for (int i = 0; i < atoms.size(); ++i)
|
||||
s += getAtom(i)->atomText;
|
||||
|
|
@ -294,8 +295,7 @@ private:
|
|||
|
||||
while (i < len)
|
||||
{
|
||||
const int start = i;
|
||||
int end = i;
|
||||
int start = i;
|
||||
|
||||
// create a whitespace atom unless it starts with non-ws
|
||||
if (CharacterFunctions::isWhitespace (text[i])
|
||||
|
|
@ -309,41 +309,34 @@ private:
|
|||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
end = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text[i] == T('\r'))
|
||||
{
|
||||
++i;
|
||||
end = i;
|
||||
|
||||
if ((i < len) && (text[i] == T('\n')))
|
||||
{
|
||||
++start;
|
||||
++i;
|
||||
|
||||
}
|
||||
}
|
||||
else if (text[i] == T('\n'))
|
||||
{
|
||||
++i;
|
||||
end = i;
|
||||
|
||||
if ((i < len) && (text[i] == T('\r')))
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((i < len) && ! CharacterFunctions::isWhitespace (text[i]))
|
||||
++i;
|
||||
|
||||
end = i;
|
||||
}
|
||||
}
|
||||
|
||||
TextAtom* const atom = new TextAtom();
|
||||
atom->atomText = textToParse.substring (start, end);
|
||||
atom->atomText = textToParse.substring (start, i);
|
||||
atom->width = font.getStringWidthFloat (atom->getText (passwordCharacter));
|
||||
atom->numChars = (uint16) (end - start);
|
||||
atom->numChars = (uint16) (i - start);
|
||||
|
||||
atoms.add (atom);
|
||||
}
|
||||
|
|
@ -1483,6 +1476,8 @@ void TextEditor::insertTextAtCursor (String newText)
|
|||
|
||||
if (! isMultiLine())
|
||||
newText = newText.replaceCharacters (T("\r\n"), T(" "));
|
||||
else
|
||||
newText = newText.replace (T("\r\n"), T("\n"));
|
||||
|
||||
const int newCaretPos = selectionStart + newText.length();
|
||||
const int insertIndex = selectionStart;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue