This looks like an intentional piece of code introduced by dierk. Basically, the scriptRun command is sensitive to the selected text. If there is no selection, all of the text is run. If there is a selection, only the selectoin is run,
This amounts to a feature that is poorly documented and in it's current form is of questionalble usability.
My recommendation is to either (a) remove it or (b) make it explicit, add a Script->run and Script->run selected option (ctrl-R and ctrl-shift-R with ctrl-enter and ctrl-shift-enter as well, respectively).
Assigning to Dierk since he was the initiator of the changed code for his opinion.
class Person { String name } Person person = new Person() person.name = "Daniel" println person.nameIf I select code
class Person { String name } Person person = new Person() person.name = "Daniel"and ctrl + enter to execute it.
Groovy Console complains:
groovy> class Person { groovy> String name groovy> }
groovy> Person person = new Person()
groovy> person.name = "Dan
Exception thrown: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script9: 5: unexpected char: 0xFFFF @ line 5, column 19.
1 error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script9: 5: unexpected char: 0xFFFF @ line 5, column 19.
1 error
class Person { String name } Person person = new Person() person.name = "Daniel" println person.nameclass Person { String name } Person person = new Person() person.name = "Daniel"