I'm building my own application that has a JavaScript backend for user scripting, and am implementing something similar to Chrome's JavaScript console.
One thing that's puzzling me is the logic that Chrome uses to decide when the return key triggers the command to be executed, and when it auto continues to a new line.
For example if you type
function blah() { <return>
then it continues on to the next line to allow you to continue typing the function, whereas
function blah() {] <return>
immediately gives a parse error (so it's not as simple as just keeping count of open bracket pairs)
Does anyone have any hits (or is anyone familiar enough with the Chromium source who's able to point me to that particular logic in their codebase)