Community
Participate
Working Groups
If I swipe some text and the last character is a newline, autoformat will remove this newline. This typically happens when using the keyboard and pressing Shift+Up to select the region to be formatted. Perhaps the range should be trimmed of whitespace before the autoformat occurs.
On second thought, it should be trimmed of newlines only (or lines that are empty?), since Tabs are one of the thing being reformatted.
Martin is this our custom formatting strategy or the formatter?
*** Bug 16422 has been marked as a duplicate of this bug. ***
i tried to reproduce but failed. can you maybe send a screenshot so I can see how much you selected, and where the cursor is? Or maybe send me the file (it could be something with the used line delimiters).
On F1 the bug could be reproduced by moving the cursor at the beginning of a line, pressing Shift-ArrowDown and then Ctrl-O. The line next ot the selected line will move at the end of the selected line. On build 20020528 this works ok, but you can still fool it by selecting a space at the beginning of the next line.
public boolean foo(){ return (3 > 4) || (4 % 3 == 0); <START_HERE>} From <START_HERE> Press Shift+UP_ARROW twice, then autoformat. I get: public boolean foo(){ return (3 > 4) || (4 % 3 == 0);}
I just read Dan's reply. I originally suggested that the algorithm trim newlines only because whitespace is one of the things you might be trying to fix by autoformat. But, I think the algorithm should trim *ALL* trailing whitespace, to handle Dan's case of selecting too much whitespace at the end. The user probably only wants to autoformat the initial Tabs/Spaces.
moving to jcore
I am now getting: public boolean foo() { return (3 > 4) || (4 % 3 == 0); } Closing, duplicate of bug 12159 *** This bug has been marked as a duplicate of 12159 ***
Verified.