This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push: new ae88e93b57 GROOVY-8162: Update Groovysh to JLine3 (tweak highlighting) ae88e93b57 is described below commit ae88e93b57bebfa9e6f6461940faf5297f023972 Author: Paul King <pa...@asert.com.au> AuthorDate: Sat Jul 26 16:13:27 2025 +1000 GROOVY-8162: Update Groovysh to JLine3 (tweak highlighting) --- .../groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy | 4 ++-- subprojects/groovy-groovysh/src/main/resources/nanorc/args.nanorc | 2 +- subprojects/groovy-groovysh/src/main/resources/nanorc/command.nanorc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy index 3112107d49..35b1a953b9 100644 --- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy +++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyCommands.groovy @@ -353,8 +353,8 @@ class GroovyCommands extends JlineCommandRegistry implements CommandRegistry { println "${merge ? 'Merged' : 'Loaded'}: " + file.path } - private highlight(Collection<String> lines) { - highlighter.highlight(lines.collect{ ' \b' + it }.join('\n\n')).toAnsi() + private String highlight(Collection<String> lines) { + highlighter.highlight(lines.join('\n\n')).toAnsi().readLines().collect{' \b' + it }.join('\n') } private boolean maybePrintHelp(CommandInput input, String name) { diff --git a/subprojects/groovy-groovysh/src/main/resources/nanorc/args.nanorc b/subprojects/groovy-groovysh/src/main/resources/nanorc/args.nanorc index 7ea3f97347..d6267769fe 100644 --- a/subprojects/groovy-groovysh/src/main/resources/nanorc/args.nanorc +++ b/subprojects/groovy-groovysh/src/main/resources/nanorc/args.nanorc @@ -17,7 +17,7 @@ syntax "ARGS" NUMBER: "\<[-]?[0-9]*([Ee][+-]?[0-9]+)?\>" "\<[-]?[0](\.[0-9]+)?\>" STRING: "[a-zA-Z]+[a-zA-Z0-9]*" -COMMAND: "\</?(console|grab|inspect|classloader)\>" +COMMAND: "\</?(alias|classloader|clear|colors|console|del|doc|echo|exit|grab|help|highlighter|history|imports|inspect|keymap|less|load|methods|nano|pipe|prnt|reset|save|setopt|show|slurp|ttop|types|unalias|unsetopt|vars|widget)\>" NULL: "\<null\>" BOOLEAN: "\<(true|false)\>" VARIABLE: "(\[|,)\s*[a-zA-Z0-9]*\s*:" diff --git a/subprojects/groovy-groovysh/src/main/resources/nanorc/command.nanorc b/subprojects/groovy-groovysh/src/main/resources/nanorc/command.nanorc index dd9555dac3..a7bb9c181b 100644 --- a/subprojects/groovy-groovysh/src/main/resources/nanorc/command.nanorc +++ b/subprojects/groovy-groovysh/src/main/resources/nanorc/command.nanorc @@ -15,7 +15,7 @@ syntax "COMMAND" -COMMAND: "/?[a-zA-Z]+[a-zA-Z0-9]*" +COMMAND: "/?[a-zA-Z][a-zA-Z0-9]*" VARIABLE: ".*=" PLAIN: "(\"|'|\.|=|:|\[|,|\])" COMMENT: "(^|\\s+)#.*$"