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

Issue:
StopItteration, might be from python3 transition
### Steps to reproduce:

1. go to google.com
2. press ctrl+end.
3. press shift+h.
4. press n.

### Actual behavior:

```
Speaking ['blank']
IO - inputCore.InputManager.executeGesture (05:24:28.097):
Input: kb(laptop):n
ERROR - scriptHandler.executeScript (05:24:28.137):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <virtualBuffers.gecko_ia2.Gecko_ia2 object at 0x0B3DAE50>> with gesture 'n'
Traceback (most recent call last):
  File "browseMode.pyc", line 1733, in _iterNotLinkBlock
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "scriptHandler.pyc", line 190, in executeScript
  File "browseMode.pyc", line 430, in <lambda>
  File "browseMode.pyc", line 402, in _quickNavScript
RuntimeError: generator raised StopIteration
IO - inputCore.InputManager.executeGesture (05:24:29.274):
Input: kb(laptop):NVDA+f1
```

### Expected behavior:

message about no more blocks of text.

### System configuration
#### NVDA installed/portable/running from source:
installed

#### NVDA version:

alpha-18290,7b5cd2d0


probably caused by threshold.


Discussion:
@derekriemer: Please list all web browsers (incl. version), where this issue occurs. Thanks.

Resolving patch:
diff --git a/source/browseMode.py b/source/browseMode.py
--- a/source/browseMode.py
+++ b/source/browseMode.py
@@ -1751,9 +1751,10 @@ def _isSuitableNotLinkBlock(self, textRange):
 	def _iterNotLinkBlock(self, direction="next", pos=None):
 		links = self._iterNodesByType("link", direction=direction, pos=pos)
 		# We want to compare each link against the next link.
-		item1 = next(links)
-		while True:
-			item2 = next(links)
+		item1 = next(links, None)
+		if item1 is None:
+			return
+		for item2 in links:
 			# If the distance between the links is small, this is probably just a piece of non-link text within a block of links; e.g. an inactive link of a nav bar.
 			if direction=="previous":
 				textRange=item1.textInfo.copy()


Test patch:
Repository: nvaccess/nvda

Issue:
NVDA cannot upgrade old settings if winConsoleSpeakPasswords is present.
### Steps to reproduce:

1. Enable "Speak &passwords in Windows Console (may improve performance)" in advanced settings.
2. Try to install NVDA 2019.3beta1.

### Actual behavior:
An exception is generated and the current config is not updated. All current user settings are lost.

ERROR - config.ConfigManager._initBaseConf (05:37:42.736) - MainThread (12356):
Error loading base configuration
Traceback (most recent call last):
  File "config\__init__.pyc", line 424, in _initBaseConf
  File "config\__init__.pyc", line 458, in _loadConfig
  File "config\__init__.pyc", line 454, in _loadConfig
  File "config\profileUpgrader.pyc", line 24, in upgrade
  File "config\profileUpgrader.pyc", line 41, in _doConfigUpgrade
  File "config\profileUpgradeSteps.pyc", line 60, in upgradeConfigFrom_2_to_3
  File "configobj\__init__.pyc", line 502, in __getitem__
KeyError: 'terminals'
INFO - config.ConfigManager._loadConfig (05:37:42.736) - MainThread (12356):
Loading config: None

The solution is quite simple and important to solve for users when upgrade to newer NVDA's versions.
Just check if the key "terminals" exists and create it if needed in the upgradeConfigFrom_2_to_3 function.

### Expected behavior:
The current user settings are updated without losing them.

### System configuration
#### NVDA installed/portable/running from source:
Installed

#### NVDA version:
2019.2.1 and 2019.3beta1

#### Windows version:
Windows 10 1903

#### Name and version of other software in use when reproducing the issue:
N/A

#### Other information about your system:
MSI gs65, intel i7 8750h, 32gb ram.

### 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.
Just tried with the current stable version.


Discussion:

Resolving patch:
diff --git a/source/config/profileUpgradeSteps.py b/source/config/profileUpgradeSteps.py
--- a/source/config/profileUpgradeSteps.py
+++ b/source/config/profileUpgradeSteps.py
@@ -57,4 +57,6 @@ def upgradeConfigFrom_2_to_3(profile):
 		pass
 	else:
 		del profile["UIA"]["winConsoleSpeakPasswords"]
+		if "terminals" not in profile:
+			profile["terminals"] = {}
 		profile["terminals"]["speakPasswords"] = speakPasswords


Test patch:
Repository: nvaccess/nvda

Issue:
IE11: toggleVirtualBuffer, no audio indication of Focus and Browse modes
This case occurs in edit field only. When user moves to edit field, and manually force focus mode.

### Steps to reproduce:
1. Open an internal page.
2. Press e to move to edit field.
3. Press NVDA+space to switch to focus mode.
(No audio indication. NVDA played audio error.wav.)
4. Press NVDA+space to switch to browse mode.
#### Actual behavior:
(No audio indication.)
By using single letter nav, user knows that it is in browse mode now.
#### Expected behavior:
NVDA played audio indication. 

### System configuration:
#### NVDA Installed/portable/running from source:
portable.

#### NVDA version:
2019.3Beta1

#### Windows version:
6.1.7601 service pack 1

#### Name and version of other software in use when reproducing the issue:
browser: Internet Explorer 11

### Other questions:

#### Does the issue still occur after restarting your PC?
Yes.

#### Have you tried any other versions of NVDA?
Yes, this case does not occur in NVDA_2019.2.1 and NVDA alpha-18874.

### Developer info:
Log file starts from line 486.
[nvda toggle Virtual buffer.log](https://github.com/nvaccess/nvda/files/3958431/nvda.toggle.Virtual.buffer.line.486.log)



Discussion:
cc: @feerrenrut 
Hi,
* This case occurs only when braille display is connected. In speech only, NVDA (audio indication) works as expected.
* This case occurs in [alpha-19012](https://ci.appveyor.com/api/buildjobs/v6ohkbyiexgp1edj/artifacts/output/nvda_snapshot_alpha-19012,5a0b42ea.exe) and later.
* braille display: Freedom Scientific PAC Mate

Why we are using EdgeNode from UIA for edit fields in Internet Explorer at all? cc @leonardder 

Resolving patch:
diff --git a/source/NVDAObjects/UIA/__init__.py b/source/NVDAObjects/UIA/__init__.py
--- a/source/NVDAObjects/UIA/__init__.py
+++ b/source/NVDAObjects/UIA/__init__.py
@@ -853,7 +853,11 @@ def findOverlayClasses(self,clsList):
 		# Windows 8.x toast, although a form of tool tip, is covered separately.
 		elif UIAControlType==UIAHandler.UIA_ToolTipControlTypeId:
 			clsList.append(ToolTip)
-		elif self.UIAElement.cachedFrameworkID in ("InternetExplorer","MicrosoftEdge"):
+		elif(
+			self.UIAElement.cachedFrameworkID in ("InternetExplorer", "MicrosoftEdge")
+			# But not for Internet Explorer
+			and not self.appModule.appName == 'iexplore'
+		):
 			from . import edge
 			if UIAClassName in ("Internet Explorer_Server","WebView") and self.role==controlTypes.ROLE_PANE:
 				clsList.append(edge.EdgeHTMLRootContainer)


Test patch:
Repository: nvaccess/nvda

Issue:
NVDA stops working in edge beta after page load
### Steps to reproduce:

1. Install Microsoft Edge Beta from [here](https://www.microsoftedgeinsider.com/download).
1. Open _Microsoft Edge Beta_ from start menu and load any web page.
1. Wait until NVDA says "page loaded" or something similar in your language.

### Actual behavior:

NVDA stops responding. This may be related to #10631, but the fact is that browse mode is not activated in any case.

### Expected behavior:

NVDA should act as normal. We know that browse-mode is not implemented for Chrome UIA implementation but focus mode should work.

### System configuration
#### NVDA installed/portable/running from source:

NVDA installed

#### NVDA version:

alpha-19460,d7229eff

#### Windows version:

Windows 10 pro 64-bit version 1909 (Build 18363.535)

#### Name and version of other software in use when reproducing the issue:

Microsoft Edge chrome-based, version 79.0.309.54

#### Other information about your system:

Locale set to es-AR.

### 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.

Yes, tried previous build with same results.

[NVDA log file in debug mode](https://github.com/nvaccess/nvda/files/3978556/nvda-old.log)



Discussion:
I've seen this happening as well. I'm afraid this requires some extensive testing, may be even cooperation with Microsoft to solve this.

@michaelDCurran: Is this somewhere on the NV Access roadmap in the near future?
I can confirm that, too. but if you disable the UIA, the edge problem disappears.

Resolving patch:
diff --git a/source/_UIAHandler.py b/source/_UIAHandler.py
--- a/source/_UIAHandler.py
+++ b/source/_UIAHandler.py
@@ -51,22 +51,25 @@
 badUIAWindowClassNames=[
 	# UIA events of candidate window interfere with MSAA events.
 	"Microsoft.IME.CandidateWindow.View",
-"SysTreeView32",
-"WuDuiListView",
-"ComboBox",
-"msctls_progress32",
-"Edit",
-"CommonPlacesWrapperWndClass",
-"SysMonthCal32",
-"SUPERGRID", #Outlook 2010 message list
-"RichEdit",
-"RichEdit20",
-"RICHEDIT50W",
-"SysListView32",
-"EXCEL7",
-"Button",
-# #8944: The Foxit UIA implementation is incomplete and should not be used for now.
-"FoxitDocWnd",
+	"SysTreeView32",
+	"WuDuiListView",
+	"ComboBox",
+	"msctls_progress32",
+	"Edit",
+	"CommonPlacesWrapperWndClass",
+	"SysMonthCal32",
+	"SUPERGRID",  # Outlook 2010 message list
+	"RichEdit",
+	"RichEdit20",
+	"RICHEDIT50W",
+	"SysListView32",
+	"EXCEL7",
+	"Button",
+	# #8944: The Foxit UIA implementation is incomplete and should not be used for now.
+	"FoxitDocWnd",
+	# All Chromium implementations (including Edge) should not be UIA,
+	# As their IA2 implementation is still better at the moment.
+	"Chrome_RenderWidgetHostHWND",
 ]
 
 # #8405: used to detect UIA dialogs prior to Windows 10 RS5.


Test patch:
Repository: nvaccess/nvda

Issue:
Screen curtain cannot be enabled permanently when the warning dialog is disabled
<!--
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:
1. Choose not show a warning dialog when enabling screen curtain.
2. Press twice a keystroke to toggle screen curtain.
3. See the NVDA message announcing that screen curtain has being enabled.
4. Restart NVDA.

### Actual behavior:
Screen curtain is not enabled.

### Expected behavior:
Screen curtain should be enabled (if configuration is set to be saved on exit).

### System configuration
#### NVDA installed/portable/running from source:

Installed, portable or running from source.

#### NVDA version:
2019.3beta2.

#### Windows version:
Windows 10 (tested in several versions).

#### Name and version of other software in use when reproducing the issue:
N/A

#### Other information about your system:
N/A.

### 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.
NVDA 2019.3beta1: screen curtain is properly enabled.



Discussion:

Resolving patch:
diff --git a/source/globalCommands.py b/source/globalCommands.py
--- a/source/globalCommands.py
+++ b/source/globalCommands.py
@@ -2459,7 +2459,9 @@ def _enableScreenCurtain(doEnable: bool = True):
 					enableMessage = _("Temporary Screen curtain, enabled until next restart")
 
 				try:
-					if not alreadyRunning:
+					if alreadyRunning:
+						screenCurtainProviderInfo.providerClass.enableInConfig(True)
+					else:
 						vision.handler.initializeProvider(
 							screenCurtainProviderInfo,
 							temporary=tempEnable,


Test patch:
Repository: nvaccess/nvda

Issue:
Say all on Desktop raises an error
### Steps to reproduce:
1. Focus the desktop.
2. Invoke caret say all

### Actual behavior:
The following error is raised:

```
ERROR - scriptHandler.executeScript (15:54:57.769):
error executing script: <bound method GlobalCommands.script_sayAll of <globalCommands.GlobalCommands object at 0x05875770>> with gesture 'NVDA+a'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 190, in executeScript
  File "globalCommands.pyc", line 1334, in script_sayAll
  File "sayAllHandler.pyc", line 79, in readText
  File "sayAllHandler.pyc", line 119, in nextLine
AttributeError: '_TextReader' object has no attribute 'reader'
ERROR - stderr (15:54:57.779):
Exception ignored in:
ERROR - stderr (15:54:57.790):
<function _TextReader.__del__ at 0x0462F390>
ERROR - stderr (15:54:57.803):
Traceback (most recent call last):
ERROR - stderr (15:54:57.815):
  File "sayAllHandler.pyc", line 213, in __del__
ERROR - stderr (15:54:57.827):
  File "sayAllHandler.pyc", line 206, in stop
ERROR - stderr (15:54:57.839):
AttributeError
ERROR - stderr (15:54:57.851):
:
ERROR - stderr (15:54:57.863):
'_TextReader' object has no attribute 'reader'
```

### Expected behavior:
NO error

### System configuration
#### NVDA installed/portable/running from source:
Installed

#### NVDA version:
threshold-18069

#### Windows version:
Windows 10 1903 build 18362.239



Discussion:
This is a one line fix.

if api.getCaretObject() fails, the reader should be set to None. Then, nextLine will automatically abort. Alternatively, we should raise the error and catch it where we call sayAllhandler, but that differs from the implementation in master.

Resolving patch:
diff --git a/source/sayAllHandler.py b/source/sayAllHandler.py
--- a/source/sayAllHandler.py
+++ b/source/sayAllHandler.py
@@ -76,7 +76,11 @@ def stop(self):
 def readText(cursor):
 	global lastSayAllMode, _activeSayAll
 	lastSayAllMode=cursor
-	reader = _TextReader(cursor)
+	try:
+		reader = _TextReader(cursor)
+	except NotImplementedError:
+		log.debugWarning("Unable to make reader", exc_info=True)
+		return
 	_activeSayAll = weakref.ref(reader)
 	reader.nextLine()
 
@@ -110,8 +114,8 @@ def __init__(self, cursor):
 		if cursor == CURSOR_CARET:
 			try:
 				self.reader = api.getCaretObject().makeTextInfo(textInfos.POSITION_CARET)
-			except (NotImplementedError, RuntimeError):
-				return
+			except (NotImplementedError, RuntimeError) as e:
+				raise NotImplementedError("Unable to make TextInfo: " + str(e))
 		else:
 			self.reader = api.getReviewPosition()
 		self.speakTextInfoState = speech.SpeakTextInfoState(self.reader.obj)


Test patch:
Repository: nvaccess/nvda

Issue:
User Configuration: Delete Surplus Directories
Since we're now using the Scratchpad directory to load app modules and other related data that used to be run directly from NVDA's user configuration directory, there's no longer a need to keep these hanging around. When a user updates their copy of NVDA, could we possibly check these directories, and if completely empty delete the following:

appModules

brailleDisplayDrivers

globalPlugins

synthDrivers

Other folders/files here immediately get created if they don't exist upon launching NVDA, so there's no point in removing anything else other than the above. This suggestion is mainly just to ensure that the configuration directory remains as tidy as possible!


Discussion:
Cc: @feerrenrut

Happy for someone to look into this, it will require thorough testing and good explanation of the testing approach and results to prove the approach is robust.

Resolving patch:
diff --git a/source/config/__init__.py b/source/config/__init__.py
--- a/source/config/__init__.py
+++ b/source/config/__init__.py
@@ -17,6 +17,7 @@
 import ctypes.wintypes
 import os
 import sys
+import errno
 import itertools
 import contextlib
 from copy import deepcopy
@@ -166,6 +167,19 @@ def initConfigPath(configPath=None):
 		configPath=globalVars.appArgs.configPath
 	if not os.path.isdir(configPath):
 		os.makedirs(configPath)
+	else:
+		OLD_CODE_DIRS = ("appModules", "brailleDisplayDrivers", "globalPlugins", "synthDrivers")
+		# #10014: Since #9238 code from these directories is no longer loaded.
+		# However they still exist in config for older installations. Remove them if empty to minimize confusion.
+		for dir in OLD_CODE_DIRS:
+			dir = os.path.join(configPath, dir)
+			if os.path.isdir(dir):
+				try:
+					os.rmdir(dir)
+					log.info("Removed old plugins dir: %s", dir)
+				except OSError as ex:
+					if ex.errno == errno.ENOTEMPTY:
+						log.info("Failed to remove old plugins dir: %s. Directory not empty.", dir)
 	subdirs=["speechDicts","profiles"]
 	if not isAppX:
 		subdirs.append("addons")


Test patch:
Repository: nvaccess/nvda

Issue:
Regression: NVDA exits focus mode when arrowing through list boxes in Vs Code
### Steps to reproduce:

1. In Vs Code insiders (this will probably work in stable as well), do something which causes you to navigate within a list box. I typed ctrl+shift+x to open the extensions view
2. Type any search term and press enter, e.g "vs notes"
3. Press tab to move focus to the list of results, and down arrow to review the result list.

### Actual behavior:

NVDA does not exit focus mode so that the arrow keys work as intended

### Expected behavior:

NVDA exits focus mode and enters browse mode so that the widget can't be used properly.

### System configuration
#### NVDA installed/portable/running from source:
Installed, running from snapshots while I binary searched the version that introduced the regression

#### NVDA version:
Versions since [alpha-19579,47367fb3](https://ci.appveyor.com/project/nvaccess/nvda/build/alpha-19579,47367fb3/artifacts), it looks like this was caused by #10713 

#### Windows version:
Windows 10 1909

#### Name and version of other software in use when reproducing the issue:
Vs code insiders

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your computer?
Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Yes, see above

#### If addons are disabled, is your problem still occuring?
Yes

#### Did you try to run the COM registry fixing tool in NVDA menu / tools?
No


Discussion:

Resolving patch:
diff --git a/source/appModules/code - insiders.py b/source/appModules/code - insiders.py
new file mode 100644
--- /dev/null
+++ b/source/appModules/code - insiders.py	
@@ -0,0 +1,13 @@
+# A part of NonVisual Desktop Access (NVDA)
+# Copyright (C) 2020 NV Access Limited, Babbage B.V., Leonard de Ruijter
+# This file is covered by the GNU General Public License.
+# See the file COPYING for more details.
+
+"""
+appModule for Visual Studio Code Insiders.
+Imports the appModule for Visual Studio Code.
+"""
+
+# Normally these Flake8 errors shouldn't be ignored but here we are simply reusing existing ap module.
+
+from .code import *  # noqa: F401, F403


Test patch:
Repository: nvaccess/nvda

Issue:
NVDA does not reports, when text is unselected in browse mode
### Steps to reproduce:
1. Select some text in browse mode. Can use any document with browse mode.
2. Press any arrow key to cancel the selection.
### Actual behavior:
NVDA reports the character under the virtual cursor, but does not report that the text was unselected.
### Expected behavior:
NVDA should announce that the text was unselected.
### System configuration
#### NVDA installed/portable/running from source:
Installed
#### NVDA version:
2019.3beta3
#### Windows version:
Windows 7 and Windows 10
### 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



Discussion:
Which browser are you using? Can you please try NVDA 2019.2.1 and report the behavior?
I can produce this using alpha-19538,b21a299b and Chrome. This does not occur with NVDA 2019.2.1.
1. Select a line of text using shift+end
2. Press left arrow to move to the previous letter.
Actual: NVDA announces the letter.
Expected: NVDA announces text unselected followed by the letter.
The problem occurs in any application where there is browse mode (Firefox, chrome, Thunderbird etc.). In NVDA 2019.2.1 everything works correctly.

Resolving patch:
diff --git a/source/cursorManager.py b/source/cursorManager.py
--- a/source/cursorManager.py
+++ b/source/cursorManager.py
@@ -145,7 +145,7 @@ def _caretMovementScriptHelper(self,gesture,unit,direction=None,posConstant=text
 		info.expand(unit)
 		if not willSayAllResume(gesture): speech.speakTextInfo(info,unit=unit,reason=controlTypes.REASON_CARET)
 		if not oldInfo.isCollapsed:
-			speech.speakSelectionChange(oldInfo,self.selection)
+			speech.speakSelectionChange(oldInfo, selection)
 		self.selection = selection
 
 	def doFindText(self,text,reverse=False,caseSensitive=False):


Test patch:
Repository: nvaccess/nvda

Issue:
VS Code: Reduce the number of times one has to use NVDA+Space to switch modes.
I just filed [this issue](https://github.com/microsoft/vscode/issues/93087) against VS Code where I suggest to use targeted role="document" in those places that produce HTML output for consumption, to make NVDA switch in and out of browse mode in a smart, automated, manner, reducing the number of times one has to use NVDA+Space to toggle modes. Examples I found while using the 1.44 VS Code Insider builds were:

* The Welcome page
* The details page for an extension
* The ReadMe file that may be displayed after an extension has been installed.

@leonardder suggested that, once this lands in stable, a modification might be needed for the VS Code app module. So filing this issue here.


Discussion:
Added the needs external fix label. As soon as https://github.com/microsoft/vscode/issues/93087 is addressed, we can reconsider the behavior of our appModules.
VS Code insider builds now have the fix for role="document" in some places where they make sense, and more are being added as they're discovered. I think we can reevaluate now whether the VS app module still makes sense. The Insider one can certainly be removed, the other one once VS Code 1.44 gets released.

Resolving patch:
diff --git a/source/appModules/code - insiders.py b/source/appModules/code - insiders.py
deleted file mode 100644
--- a/source/appModules/code - insiders.py	
+++ /dev/null
@@ -1,13 +0,0 @@
-# A part of NonVisual Desktop Access (NVDA)
-# Copyright (C) 2020 NV Access Limited, Babbage B.V., Leonard de Ruijter
-# This file is covered by the GNU General Public License.
-# See the file COPYING for more details.
-
-"""
-appModule for Visual Studio Code Insiders.
-Imports the appModule for Visual Studio Code.
-"""
-
-# Normally these Flake8 errors shouldn't be ignored but here we are simply reusing existing ap module.
-
-from .code import *  # noqa: F401, F403


Test patch: