Skip to content

Commit 06fea5a

Browse files
committed
Skip syntax highlight for REPL commands
1 parent fb63603 commit 06fea5a

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/module/repl.wren

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,17 @@ class AnsiRepl is Repl {
395395
System.write("\r> ")
396396
System.write(Color.none)
397397

398-
// Syntax highlight the line.
399-
for (token in lex(line, true)) {
400-
if (token.type == Token.eof) break
401-
402-
System.write(TOKEN_COLORS[token.type])
403-
System.write(token.text)
404-
System.write(Color.none)
398+
if (!Command.isCommand(line)) {
399+
// Syntax highlight the line.
400+
for (token in lex(line, true)) {
401+
if (token.type == Token.eof) break
402+
403+
System.write(TOKEN_COLORS[token.type])
404+
System.write(token.text)
405+
System.write(Color.none)
406+
}
407+
} else {
408+
System.write(line)
405409
}
406410

407411
if (showCompletion) {

src/module/repl.wren.inc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,17 @@ static const char* replModuleSource =
397397
" System.write(\"\r> \")\n"
398398
" System.write(Color.none)\n"
399399
"\n"
400-
" // Syntax highlight the line.\n"
401-
" for (token in lex(line, true)) {\n"
402-
" if (token.type == Token.eof) break\n"
403-
"\n"
404-
" System.write(TOKEN_COLORS[token.type])\n"
405-
" System.write(token.text)\n"
406-
" System.write(Color.none)\n"
400+
" if (!Command.isCommand(line)) {\n"
401+
" // Syntax highlight the line.\n"
402+
" for (token in lex(line, true)) {\n"
403+
" if (token.type == Token.eof) break\n"
404+
"\n"
405+
" System.write(TOKEN_COLORS[token.type])\n"
406+
" System.write(token.text)\n"
407+
" System.write(Color.none)\n"
408+
" }\n"
409+
" } else {\n"
410+
" System.write(line)\n"
407411
" }\n"
408412
"\n"
409413
" if (showCompletion) {\n"

0 commit comments

Comments
 (0)