# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: C:\Development\_workspace\mercurial_repo\netbeans\Netbeans_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/BaseKit.java --- editor.lib/src/org/netbeans/editor/BaseKit.java Base (BASE) +++ editor.lib/src/org/netbeans/editor/BaseKit.java Locally Modified (Based On LOCAL) @@ -1932,6 +1932,7 @@ final BaseDocument doc = (BaseDocument)target.getDocument(); doc.runAtomicAsUser (new Runnable () { + @Override public void run () { DocumentUtilities.setTypingModification(doc, true); try { @@ -1986,18 +1987,24 @@ //#54893 putValue ("helpID", CopyAction.class.getName ()); // NOI18N } + @Override public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { try { + int caretPosition = target.getCaretPosition(); + boolean emptySelection = !Utilities.isSelectionShowing(target); // If there is no selection then pre-select a current line including newline - if (!Utilities.isSelectionShowing(target)) { + if (emptySelection) { Element elem = ((AbstractDocument) target.getDocument()).getParagraphElement( - target.getCaretPosition()); + caretPosition); if (!Utilities.isRowWhite((BaseDocument) target.getDocument(), elem.getStartOffset())) { target.select(elem.getStartOffset(), elem.getEndOffset()); } } target.copy(); + if (emptySelection) { + target.setCaretPosition(caretPosition); + } } catch (BadLocationException ble) { LOG.log(Level.FINE, null, ble); }