在包装的命令行中//解开空格

MeJ*_*MeJ 5 c c++ uncrustify

我使用uncrustify与以下参数:

sp_cmt_cpp_start                = force         # Add space after opening '//'
cmt_width                       = 78  
Run Code Online (Sandbox Code Playgroud)

输入:

bi.dwSize = sizeof (bi); //Size of the structure itself, must be initialized with sizeof(CGOSBOARDINFO)

输出:

bi.dwSize = sizeof(bi); // Size of the structure itself, must be
                              //initialized with sizeof(CGOSBOARDINFO)
Run Code Online (Sandbox Code Playgroud)

但在第二行//后"//初始化"应该像:

bi.dwSize = sizeof(bi); // Size of the structure itself, must be
                              // initialized with sizeof(CGOSBOARDINFO)
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个小问题?

Quu*_*one 4

我已经针对 uncrustify 提出了问题。如果您关心并且能够从源代码重建 uncrustify,我也有一个可能的解决方案。

https://github.com/bengardner/uncrustify/issues/95

作为解决方法,您可以简单地在 uncrustify 配置中进行force更改。add只要您的注释不包含嵌入的双空格和三空格,这似乎就有正确的行为。(当遇到连续的空白字符时,Uncrustify 的换行行为有点古怪。)

编辑:该错误已在 master 中修复,截至 2012-12-04: https: //github.com/bengardner/uncrustify/commit/44e0253a