# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: D:\ws\main # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: editor.lib/src/org/netbeans/editor/ext/ExtKit.java --- editor.lib/src/org/netbeans/editor/ext/ExtKit.java +++ editor.lib/src/org/netbeans/editor/ext/ExtKit.java @@ -915,13 +915,32 @@ } int lineCount = Utilities.getRowCount(doc, startPos, endPos); - boolean comment = forceComment != null ? forceComment : !allComments(doc, startPos, lineCount); - - if (comment) { + if (forceComment != null) { + //comment/uncomment action + if (forceComment.booleanValue()) { comment(doc, startPos, lineCount); } else { uncomment(doc, startPos, lineCount); } + } else { + //toggle comment action -> toggles comment at each line separately + int pos = endPos; + int startPosOfLine; + final int oneLine = 1; + do { + startPosOfLine = Utilities.getRowStart(doc, pos); + final boolean isCommentAtLine = allComments(doc, startPosOfLine, oneLine); + if (!isCommentAtLine) { + comment(doc, startPosOfLine, oneLine); + } else { + uncomment(doc, startPosOfLine, oneLine); + } + pos = startPosOfLine - 1; + + } while (startPosOfLine>startPos); + + } + NavigationHistory.getEdits().markWaypoint(target, startPos, false, true); } catch (BadLocationException e) { target.getToolkit().beep();