Text Editor setInputRestrictions returnkey


#1

This is hardly a bug, but i was baffled by the fact some of my text editors were not getting a returnkeypressed callback.
It was because setInputRestrictions() did not contain "\n"
then i looked up in

[code]void TextEditor::insertTextAtCaret (const String& newText_)
{
String newText (newText_);

if (allowedCharacters.isNotEmpty())
    newText = newText.retainCharacters (allowedCharacters);

if ((! returnKeyStartsNewLine) && newText == "\n")
{
    returnPressed();
    return;
}[/code]

and realized the “\n” must be terminated before checking for return.


#2

Good call - thanks, I’ll make sure that works a bit more intuitively!