=== modified file 'src/com/goldencode/p2j/ui/client/UiUtils.java' --- src/com/goldencode/p2j/ui/client/UiUtils.java 2016-06-07 21:53:53 +0000 +++ src/com/goldencode/p2j/ui/client/UiUtils.java 2016-06-14 16:42:46 +0000 @@ -62,6 +62,7 @@ ** 036 HC 20160406 Fixed lookupWidgetId() implementation to conform with the method's contract. ** 037 HC 20160421 Added locateRootFrame() method. ** 038 HC 20160607 GUI menus reworked to be displayed in dedicated top-level windows. +** 039 SBI 20160614 Added EMPTY_STRING. */ package com.goldencode.p2j.ui.client; @@ -80,6 +81,9 @@ */ public class UiUtils { + /** Empty string */ + public static final String EMPTY_STRING = ""; + /** Logger. */ protected static final Logger LOG = LogHelper.getLogger(UiUtils.class.getName()); === modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2016-06-08 20:04:32 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2016-06-14 16:34:53 +0000 @@ -26,6 +26,7 @@ ** 006 SBI 20160301 The CHUI editor code requires EOL's simulating. ** 007 SBI 20160523 Fixed copy/cut/paste work flow. ** SBI 20160603 Added Safari COMMAND+C processing. +** SBI 20160614 Changed to consume copy/cut events if the current selection is invalid. */ "use strict"; @@ -122,8 +123,15 @@ console.debug("copyHandler {"); if (!me.enabled) return; + if (p2j.isGui) { + // consume copy/cut events if the current selection is invalid + if (getSelection() === "") + { + p2j.consumeEvent(e); + return; + } prepareCopy(); } // restore value to copy @@ -210,8 +218,12 @@ console.debug("getSelectedText() " + text); // copy the current selection to the input hidden field to save this value - // to the system clipboard. - setClipboardValue(text); + // to the system clipboard if the current selection is not empty + if (text !== "") + { + setClipboardValue(text); + } + focusHiddenInputField(); } console.debug("prepareCopy }"); === modified file 'src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java' --- src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java 2016-06-13 17:34:13 +0000 +++ src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java 2016-06-14 16:41:26 +0000 @@ -39,7 +39,7 @@ ** 017 EVL 20160419 Adding more effects handling for editor in 3d mode. ** 018 SVL 20160412 Javadoc fix. ** 019 HC 20160607 GUI menus reworked to be displayed in dedicated top-level windows. -** 020 SBI 20160613 Notify the web client about the current selection. +** 020 SBI 20160614 Changed to notify the client the current selection is invalid. */ package com.goldencode.p2j.ui.client.gui; @@ -2799,6 +2799,8 @@ config.selectionStart = -1; config.selectionEnd = -1; config.selectionText = null; + // notify the client the selection is invalid + gd.setCurrentSelection(UiUtils.EMPTY_STRING); } /** === modified file 'src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java' --- src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java 2016-06-08 13:29:11 +0000 +++ src/com/goldencode/p2j/ui/client/gui/FillInGuiImpl.java 2016-06-14 16:41:58 +0000 @@ -62,6 +62,7 @@ ** 029 VIG 20160128 Added isRMBEntrySupported() method, added system popup support. ** Changed showPopupMenu() call: added parameter. Fixed onFocusLost listener. ** 030 HC 20160607 GUI menus reworked to be displayed in dedicated top-level windows. +** 031 SBI 20160614 Changed to notify the client the current selection is invalid. */ package com.goldencode.p2j.ui.client.gui; @@ -1000,6 +1001,17 @@ } /** + * Invalidate the text selection state. Delegate to the base method and notify the client that + * the current selection is invalid. + */ + @Override + protected void invalidateSelection() + { + super.invalidateSelection(); + gd.setCurrentSelection(UiUtils.EMPTY_STRING); + } + + /** * Draws the selected part of the etry field. * * @param txt