internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: nvaccess/nvda

Issue:
Nvda does not read the last word of a text in java application

### Steps to reproduce:
Open a java application where there is a text editing field.
Enter a few words.
Press ctrl + end to go to the end of the text.
Navigate with ctrl + left arrow, and then move forward with ctrl + right arrow.
Note that the last word of the typed text is not read by nvda, it is read in white.
Navigation letter by letter or line by line pronounces the last word.
### Actual behavior:
when navigating word for word the last word is not read.
### Expected behavior:
The last word should be read when navigating word by word.
### System configuration
#### NVDA installed/portable/running from source:
portable
#### NVDA version:
alfa 18199
#### Windows version:
10 17763.615
#### Name and version of other software in use when reproducing the issue:
aplication java
#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
yes
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
no
log:
[javaedit.txt](https://github.com/nvaccess/nvda/files/3446659/javaedit.txt)



Discussion:
Could you test this with a Beta version of NVDA?

tested with the last alpha summer
18222, be63d19d
The failure has occurred.

I tested with the last rc:
nvda_snapshot_rc-18227, bc11064f.exe
The failure did not occur.

tested with the last beta
nvda_2019.2rc1.exe
18228
The failure did not occur either.

Thank you very much.
@fernando-jose-silva: Alpha-18178 (2019-07-25) and higher run on Python 3, the current Betas and RCs for NVDA 2019.2 on Python 2. Therefore this issue isn't fixed yet (for NVDA 2019.3). (I guess this is the case; I didn't test it.) @leonardder: Please correct me if I'm wrong.
I think I would need access to an application that exposes this behavior to debug this.

From my tests even JAVA control panel exhibits this behavior when clicking on about, and reading the second edit field word by word.
I'm sorry I missed this, I added this to the python 3 project, as this is really a regression. I'm diving into this straight ahead.

Resolving patch:
diff --git a/source/textInfos/offsets.py b/source/textInfos/offsets.py
--- a/source/textInfos/offsets.py
+++ b/source/textInfos/offsets.py
@@ -345,7 +345,7 @@ def _getWordOffsets(self,offset):
 				ctypes.byref(relEnd)
 			):
 				relStart = relStart.value
-				relEnd = relEnd.value
+				relEnd = min(lineLength, relEnd.value)
 				if self.encoding != textUtils.WCHAR_ENCODING:
 					# We need to convert the uniscribe based offsets to str offsets.
 					relStart, relEnd = offsetConverter.wideToStrOffsets(relStart, relEnd)


Test patch:
Repository: nvaccess/nvda

Issue:
Screen curtain reveals mouse position
Note, this was reported to me by my wife, so it would help to have at least one sighted person who can verify this.

### Steps to reproduce:
1. Enable the screen curtain by assigning a custom gesture to the global command in the vision category
2. Look at the screen

### Actual behavior:
The screen is black, but the mouse is still shown.

### Expected behavior:
Screen is entirely black

### Proposed fix
There is a function in the magnification API that hides the system cursor, so that can be implemented for this. Having said that, I don't consider this very important.

### System configuration
#### NVDA installed/portable/running from source:
Installed

#### NVDA version:
alpha-18574

#### Windows version:
Windows 10 1903



Discussion:
Yes, I can confirm this. I've tested it a few days ago and I observed the same behavior. The screen is black, but the mouse cursor/pointer is definitely visible on the screen.

I might be wrong, but I think this is a limitation of the used API. JAWS has the same feature and it behaves the same - the screen is black, but the mouse pointer is visible.
Interesting to see that JAWS seems to use the same API. However, I'm 
pretty sure I can fix this.


Resolving patch:
diff --git a/source/visionEnhancementProviders/screenCurtain.py b/source/visionEnhancementProviders/screenCurtain.py
--- a/source/visionEnhancementProviders/screenCurtain.py
+++ b/source/visionEnhancementProviders/screenCurtain.py
@@ -38,6 +38,8 @@ class Magnification:
 	_MagSetFullscreenColorEffectArgTypes = ((1, "effect"),)
 	_MagGetFullscreenColorEffectFuncType = WINFUNCTYPE(BOOL, POINTER(MAGCOLOREFFECT))
 	_MagGetFullscreenColorEffectArgTypes = ((2, "effect"),)
+	_MagShowSystemCursorFuncType = WINFUNCTYPE(BOOL, BOOL)
+	_MagShowSystemCursorArgTypes = ((1, "showCursor"),)
 
 	MagInitialize = _MagInitializeFuncType(("MagInitialize", _magnification))
 	MagInitialize.errcheck = _errCheck
@@ -57,6 +59,11 @@ class Magnification:
 	except AttributeError:
 		MagSetFullscreenColorEffect = None
 		MagGetFullscreenColorEffect = None
+	MagShowSystemCursor = _MagShowSystemCursorFuncType(
+		("MagShowSystemCursor", _magnification),
+		_MagShowSystemCursorArgTypes
+	)
+	MagShowSystemCursor.errcheck = _errCheck
 
 
 class VisionEnhancementProvider(vision.providerBase.VisionEnhancementProvider):
@@ -73,10 +80,12 @@ def canStart(cls):
 	def __init__(self):
 		super(VisionEnhancementProvider, self).__init__()
 		Magnification.MagInitialize()
+		Magnification.MagShowSystemCursor(False)
 		Magnification.MagSetFullscreenColorEffect(TRANSFORM_BLACK)
 
 	def terminate(self):
 		super(VisionEnhancementProvider, self).terminate()
+		Magnification.MagShowSystemCursor(True)
 		Magnification.MagUninitialize()
 
 	def registerEventExtensionPoints(self, extensionPoints):


Test patch:
Repository: nvaccess/nvda

Issue:
Fix up of: Implement new displayChunk unit for display model
### Link to issue number:
Fixes #10187 
Fixup of #10165 

### Summary of the issue:
A bad search/replace added a reference to non-existent textInfos.UNIT_DISPLAYCHUNK, which is a variable in the displayModel module itself.

### Description of how this pull request fixes the issue:
Removed `textInfos.`

### Testing performed:
Made sure that there is no other reference to textInfos.UNIT_DISPLAYCHUNK

### Known issues with pull request:
None

### Change log entry:
None



Discussion:

Resolving patch:
diff --git a/source/displayModel.py b/source/displayModel.py
--- a/source/displayModel.py
+++ b/source/displayModel.py
@@ -506,7 +506,7 @@ def _get_clipboardText(self):
 	def getTextInChunks(self,unit):
 		# Specifically handle the line and display chunk units.
 		# We have the line offsets pre-calculated, and we can not guarantee lines end with \n
-		if unit is textInfos.UNIT_DISPLAYCHUNK:
+		if unit is UNIT_DISPLAYCHUNK:
 			for x in self._getFieldsInRange(self._startOffset, self._endOffset):
 				if not isinstance(x, str):
 					continue


Test patch:
Repository: nvaccess/nvda

Issue:
Symbol replacement edit not visible in punctuation / symbol pronunciation dialog
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:

Open NVDA's symbol pronunciation dialog.
Look (visually) for "replacement" edit.

### Actual behavior:

Replacement edit is not visible.
Note that behaviour of the dialog works as expected (can tab to edit or press alt+r, it's just not visible).

Image of dialog from old (2019.1.1 and earlier) version of NVDA:
![oldsymboldialog](https://user-images.githubusercontent.com/15902216/64915695-62019e80-d7b0-11e9-8c75-756b53eed0ac.jpg)

Image of dialog from NVDA 2019.2:
![newsymboldialog](https://user-images.githubusercontent.com/15902216/64915694-61690800-d7b0-11e9-8bb3-c06a43b70e89.jpg)

### Expected behavior:

The edit box should be visible.

### System configuration
#### NVDA installed/portable/running from source:

#### NVDA version:
Installed 2019.2

#### Windows version:
10

#### Name and version of other software in use when reproducing the issue:

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
2019.1.1 and several earlier versions.  In all of which the edit box was visible.



Discussion:
@feerrenrut 
@Qchristensen Have you tried with recent Alpha version? Also cc @JulienCochuyt given his/her recent work on visual aspects of some dialogs.

Resolving patch:
diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py
--- a/source/gui/settingsDialogs.py
+++ b/source/gui/settingsDialogs.py
@@ -3029,7 +3029,7 @@ def wrapWithEventSkip(event):
 
 		# Translators: The label for the edit field in symbol pronunciation dialog to change the replacement text of a symbol.
 		replacementText = _("&Replacement")
-		self.replacementEdit = sHelper.addLabeledControl(
+		self.replacementEdit = changeSymbolHelper.addLabeledControl(
 			labelText=replacementText,
 			wxCtrlClass=wx.TextCtrl,
 			size=self.scaleSize((300, -1)),


Test patch:
Repository: nvaccess/nvda

Issue:
Symbol replacement edit not visible in punctuation / symbol pronunciation dialog
<!--
Please thoroughly read NVDA's wiki article on how to fill in this template, including how to provide the required files.
Issues may be closed if the required information is not present.
https://github.com/nvaccess/nvda/wiki/Github-issue-template-explanation-and-examples
-->

### Steps to reproduce:

Open NVDA's symbol pronunciation dialog.
Look (visually) for "replacement" edit.

### Actual behavior:

Replacement edit is not visible.
Note that behaviour of the dialog works as expected (can tab to edit or press alt+r, it's just not visible).

Image of dialog from old (2019.1.1 and earlier) version of NVDA:
![oldsymboldialog](https://user-images.githubusercontent.com/15902216/64915695-62019e80-d7b0-11e9-8c75-756b53eed0ac.jpg)

Image of dialog from NVDA 2019.2:
![newsymboldialog](https://user-images.githubusercontent.com/15902216/64915694-61690800-d7b0-11e9-8bb3-c06a43b70e89.jpg)

### Expected behavior:

The edit box should be visible.

### System configuration
#### NVDA installed/portable/running from source:

#### NVDA version:
Installed 2019.2

#### Windows version:
10

#### Name and version of other software in use when reproducing the issue:

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
2019.1.1 and several earlier versions.  In all of which the edit box was visible.



Discussion:
@feerrenrut 
@Qchristensen Have you tried with recent Alpha version? Also cc @JulienCochuyt given his/her recent work on visual aspects of some dialogs.

Resolving patch:
diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py
--- a/source/gui/settingsDialogs.py
+++ b/source/gui/settingsDialogs.py
@@ -2955,7 +2955,7 @@ def wrapWithEventSkip(event):
 
 		# Translators: The label for the edit field in symbol pronunciation dialog to change the replacement text of a symbol.
 		replacementText = _("&Replacement")
-		self.replacementEdit = sHelper.addLabeledControl(
+		self.replacementEdit = changeSymbolHelper.addLabeledControl(
 			labelText=replacementText,
 			wxCtrlClass=wx.TextCtrl,
 			size=self.scaleSize((300, -1)),


Test patch:
Repository: nvaccess/nvda

Issue:
Vocalize the result of toggle displaying nonprinting characters in MS Word
### Is your feature request related to a problem? Please describe.
As a visually impaired with narrow vision field, I have difficulty to figure out if text contains nonprinting characters in MS Word. I may also occasionally activate this feature without wanting it (Ctrl+Shift+8 shortcut).

### Describe the solution you'd like
Vocalize the result of the shortcut Ctrl+Shift+8 that toggles the Display nonprinting characters in MS Word. feature.

### Describe alternatives you've considered

### Additional context
MS Word 2016



Discussion:

Resolving patch:
diff --git a/source/NVDAObjects/window/winword.py b/source/NVDAObjects/window/winword.py
--- a/source/NVDAObjects/window/winword.py
+++ b/source/NVDAObjects/window/winword.py
@@ -1377,7 +1377,26 @@ def script_toggleChangeTracking(self, gesture):
 		else:
 			# Translators: a message when toggling change tracking in Microsoft word
 			ui.message(_("Change tracking off"))
-	
+
+	@script(gesture="kb:control+shift+8")
+	def script_toggleDisplayNonprintingCharacters(self, gesture):
+		if not self.WinwordWindowObject:
+			# We cannot fetch the Word object model, so we therefore cannot report the status change.
+			# The object model may be unavailable because this is a pure UIA implementation such as Windows 10 Mail,
+			# or it's within Windows Defender Application Guard.
+			# In this case, just let the gesture through and don't report anything.
+			return gesture.send()
+		val = self._WaitForValueChangeForAction(
+			lambda: gesture.send(),
+			lambda: self.WinwordWindowObject.ActivePane.View.ShowAll
+		)
+		if val:
+			# Translators: a message when toggling Display Nonprinting Characters in Microsoft word
+			ui.message(_("Display nonprinting characters"))
+		else:
+			# Translators: a message when toggling Display Nonprinting Characters in Microsoft word
+			ui.message(_("Hide nonprinting characters"))
+
 	@script(gestures=["kb:tab", "kb:shift+tab"])
 	def script_tab(self,gesture):
 		"""


Test patch:
Repository: nvaccess/nvda

Issue:
decrease nvda verbosity in the windows 7 start search area
**Reported by jmwalton on 2012-01-02 07:21**
when you search in the windows 7 start menu search box, nvda speaks "items view list, programs, program" as an example. i feel that it would be better if it were to just say the search results as they come up. an example there would be you search for "update" and nvda would speak "windows update" not "items view list, programs, windows update."



Discussion:
Comment 1 by jteh on 2012-01-02 07:33
Without the announcement of the list, it isn't clear that you have entered the search results list (as opposed to just changing the content of the editable text field). Without the announcement of the group (e.g. "Programs"), you have no idea which group of results you are in. This can be important to differentiate programs from control panel items, for example. The only announcement that is arguably extraneous is "Items View" as the list name.

Comment 2 by jmwalton (in reply to comment 1) on 2012-01-02 08:49
so what would you say here. with other screen readers i have used it has a lot less verbosity in that area. i understand what you are saying about the program group announcement. what would you suggest to do?

Comment 3 by jmwalton on 2012-01-21 09:47
so what would you suggest we do, close the ticket? is there any thing you can do to remove when it says "items view" while searching the start menu?

Comment 4 by JamaicanUser on 2015-07-15 15:46
I would prefer if items view list is not announced. The other messages are quite helpful

While I see that this can be annoying at times, it is not life threatening. The information that is provided lets the user know where they are in the search. What do others think?
Ideally, we wouldn't report "Items View list". P4.

Resolving patch:
diff --git a/source/appModules/explorer.py b/source/appModules/explorer.py
--- a/source/appModules/explorer.py
+++ b/source/appModules/explorer.py
@@ -293,6 +293,16 @@ def event_NVDAObject_init(self, obj):
 		# Lets hide that
 		if windowClass=="msctls_progress32" and winUser.getClassName(winUser.getAncestor(obj.windowHandle,winUser.GA_PARENT))=="Address Band Root":
 			obj.presentationType=obj.presType_layout
+			return
+
+		if windowClass == "DirectUIHWND" and role == controlTypes.ROLE_LIST:
+			if obj.parent and obj.parent.parent:
+				parent = obj.parent.parent.parent
+				if parent is not None and parent.windowClassName == "Desktop Search Open View":
+					# List containing search results in Windows 7 start menu.
+					# Its name is not useful so discard it.
+					obj.name = None
+					return
 
 	def event_gainFocus(self, obj, nextHandler):
 		wClass = obj.windowClassName


Test patch:
Repository: nvaccess/nvda

Issue:
Revising of the text in Microsoft Word not localized
Translatable string "revised %s" incorrectly used in speech module on line 1500:
text=(_("revised %s"%revision) if revision
Please fix it.


Discussion:
@kvark128: Please completely fill out the bug report draft. Thanks.
@kvark128 I don't really understand what you expect the behavior to be here. Please edit the issue and include all information required in the issue template. Thanks.
I don't know how to reproduce the problem in Word and can't describe it.
Here in the gettext function passed already partly translated string:
_("revised %s"%revision)
it should be:
_("revised %s")%revision
The closing bracket in the wrong place. This is a very common mistake.

Resolving patch:
diff --git a/source/speech/__init__.py b/source/speech/__init__.py
--- a/source/speech/__init__.py
+++ b/source/speech/__init__.py
@@ -1495,11 +1495,13 @@ def getFormatFieldSpeech(attrs,attrsCache=None,formatConfig=None,reason=None,uni
 			textList.append(text)
 		revision=attrs.get("revision")
 		oldRevision=attrsCache.get("revision") if attrsCache is not None else None
-		if (revision or oldRevision is not None) and revision!=oldRevision:
-			# Translators: Reported when text is revised.
-			text=(_("revised %s"%revision) if revision
+		if (revision or oldRevision is not None) and revision != oldRevision:
+			if revision:
+				# Translators: Reported when text is revised.
+				text = _("revised %s") % revision
+			else:
 				# Translators: Reported when text is not revised.
-				else _("no revised %s")%oldRevision)
+				text = _("no revised %s") % oldRevision
 			textList.append(text)
 	if  formatConfig["reportEmphasis"]:
 		# marked text 


Test patch:
Repository: nvaccess/nvda

Issue:
When getting a COM attribute using dynamic dispatch and the call is canceled, the original COMError is raised instead of watchdog.CallCancelled
### Steps to reproduce:
In word, run the following code snippet from the python console:

`for i in range(5000): review._rangeObj.Start == review._rangeObj.End`

### Actual behavior:
On python 3:

```
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "comtypesMonkeyPatches.pyc", line 78, in new__getattr__
  File "comtypes\client\lazybind.pyc", line 168, in __getattr__
  File "comtypes\automation.pyc", line 729, in _invoke
_ctypes.COMError: (-2147418110, 'Aanroep is door het berichtenfilter geannuleerd.', (None, None, None, 0, None))
```

### Expected behavior:
On python 2:

```
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "watchdog.pyo", line 202, in _COMError_init
CallCancelled
```

### System configuration
#### NVDA installed/portable/running from source:
n/a

#### NVDA version:
2019.2 and Alpha

#### Windows version:
Windows 10 version 1093

#### Name and version of other software in use when reproducing the issue:
Word 2016 version 16.0.11929.20300

#### Other information about your system:
N/a

### Other questions
n/a



Discussion:

Resolving patch:
diff --git a/source/comtypesMonkeyPatches.py b/source/comtypesMonkeyPatches.py
--- a/source/comtypesMonkeyPatches.py
+++ b/source/comtypesMonkeyPatches.py
@@ -3,10 +3,12 @@
 # This file is covered by the GNU General Public License.
 # See the file COPYING for more details.
 
+# Warning: no comtypes modules can be imported until ctypes.WINFUNCTYPE has been replaced further down.
+
 import ctypes
 import _ctypes
 import importlib
-import comtypes.client._generate
+
 
 # A version of ctypes.WINFUNCTYPE 
 # that produces a WinFunctionType class whose instance will convert COMError into a CallCancelled exception when called as a function.
@@ -46,6 +48,8 @@ def __call__(self,*args,**kwargs):
 finally:
 	ctypes.WINFUNCTYPE=old_WINFUNCTYPE
 
+# It is safe to import any comtypes modules from here on down.
+
 from logHandler import log
 
 from comtypes import COMError
@@ -130,6 +134,10 @@ def _check_version(actual):
 
 
 # Monkeypatch comtypes to clear the importlib cache when importing a new module
+
+# We must import comtypes.client._generate here as it must be done after other monkeypatching
+import comtypes.client._generate  # noqa: E402
+
 old_my_import = comtypes.client._generate._my_import
 
 


Test patch:
Repository: nvaccess/nvda

Issue:
When BRLTTY for Windows is installed scons fails to bundle BrlAPI
Discovered while debugging #10228
### Steps to reproduce:
1. Install BRLTTY for Windows you do not need to have any actual braille display connected.
2. Execute scons launcher from the root of the NVDA repo.
3. Start newly created launcher.
### Actual behavior:
BrlAPI dll is missing. It is therefore not possible to switch to BRLTTY.
### Expected behavior:
BrlAPI should be working regardless of what is installed on the system.
### System configuration
#### NVDA installed/portable/running from source:
Source
#### NVDA version:
Any after migration to BrlAPI 07 and Python 3.
#### Windows version:
Windows 7 x64
#### Name and version of other software in use when reproducing the issue:
Python, BRLTTY for Windows
#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
This is new after Python 3 migration.
#### Additional info:
WHen BRLTTY is installed it places brlapi-0.7.dll in the syswow64 directory. When this dll is removed either manually or by uninstall of BRLTTY BrlAPI is bundled correctly.


Discussion:
cc: @bramd, @leonardder 

Resolving patch:
diff --git a/source/setup.py b/source/setup.py
--- a/source/setup.py
+++ b/source/setup.py
@@ -230,6 +230,7 @@ def getRecursiveDataFiles(dest,source,excludes=()):
 		("images", glob("images/*.ico")),
 		("louis/tables",glob("louis/tables/*")),
 		("COMRegistrationFixes", glob("COMRegistrationFixes/*.reg")),
+		(".", glob("../miscDeps/python/*.dll")),
 		(".", ['message.html' ])
 	] + (
 		getLocaleDataFiles()


Test patch: