在换行的命令行中,取消//后面的空格的合理性

uncrustify space after // in wrapped command line

本文关键字:空格 合理性 换行 命令行 取消      更新时间:2023-10-16

我使用以下参数的uncrustify:

sp_cmt_cpp_start                = force         # Add space after opening '//'
cmt_width                       = 78  

输入:

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)

但在//第二行"//initialized"之后,应该看起来像

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

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

我已将问题提交给Uncompustify。如果你关心并能够从源头重建不可信,我也有一个可能的解决方案。

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

作为一种变通方法,您可以简单地在您的不可信配置中将force更改为add。只要你的评论不包含嵌入的双空格和三空格,这似乎是正确的行为。(当遇到连续的空白字符时,uncrustify的换行有点古怪。)

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