editorconfig / editorconfig-vim

EditorConfig plugin for Vim
http://editorconfig.org
Other
3.14k stars 139 forks source link

Can not detect brace when 2 are following #205

Closed ArnaudD-FR closed 1 year ago

ArnaudD-FR commented 1 year ago

Simple .editorconfig example:

[*.{h,h{xx,++,h,pp},c,c{xx,++,c}}]
indent_style = tab
indent_size = 8

From the final }}, only one right brace is detected instead of two:

Header? <[*.{h,h{xx,++,h,pp},c,c{xx,++,c,pp}}]>
- ini#matches_filename: checking </home/arnaud/dev/uwb-stack/mac/fira_session_fsm.c> against <**/*.{h,h{xx,++,h,pp},c,c{xx,++,c,pp}}> with respect to config file </home/arnaud/dev/
uwb-stack/.editorconfig>
- ini#matches_filename: config_dirname is /home/arnaud/dev/uwb-stack
- fnmatch#fnmatch testing </home/arnaud/dev/uwb-stack/mac/fira_session_fsm.c> against <**/*.{h,h{xx,++,h,pp},c,c{xx,++,c,pp}}> wrt </home/arnaud/dev/uwb-stack>
- fnmatch#translate: pattern **/*.{h,h{xx,++,h,pp},c,c{xx,++,c,pp}}
- 38 chars
    *    *    /    *    .    {    h    ,    h    {    x    x    ,    +    +    ,    h    ,    p    p    }    ,    c    ,    c    {    x    x    ,    +    +    ,    c    ,    p    p
    }    }
   2a   2a   2f   2a   2e   7b   68   2c   68   7b   78   78   2c   2b   2b   2c   68   2c   70   70   7d   2c   63   2c   63   7b   78   78   2c   2b   2b   2c   63   2c   70   70
   7d   7d
translate: left=1,1,1; right: 1,1

I added the last log line translate to show the content of l:left_braces and l:right_braces

So there is an issue in let s:RIGHT_BRACE = '\v%(^|[^\\])\}' but I don't understand the meaning of %

cxw42 commented 1 year ago

Thanks for reporting! I am able to reproduce.

cxw42 commented 1 year ago

I just merged #199, which fixes this in my testing. Please try the latest and reopen if it still doesn't work for you! Thanks!

ArnaudD-FR commented 1 year ago

Thanks! It works perfectly!