Community
Participate
Working Groups
Build ID: CDT 5.0.0-I200806020821 Steps To Reproduce: 1. Select second line in the example being careful not to select end of line (i.e. <home>, then <shift><end>) #include <a.h> #include <b.h> #include <c.h> 2. Press <shift><ctrl>/ 3. Block comment C-style is inserted ruining 3-rd line: #include <a.h> /*#include <b.h> */#include <c.h> desired result: #include <a.h> /*#include <b.h>*/ #include <c.h> Note that it works as expected if the line does not start with #, i.e. int i; /*int j;*/ int k; --- Also, I would suggest an enhancement. Currently, if there is no selection, <ctrl><shift>/ has no effect. I suggest to comment out the whole line where the cursor is located. More information:
Created attachment 104613 [details] Changes to improve adding/removing C style block comments /* */ I created a patch to handle block comments hopefully more consistent. I did not find any test cases, so I created a bunch both for adding and removing the comments. Please review.
Great! The JUnit test is much appreciated. I'll schedule this for 5.0.1.
Created attachment 105363 [details] Additional patch to add test cases to test suite I noticed that I missed adding the test cases to the test suite. Here is the patch for that. By the way, Toni, thanks for very fast respond on the patch, very impressive and encouraging. Hopefully I can contribute some more to such fantastic project as CDT.
I found a few issues with this patch: - Unfortunately, you cannot assume that the same line delimiter is used throughout the file. - A NPE occurs when commenting the last line and the line does not end in a line delimiter. - If the last line is a single line comment which does not end in a line delimiter, the block comment is wrong. Please address these remaining issues. Thanks!
Created attachment 106273 [details] updated patch The issues are fixed, please see updated patch. Check out additional test cases covering them. In CDT, Ctrl-/ performs C++ style line commenting "//" even when a user is working with C code where such comments are illegal. Do you think it's worth considering mapping Ctrl-/ to block comments for such files? I think that users in mass are not even aware of Ctrl-Shift-/ combination for such a common need as commenting. Actually, we are working with mix of C and C++ code so this would be needed to be dependent on file extension I guess. And users from other organizations could work with different C dialect accepting C++ comments. A flag in preferences? Just thinking.
Created attachment 106274 [details] mylyn/context/zip
Sigh. Can't figure for myself yet if mylyn is more help or more trouble. Is it possible to remove this automatically attached 400Kb context file.
(In reply to comment #5) > The issues are fixed, please see updated patch. Check out additional test cases > covering them. Thanks for the update. I have applied the patch with minor modifications: - comments - added support for doc-style comment partitions Fixed in 5.0.1 and HEAD > 20080707. > In CDT, Ctrl-/ performs C++ style line commenting "//" even when a user... I suggest to create a separate enhancement request for that.