Skip to content

Commit

Permalink
Use NVDA+f9 and NVDA+f10 to add text
Browse files Browse the repository at this point in the history
  • Loading branch information
nvdaes committed Oct 18, 2019
1 parent c973f0f commit 18093b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
29 changes: 2 additions & 27 deletions addon/globalPlugins/clipContentsDesigner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,8 @@ def __init__(self):
super(globalPluginHandler.GlobalPlugin, self).__init__()
NVDASettingsDialog.categoryClasses.append(AddonSettingsPanel)

self._copyStartMarker = None

def terminate(self):
NVDASettingsDialog.categoryClasses.remove(AddonSettingsPanel)
self._copyStartMarker = None

def onSettings(self, evt):
gui.mainFrame._popupSettingsDialog(NVDASettingsDialog, AddonSettingsPanel)
Expand Down Expand Up @@ -142,36 +139,14 @@ def getMath(self):
text = mathPres.brailleProvider.getBrailleForMathMl(mathMl)
return text

@script(
# Translators: message presented in input mode.
description=_("Marks the current position of the review cursor as the start of text to be added to the clipboard."),
gesture="kb:NVDA+windows+f9"
)
def script_setSelectionStartMarker(self, gesture):
self._copyStartMarker = api.getReviewPosition().copy()
# Translators: message presented when the start marker for adding text has been set using the review cursor.
ui.message(_("Start marker set"))

def getTextToAdd(self):
newText = self.getSelectedText() or self.getMath()
if not newText:
if not self._copyStartMarker:
if not getattr(api.getReviewPosition().obj, "_selectThenCopyRange", None) or not api.getReviewPosition().obj._selectThenCopyRange:
# Translators: message presented when it's not possible to add text, since no text has been selected or marked.
ui.message(_("No selection. No start marker set"))
return
pos = api.getReviewPosition().copy()
if self._copyStartMarker.obj != pos.obj:
# Translators: Message presented when a start marked has been placed, but not in the current object.
ui.message(_("The start marker must reside within the same object"))
return
pos.move(textInfos.UNIT_CHARACTER, 1, endPoint="end")
pos.setEndPoint(self._copyStartMarker, "startToStart")
if pos.compareEndPoints(pos, "startToEnd") == 0:
# Translators: message presented when review cursor has been used to add text and there is no text to add.
ui.message(_("No text to add"))
return
newText = pos.clipboardText
self._copyStartMarker = None
newText = api.getReviewPosition().obj._selectThenCopyRange.clipboardText
try:
clipData = api.getClipData()
except:
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ The clipboard content can also be cleared an shown in browse mode.
## Keyboard commands ##
* NVDA+windows+c: Add selected text, Unicode braille characters which represent MathML objects, or the string which has been marked with the review cursor, to the clipboard.
* NVDA+windows+x: Clear clipboard contents.
* NVDA+windows+f9: Mark the current position of the review cursor as the start of the text to be added to the clipboard. If you use nvda+F9, the text will not be added.
* Not assigned: Copies to (or cuts from) the clipboard, with the possibility of being asked for a previous confirmation.
* Not assigned: Shows the clipboard text in browse mode, or announces if clipboard is empty or has contents which can't be presented in a browseable message, for instance if files or folders are been copied from Windows Explorer..
* Not assigned: Shows the clipboard text in browse mode, or announces if clipboard is empty or has contents which can't be presented in a browseable message, for instance if files or folders are been copied from Windows Explorer.

Note: The above commands can be changed from NVDA menu, Preferences submenu, Input gestures dialog, Text review category.

Expand All @@ -24,9 +23,10 @@ Furthermore, it's possible to change the format and maximum number of characters
Notes:

* The above command can be changed from NVDA menu, Preferences submenu, Input gestures dialog, Configuration category.
* Confirmations won't be requested when a message box of NVDA is still opened. In those cases, actions will be inmediately performed
* Confirmations won't be requested when a message box of NVDA is still opened. In those cases, actions will be inmediately performed.

## Changes for 11.0
* Now it's possible to add text marked with the review cursor using standard commands of NVDA (NVDA+f9 and NVDA+f10). NVDA+windows+f9 is no longer used, for a better integration with the new NVDA+shift+f9 command.
* Requires NVDA 2019.3 or later.

## Changes for 10.0
Expand Down

0 comments on commit 18093b4

Please sign in to comment.