Menu

#1131 Fix hack in CodeCompletion's regex

Undefined
fixed
Patch
2021-12-02
2021-08-19
No

In codecompletion.cpp there are four regex similar to this:

         wxRegEx ppIf(wxT("^[ \t]*#[ \t]*if"));

IMHO the TAB character is injected in a hackish way, that may fail in the future (in fact it is impossible to debug these expressions in the regex test bed). The proper way to match a TAB is using the \t regex escape sequence, which needs two backslashes in a C string:

         wxRegEx ppIf(wxT("^[ \\t]*#[ \\t]*if"));

but this sequence only works in wxRE_ADVANCED mode. Given the regex is trying to match white space, the best and fully compatible way is:

         wxRegEx ppIf(wxT("^[[:blank:]]*#[[:blank:]]*if"));

Tha attached patch fixes the four strings

1 Attachments

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2021-08-19

    This new version removes _() and wxT() also.

     
  • ollydbg

    ollydbg - 2021-11-30
    • assigned_to: ollydbg
     
  • ollydbg

    ollydbg - 2021-12-01
    • assigned_to: ollydbg --> Miguel Gimenez
     
  • ollydbg

    ollydbg - 2021-12-01

    Hi, Miguel Gimenez, since you are C::B developer now, so I think you can commit this patch.

    Thanks.

    I see this patch is OK from my side.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-12-01

    Thank you

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-12-02
    • status: open --> fixed
     
  • Miguel Gimenez

    Miguel Gimenez - 2021-12-02

    Fixed in r12545

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.