Skip to content

Commit

Permalink
adjust hash-comment syntax rule
Browse files Browse the repository at this point in the history
  • Loading branch information
adsr committed Dec 14, 2024
1 parent 4fece7d commit b76e78a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ static void _editor_init_syntaxes(editor_t *editor) {
{ "`([^`\\\\]|\\\\.)*`", NULL, TB_YELLOW | TB_BOLD, TB_DEFAULT },
{ "/\\*", "\\*/", TB_CYAN, TB_DEFAULT },
{ "//.*$", NULL, TB_CYAN, TB_DEFAULT },
{ "(?<=(\\s|^))#\\s.*$", NULL, TB_CYAN, TB_DEFAULT },
{ "(?<=(\\s|^))#(\\s.*)?$", NULL, TB_CYAN, TB_DEFAULT },
{ "^#!/.*$", NULL, TB_CYAN, TB_DEFAULT },
{ "[(){}<>\\[\\].,;:?!+=/\\\\%^*-]", NULL, TB_RED | TB_BOLD, TB_DEFAULT },
{ "(?<!\\w)[\\%@$][a-zA-Z_$][a-zA-Z0-9_]*\\b", NULL, TB_GREEN, TB_DEFAULT },
Expand Down
5 changes: 4 additions & 1 deletion tests/func/test_syntax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,21 @@ source 'test.sh'

cat >$tmpf <<"EOD"
# ccc
#
aaa "bbb" // ccc "ccc"
aaa "bbb" # ccc "ccc"
EOD
extra_opts=(-yy $tmpf)
macro=''
declare -A expected
declare -A not_expected
# a==97 b==98 c==99
# a==97 b==98 c==99 #=35
expected[style_a]='<ch=97 fg=0\b'
expected[style_b]='<ch=98 fg=260\b'
expected[style_c]='<ch=99 fg=7\b'
expected[style_h]='<ch=35 fg=7\b'
not_expected[style_not_a]='<ch=97 fg=(260|7)\b'
not_expected[style_not_b]='<ch=98 fg=(0|7)\b'
not_expected[style_not_c]='<ch=99 fg=(0|260)\b'
not_expected[style_not_h]='<ch=35 fg=(0|260)\b'
source 'test.sh'

0 comments on commit b76e78a

Please sign in to comment.