Missing line in juce_TextEditor.cpp


#1

Jules,

Sorry if you’ve fixed this, but I’m not up to installing/learning yet another RCS so I can check out the bleeding-edge sources. I just want to use the (very nice, thank you) library and understand the stable code.

In version 1.51, TextEditor::keyPressed contains this code at line 2007:

else if (key == KeyPress::returnKey)
{
    newTransaction();
    insertTextAtCaret ("\n");
}

It should be this:

else if (key == KeyPress::returnKey)
{
    newTransaction();
    insertTextAtCaret ("\n");

returnPressed() ; // JRR
}

Jack


#2

Hi Jack

Well, no, I think you’ve got the wrong end of the stick there… The returnKeyPressed call happens inside the insertTextAtCaret() method, but only if you’ve called setReturnKeyStartsNewLine (false) - maybe you just need to do that?


#3

OK, I missed that in the class documentation. But even if I’d seen it I wouldn’t have thought it necessary to call the method to make it work that way.

According to the documentation for setReturnKeyStartsNewLine(), the flag is false by default. This is from the online version of the docs:

And my TextEditor is single-line to boot.

So, does that mean the flag is actually true by default?

Jack


#4

Well, it’s definitely false by default - just look inside the TextEditor.cpp file. I assumed you must have been setting it to true somewhere, as there’s no other reason it would fail to make the callback.

(Maybe you’ve generated this with the jucer and it’s adding code that sets the flag to true…?)