diff --git a/addon/globalPlugins/snippetsForNVDA/__init__.py b/addon/globalPlugins/snippetsForNVDA/__init__.py index 5154e61..0605603 100644 --- a/addon/globalPlugins/snippetsForNVDA/__init__.py +++ b/addon/globalPlugins/snippetsForNVDA/__init__.py @@ -54,12 +54,21 @@ def script_speakAndCopyMemory(self, gesture): ui.message(data) self.lastPressedKey = keyCode elif getLastScriptRepeatCount() == 1 and self.isLastPressedKey(keyCode): + try: + oldText = api.getClipData() + except OSError: + oldText = None + api.copyToClip(data) + # Translators: The message displayed when the user pasted this memory slot to an edit field. ui.message(_("Pasted {data}").format(data=data)) self.lastPressedKey = 0 # Paste the selected text keyboardHandler.KeyboardInputGesture.fromName("CONTROL+V").send() + + if oldText is not None: + api.copyToClip(oldText) else: self.lastPressedKey = 0 ui.message(data)