This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 51924
Collapse All | Expand All

(-)editor.lib/src/org/netbeans/editor/BaseKit.java (-2 / +9 lines)
Lines 1932-1937 Link Here
1932
                
1932
                
1933
                final BaseDocument doc = (BaseDocument)target.getDocument();
1933
                final BaseDocument doc = (BaseDocument)target.getDocument();
1934
                doc.runAtomicAsUser (new Runnable () {
1934
                doc.runAtomicAsUser (new Runnable () {
1935
                    @Override
1935
                    public void run () {
1936
                    public void run () {
1936
                    DocumentUtilities.setTypingModification(doc, true);
1937
                    DocumentUtilities.setTypingModification(doc, true);
1937
                    try {
1938
                    try {
Lines 1986-2003 Link Here
1986
            //#54893 putValue ("helpID", CopyAction.class.getName ()); // NOI18N
1987
            //#54893 putValue ("helpID", CopyAction.class.getName ()); // NOI18N
1987
        }
1988
        }
1988
1989
1990
        @Override
1989
        public void actionPerformed(ActionEvent evt, JTextComponent target) {
1991
        public void actionPerformed(ActionEvent evt, JTextComponent target) {
1990
            if (target != null) {
1992
            if (target != null) {
1991
                try {
1993
                try {
1994
                    int caretPosition = target.getCaretPosition();
1995
                    boolean emptySelection = !Utilities.isSelectionShowing(target);
1992
                    // If there is no selection then pre-select a current line including newline
1996
                    // If there is no selection then pre-select a current line including newline
1993
                    if (!Utilities.isSelectionShowing(target)) {
1997
                    if (emptySelection) {
1994
                        Element elem = ((AbstractDocument) target.getDocument()).getParagraphElement(
1998
                        Element elem = ((AbstractDocument) target.getDocument()).getParagraphElement(
1995
                                target.getCaretPosition());
1999
                                caretPosition);
1996
                        if (!Utilities.isRowWhite((BaseDocument) target.getDocument(), elem.getStartOffset())) {
2000
                        if (!Utilities.isRowWhite((BaseDocument) target.getDocument(), elem.getStartOffset())) {
1997
                            target.select(elem.getStartOffset(), elem.getEndOffset());
2001
                            target.select(elem.getStartOffset(), elem.getEndOffset());
1998
                        }
2002
                        }
1999
                    }
2003
                    }
2000
                    target.copy();
2004
                    target.copy();
2005
                    if (emptySelection) {
2006
                        target.setCaretPosition(caretPosition);
2007
                    }
2001
                } catch (BadLocationException ble) {
2008
                } catch (BadLocationException ble) {
2002
                    LOG.log(Level.FINE, null, ble);
2009
                    LOG.log(Level.FINE, null, ble);
2003
                }
2010
                }

Return to bug 51924