Skip to content

Commit 86bfb12

Browse files
committed
[SQLLINE-417] Update jline to 3.18.0, add geshi color scheme
1 parent edc3aab commit 86bfb12

File tree

7 files changed

+31
-19
lines changed

7 files changed

+31
-19
lines changed

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<top.dir>${project.basedir}</top.dir>
2626

2727
<!-- The following list is sorted. -->
28-
<checkstyle.version>8.36.2</checkstyle.version>
28+
<checkstyle.version>8.37</checkstyle.version>
2929
<docbkx-maven-plugin.version>2.0.17</docbkx-maven-plugin.version>
3030
<forbiddenapis.version>3.1</forbiddenapis.version>
3131
<h2.version>1.4.200</h2.version>
3232
<hamcrest.version>2.2</hamcrest.version>
3333
<hsqldb.version>2.5.0</hsqldb.version>
34-
<jline.version>3.16.0</jline.version>
34+
<jline.version>3.18.0</jline.version>
3535
<jmockit.version>1.49</jmockit.version>
3636
<junit.version>5.7.0</junit.version>
3737
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>

src/docbkx/manual.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3245,9 +3245,9 @@ java.sql.SQLException: ORA-00942: table or view does not exist
32453245
<title>colorscheme</title>
32463246
<para>
32473247
If <literal>chester</literal>/<literal>dark</literal>
3248-
/<literal>dracula</literal>/<literal>light</literal>
3249-
/<literal>obsidian</literal>/<literal>solarized</literal>
3250-
/<literal>vs2010</literal>,
3248+
/<literal>dracula</literal>/<literal>geshi</literal>
3249+
/<literal>light</literal>/<literal>obsidian</literal>
3250+
/<literal>solarized</literal>/<literal>vs2010</literal>,
32513251
then this scheme will be used for command/sql syntax highlighting.
32523252
If <literal>default</literal> then there is no syntax highlighting.
32533253
</para>

src/main/java/sqlline/BuiltInHighlightStyle.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
* <a href="https://github.com/ozmoroz/ozbsidian-sqldeveloper">
3434
* ozmoroz's OzBsidian colour scheme for Oracle SQL Developer</a>.
3535
*
36+
* <p>Similarly, the {@link #GESHI} style is inspired by
37+
* <a href="https://github.com/GeSHi/geshi-1.0/blob/master/src/geshi/sql.php">
38+
* GeSHi - Generic Syntax Highlighter for sql</a>
39+
*
3640
* @see HighlightStyle
3741
*/
3842
enum BuiltInHighlightStyle {
@@ -42,7 +46,14 @@ enum BuiltInHighlightStyle {
4246
DRACULA(BOLD_MAGENTA, BOLD_WHITE, GREEN, RED, ITALIC_CYAN, YELLOW, WHITE),
4347
SOLARIZED(BOLD_YELLOW, BOLD_BLUE, GREEN, RED, ITALIC_BRIGHT, CYAN, BLUE),
4448
VS2010(BOLD_BLUE, BOLD_WHITE, RED, MAGENTA, ITALIC_GREEN, BRIGHT, WHITE),
45-
OBSIDIAN(BOLD_GREEN, BOLD_WHITE, RED, MAGENTA, ITALIC_BRIGHT, YELLOW, WHITE);
49+
OBSIDIAN(BOLD_GREEN, BOLD_WHITE, RED, MAGENTA, ITALIC_BRIGHT, YELLOW, WHITE),
50+
GESHI(AttributedStyle.BOLD.foreground(99, 33, 33),
51+
BOLD_WHITE,
52+
AttributedStyle.DEFAULT.foreground(0x66, 0xCC, 0x66),
53+
AttributedStyle.DEFAULT.foreground(0x0, 0x0, 0x99),
54+
AttributedStyle.DEFAULT.italic().foreground(0x80, 0x80, 0x80),
55+
AttributedStyle.DEFAULT.foreground(0xCC, 0x66, 0xCC),
56+
WHITE);
4657

4758
final HighlightStyle style;
4859

src/main/java/sqlline/SqlLine.java

+1
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ public LineReader getConsoleReader(InputStream inputStream,
658658
.variable(LineReader.LINE_OFFSET, 1) // start line numbers with 1
659659
.option(LineReader.Option.AUTO_LIST, false)
660660
.option(LineReader.Option.AUTO_MENU, true)
661+
.option(LineReader.Option.GROUP_PERSIST, true)
661662
.option(LineReader.Option.DISABLE_EVENT_EXPANSION, true);
662663
final LineReader lineReader;
663664
if (inputStream == null) {

src/main/resources/sqlline/SqlLine.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ variables:\
9797
\n max height/width based on terminal size\
9898
\nautoSave true/false Automatically save preferences\
9999
\ncolor true/false Control whether color is used for display\
100-
\ncolorScheme chester/dark/dracula/light/obsidian/solarized/vs2010\
100+
\ncolorScheme chester/dark/dracula/geshi/light/obsidian/solarized/vs2010\
101101
\n Syntax highlight schema\
102102
\nconfirm true/false Whether to prompt for confirmation before running\
103103
\n commands specified in confirmPattern (default:\
@@ -325,7 +325,7 @@ cmd-usage: Usage: java sqlline.SqlLine \n \
325325
\ -ac <class name> application configuration class name\n \
326326
\ -ph <class name> prompt handler class name\n \
327327
\ --color=[true/false] control whether color is used for display\n \
328-
\ --colorScheme=[chester/dark/dracula/light/obsidian/solarized/vs2010]\
328+
\ --colorScheme=[chester/dark/dracula/geshi/light/obsidian/solarized/vs2010]\
329329
\ syntax highlight schema\n \
330330
\ --confirm=[true/false] confirm before executing commands specified in confirmPattern\n \
331331
\ --confirmPattern=[pattern] pattern of commands to prompt confirmation\n \

src/main/resources/sqlline/manual.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ Variable Value Description
11791179
autoCommit true/false Enable/disable automatic transaction commit
11801180
autoSave true/false Automatically save preferences
11811181
color true/false Control whether color is used for display
1182-
colorScheme chester/dark/dracula/light/obsidian/solarized/vs2010
1182+
colorScheme chester/dark/dracula/geshi/light/obsidian/solarized/vs2010
11831183
Syntax highlight schema
11841184
confirm true/false Prompts for confirmation before running
11851185
commands specified in confirmPattern
@@ -2295,7 +2295,7 @@ If true, then output to the terminal will use color for a more pleasing visual e
22952295

22962296
colorScheme
22972297

2298-
If chester/dark/dracula/light/obsidian/solarized/vs2010, then this scheme will be used for command/sql syntax highlighting. If default then there is no syntax highlighting.
2298+
If chester/dark/dracula/geshi/light/obsidian/solarized/vs2010, then this scheme will be used for command/sql syntax highlighting. If default then there is no syntax highlighting.
22992299

23002300
confirm
23012301

src/test/java/sqlline/SqlLineHighlighterTest.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -773,13 +773,13 @@ private void checkHighlightedLine(
773773
final AttributedString attributedString =
774774
highlighter.highlight(sqlLine.getLineReader(), line);
775775
final HighlightStyle highlightStyle = sqlLine.getHighlightStyle();
776-
int commandStyle = highlightStyle.getCommandStyle().getStyle();
777-
int keywordStyle = highlightStyle.getKeywordStyle().getStyle();
778-
int singleQuoteStyle = highlightStyle.getQuotedStyle().getStyle();
779-
int identifierStyle = highlightStyle.getIdentifierStyle().getStyle();
780-
int commentStyle = highlightStyle.getCommentStyle().getStyle();
781-
int numberStyle = highlightStyle.getNumberStyle().getStyle();
782-
int defaultStyle = highlightStyle.getDefaultStyle().getStyle();
776+
long commandStyle = highlightStyle.getCommandStyle().getStyle();
777+
long keywordStyle = highlightStyle.getKeywordStyle().getStyle();
778+
long singleQuoteStyle = highlightStyle.getQuotedStyle().getStyle();
779+
long identifierStyle = highlightStyle.getIdentifierStyle().getStyle();
780+
long commentStyle = highlightStyle.getCommentStyle().getStyle();
781+
long numberStyle = highlightStyle.getNumberStyle().getStyle();
782+
long defaultStyle = highlightStyle.getDefaultStyle().getStyle();
783783

784784
for (int i = 0; i < line.length(); i++) {
785785
checkSymbolStyle(line, i, expectedHighlightStyle.commands,
@@ -811,7 +811,7 @@ private void checkDefaultLine(
811811
SqlLineHighlighter defaultHighlighter) {
812812
final AttributedString attributedString =
813813
defaultHighlighter.highlight(sqlLine.getLineReader(), line);
814-
int defaultStyle = AttributedStyle.DEFAULT.getStyle();
814+
long defaultStyle = AttributedStyle.DEFAULT.getStyle();
815815

816816
for (int i = 0; i < line.length(); i++) {
817817
if (Character.isWhitespace(line.charAt(i))) {
@@ -850,7 +850,7 @@ private void checkSymbolStyle(
850850
int i,
851851
BitSet styleBitSet,
852852
AttributedString highlightedLine,
853-
int style,
853+
long style,
854854
String styleName) {
855855
if (styleBitSet.get(i)) {
856856
assertEquals(i == 0 ? style + 32 : style,

0 commit comments

Comments
 (0)