Skip to content

Commit dc1e905

Browse files
committed
highlight # ... as comment at end of line in syn_generic
1 parent b85098f commit dc1e905

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

editor.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2180,7 +2180,7 @@ static void _editor_init_syntaxes(editor_t *editor) {
21802180
{ "`([^`\\\\]|\\\\.)*`", NULL, TB_YELLOW | TB_BOLD, TB_DEFAULT },
21812181
{ "/\\*", "\\*/", TB_CYAN, TB_DEFAULT },
21822182
{ "//.*$", NULL, TB_CYAN, TB_DEFAULT },
2183-
{ "^\\s*#( .*|)$", NULL, TB_CYAN, TB_DEFAULT },
2183+
{ "(?<=\\s)#\\s.*$", NULL, TB_CYAN, TB_DEFAULT },
21842184
{ "^#!/.*$", NULL, TB_CYAN, TB_DEFAULT },
21852185
{ "[(){}<>\\[\\].,;:?!+=/\\\\%^*-]", NULL, TB_RED | TB_BOLD, TB_DEFAULT },
21862186
{ "(?<!\\w)[\\%@$][a-zA-Z_$][a-zA-Z0-9_]*\\b", NULL, TB_GREEN, TB_DEFAULT },

tests/func/test_syntax.sh

+17
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,20 @@ expected[style_sc_b]='<ch=98 fg=7\b'
7373
not_expected[style_sc_not_a]='<ch=97 fg=(0|7)\b'
7474
not_expected[style_sc_not_b]='<ch=98 fg=(0|260)\b'
7575
source 'test.sh'
76+
77+
cat >$tmpf <<"EOD"
78+
aaa "bbb" // ccc "ccc"
79+
aaa "bbb" # ccc "ccc"
80+
EOD
81+
extra_opts=(-yy $tmpf)
82+
macro=''
83+
declare -A expected
84+
declare -A not_expected
85+
# a==97 b==98 c==99
86+
expected[style_a]='<ch=97 fg=0\b'
87+
expected[style_b]='<ch=98 fg=260\b'
88+
expected[style_c]='<ch=99 fg=7\b'
89+
not_expected[style_not_a]='<ch=97 fg=(260|7)\b'
90+
not_expected[style_not_b]='<ch=98 fg=(0|7)\b'
91+
not_expected[style_not_c]='<ch=99 fg=(0|260)\b'
92+
source 'test.sh'

0 commit comments

Comments
 (0)