diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 4367166d373b3bdac0fb6192dcbd5d71ba61ba77..99b17592ea1125b054eb76d7a3ea6fc82caf3a26 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -4890,6 +4890,7 @@ function select_text(cid, elem) {
         } else if (win.getSelection) {
             range = win.document.createRange();
             range.selectNodeContents(elem);
+            win.getSelection().removeAllRanges();
             win.getSelection().addRange(range);
         }
 }