prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  nvda is not reading the result of the accounts in the windows calculator history
  
  ### Steps to reproduce:
  open windows calculator
  do at least two operations
  walk with tabe until nvda advertise
  list, list item
  walk with the arrows below and sign up and see that nvda advertises only list item.
  ### Actual behavior:
  nvda announces only list item
  ### Expected behavior:
  
  the nvda must announce the realized accounts as well as the result of the account.
  this is a regression, I remember using this feature a long time ago and everything worked fine.
  the regression can be from nvda or windows
  ### System configuration
  #### NVDA installed/portable/running from source:
  instaled
  #### NVDA version:
  nvda.exe, NVDA alpha-21386,53cecfd7
  
  
  #### Windows version:
  windows 10 19042.630
  #### Name and version of other software in use when reproducing the issue:
  Calculator.exe, Microsoft.WindowsCalculator 10.2009.4.0
  
  #### 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
  #### 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
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `source/appModules/calculator.py`
  Content:
  ```
  1 # A part of NonVisual Desktop Access (NVDA)
  2 # Copyright (C) 2020-2021 NV Access Limited, Joseph Lee
  3 # This file is covered by the GNU General Public License.
  4 # See the file COPYING for more details.
  5 
  6 """App module for Windows 10 Calculator"""
  7 
  8 import appModuleHandler
  9 import api
  10 from NVDAObjects.UIA import UIA
  11 import queueHandler
  12 import ui
  13 import scriptHandler
  14 import braille
  15 
  16 # #9428: do not announce current values until calculations are done in order to avoid repetitions.
  17 noCalculatorEntryAnnouncements = [
  18 	# Display field with Calculator set to full screen mode.
  19 	"CalculatorResults",
  20 	# In the middle of a calculation expression entry.
  21 	"CalculatorExpression",
  22 	# Results display with Calculator set to compact overlay i.e. always on top mode.
  23 	"CalculatorAlwaysOnTopResults",
  24 	# Calculator expressions with Calculator set to always on top mode.
  25 	"ExpressionContainer",
  26 	# Date range selector.
  27 	"ContentPresenter",
  28 	# Briefly shown when closing date calculation calendar.
  29 	"Light Dismiss",
  30 	# Unit conversion/convert from.
  31 	"Value1",
  32 	# Unit conversion/converts into.
  33 	"Value2",
  34 ]
  35 
  36 
  37 class AppModule(appModuleHandler.AppModule):
  38 
  39 	_shouldAnnounceResult = False
  40 	# Name change says the same thing multiple times for some items.
  41 	_resultsCache = ""
  42 
  43 	def event_nameChange(self, obj, nextHandler):
  44 		if not isinstance(obj, UIA):
  45 			return
  46 		# No, announce value changes immediately except for calculator results and expressions.
  47 		if (
  48 			obj.UIAAutomationId in noCalculatorEntryAnnouncements
  49 			or obj.UIAElement.cachedClassName == "LandmarkTarget"
  50 		):
  51 			self._shouldAnnounceResult = False
  52 		# For the rest:
  53 		elif (
  54 			obj.UIAAutomationId not in noCalculatorEntryAnnouncements
  55 			and obj.name != self._resultsCache
  56 		):
  57 			# For unit conversion, both name change and notification events are fired,
  58 			# although UIA notification event presents much better messages.
  59 			# For date calculation, live region change event is also fired for difference between dates.
  60 			if obj.UIAAutomationId != "DateDiffAllUnitsResultLabel":
  61 				ui.message(obj.name)
  62 			self._resultsCache = obj.name
  63 		if not self._shouldAnnounceResult:
  64 			return
  65 		self._shouldAnnounceResult = False
  66 		nextHandler()
  67 
  68 	def event_UIA_notification(self, obj, nextHandler, displayString=None, activityId=None, **kwargs):
  69 		# #12268: for "DisplayUpdated", announce display strings in braille and move on.
  70 		if activityId == "DisplayUpdated":
  71 			braille.handler.message(displayString)
  72 		try:
  73 			shouldAnnounceNotification = (
  74 				obj.previous.UIAAutomationId in
  75 				("numberPad", "UnitConverterRootGrid")
  76 			)
  77 		except AttributeError:
  78 			resultElement = api.getForegroundObject().children[1].lastChild
  79 			# Redesigned in 2019 due to introduction of "always on top" i.e. compact overlay mode.
  80 			if resultElement.UIAElement.cachedClassName != "LandmarkTarget":
  81 				resultElement = resultElement.parent.children[1]
  82 			shouldAnnounceNotification = (
  83 				resultElement
  84 				and resultElement.firstChild
  85 				and resultElement.firstChild.UIAAutomationId not in noCalculatorEntryAnnouncements
  86 			)
  87 		# Display updated activity ID seen when entering calculations should be ignored
  88 		# as as it is redundant if speak typed characters is on.
  89 		if shouldAnnounceNotification or activityId != "DisplayUpdated":
  90 			nextHandler()
  91 
  92 	# A list of native commands to handle calculator result announcement.
  93 	_calculatorResultGestures = (
  94 		"kb:enter",
  95 		"kb:numpadEnter",
  96 		"kb:escape",
  97 		"kb:delete",
  98 		"kb:numpadDelete"
  99 	)
  100 
  101 	@scriptHandler.script(gestures=_calculatorResultGestures)
  102 	def script_calculatorResult(self, gesture):
  103 		# To prevent double focus announcement, check where we are.
  104 		focus = api.getFocusObject()
  105 		gesture.send()
  106 		# In redstone, calculator result keeps firing name change,
  107 		# so tell it to do so if and only if enter has been pressed.
  108 		self._shouldAnnounceResult = True
  109 		# Hack: only announce display text when an actual calculator button (usually equals button) is pressed.
  110 		# In redstone, pressing enter does not move focus to equals button.
  111 		if isinstance(focus, UIA):
  112 			if focus.UIAAutomationId in ("CalculatorResults", "CalculatorAlwaysOnTopResults"):
  113 				queueHandler.queueFunction(queueHandler.eventQueue, ui.message, focus.name)
  114 			else:
  115 				resultsScreen = api.getForegroundObject().children[1].lastChild
  116 				if isinstance(resultsScreen, UIA) and resultsScreen.UIAElement.cachedClassName == "LandmarkTarget":
  117 					# And no, do not allow focus to move.
  118 					queueHandler.queueFunction(queueHandler.eventQueue, ui.message, resultsScreen.firstChild.name)
  119
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/source/appModules/calculator.py b/source/appModules/calculator.py
  --- a/source/appModules/calculator.py
  +++ b/source/appModules/calculator.py
  @@ -1,5 +1,5 @@
   # A part of NonVisual Desktop Access (NVDA)
  -# Copyright (C) 2020-2021 NV Access Limited, Joseph Lee
  +# Copyright (C) 2020-2022 NV Access Limited, Joseph Lee
   # This file is covered by the GNU General Public License.
   # See the file COPYING for more details.
   
  @@ -40,6 +40,15 @@
   	# Name change says the same thing multiple times for some items.
   	_resultsCache = ""
   
  +	def event_NVDAObject_init(self, obj):
  +		if not isinstance(obj, UIA):
  +			return
  +		# #11858: version 10.2009 introduces a regression where history and memory items have no names
  +		# but can be fetched through its children.
  +		# Resolved in version 10.2109 which is exclusive to Windows 11.
  +		if not obj.name and obj.parent.UIAAutomationId in ("HistoryListView", "MemoryListView"):
  +			obj.name = "".join([item.name for item in obj.children])
  +
   	def event_nameChange(self, obj, nextHandler):
   		if not isinstance(obj, UIA):
   			return
  
verification_info: {"golden_diff": "diff --git a/source/appModules/calculator.py b/source/appModules/calculator.py\n--- a/source/appModules/calculator.py\n+++ b/source/appModules/calculator.py\n@@ -1,5 +1,5 @@\n # A part of NonVisual Desktop Access (NVDA)\n-# Copyright (C) 2020-2021 NV Access Limited, Joseph Lee\n+# Copyright (C) 2020-2022 NV Access Limited, Joseph Lee\n # This file is covered by the GNU General Public License.\n # See the file COPYING for more details.\n \n@@ -40,6 +40,15 @@\n \t# Name change says the same thing multiple times for some items.\n \t_resultsCache = \"\"\n \n+\tdef event_NVDAObject_init(self, obj):\n+\t\tif not isinstance(obj, UIA):\n+\t\t\treturn\n+\t\t# #11858: version 10.2009 introduces a regression where history and memory items have no names\n+\t\t# but can be fetched through its children.\n+\t\t# Resolved in version 10.2109 which is exclusive to Windows 11.\n+\t\tif not obj.name and obj.parent.UIAAutomationId in (\"HistoryListView\", \"MemoryListView\"):\n+\t\t\tobj.name = \"\".join([item.name for item in obj.children])\n+\n \tdef event_nameChange(self, obj, nextHandler):\n \t\tif not isinstance(obj, UIA):\n \t\t\treturn\n", "issue": "nvda is not reading the result of the accounts in the windows calculator history\n\r\n### Steps to reproduce:\r\nopen windows calculator\r\ndo at least two operations\r\nwalk with tabe until nvda advertise\r\nlist, list item\r\nwalk with the arrows below and sign up and see that nvda advertises only list item.\r\n### Actual behavior:\r\nnvda announces only list item\r\n### Expected behavior:\r\n\r\nthe nvda must announce the realized accounts as well as the result of the account.\r\nthis is a regression, I remember using this feature a long time ago and everything worked fine.\r\nthe regression can be from nvda or windows\r\n### System configuration\r\n#### NVDA installed/portable/running from source:\r\ninstaled\r\n#### NVDA version:\r\nnvda.exe, NVDA alpha-21386,53cecfd7\r\n\r\n\r\n#### Windows version:\r\nwindows 10 19042.630\r\n#### Name and version of other software in use when reproducing the issue:\r\nCalculator.exe, Microsoft.WindowsCalculator 10.2009.4.0\r\n\r\n#### Other information about your system:\r\n\r\n### Other questions\r\n#### Does the issue still occur after restarting your computer?\r\nyes\r\n#### Have you tried any other versions of NVDA? If so, please report their behaviors.\r\nyes\r\n#### If addons are disabled, is your problem still occuring?\r\nyes\r\n#### Did you try to run the COM registry fixing tool in NVDA menu / tools?\r\nno\n", "before_files": [{"content": "# A part of NonVisual Desktop Access (NVDA)\n# Copyright (C) 2020-2021 NV Access Limited, Joseph Lee\n# This file is covered by the GNU General Public License.\n# See the file COPYING for more details.\n\n\"\"\"App module for Windows 10 Calculator\"\"\"\n\nimport appModuleHandler\nimport api\nfrom NVDAObjects.UIA import UIA\nimport queueHandler\nimport ui\nimport scriptHandler\nimport braille\n\n# #9428: do not announce current values until calculations are done in order to avoid repetitions.\nnoCalculatorEntryAnnouncements = [\n\t# Display field with Calculator set to full screen mode.\n\t\"CalculatorResults\",\n\t# In the middle of a calculation expression entry.\n\t\"CalculatorExpression\",\n\t# Results display with Calculator set to compact overlay i.e. always on top mode.\n\t\"CalculatorAlwaysOnTopResults\",\n\t# Calculator expressions with Calculator set to always on top mode.\n\t\"ExpressionContainer\",\n\t# Date range selector.\n\t\"ContentPresenter\",\n\t# Briefly shown when closing date calculation calendar.\n\t\"Light Dismiss\",\n\t# Unit conversion/convert from.\n\t\"Value1\",\n\t# Unit conversion/converts into.\n\t\"Value2\",\n]\n\n\nclass AppModule(appModuleHandler.AppModule):\n\n\t_shouldAnnounceResult = False\n\t# Name change says the same thing multiple times for some items.\n\t_resultsCache = \"\"\n\n\tdef event_nameChange(self, obj, nextHandler):\n\t\tif not isinstance(obj, UIA):\n\t\t\treturn\n\t\t# No, announce value changes immediately except for calculator results and expressions.\n\t\tif (\n\t\t\tobj.UIAAutomationId in noCalculatorEntryAnnouncements\n\t\t\tor obj.UIAElement.cachedClassName == \"LandmarkTarget\"\n\t\t):\n\t\t\tself._shouldAnnounceResult = False\n\t\t# For the rest:\n\t\telif (\n\t\t\tobj.UIAAutomationId not in noCalculatorEntryAnnouncements\n\t\t\tand obj.name != self._resultsCache\n\t\t):\n\t\t\t# For unit conversion, both name change and notification events are fired,\n\t\t\t# although UIA notification event presents much better messages.\n\t\t\t# For date calculation, live region change event is also fired for difference between dates.\n\t\t\tif obj.UIAAutomationId != \"DateDiffAllUnitsResultLabel\":\n\t\t\t\tui.message(obj.name)\n\t\t\tself._resultsCache = obj.name\n\t\tif not self._shouldAnnounceResult:\n\t\t\treturn\n\t\tself._shouldAnnounceResult = False\n\t\tnextHandler()\n\n\tdef event_UIA_notification(self, obj, nextHandler, displayString=None, activityId=None, **kwargs):\n\t\t# #12268: for \"DisplayUpdated\", announce display strings in braille and move on.\n\t\tif activityId == \"DisplayUpdated\":\n\t\t\tbraille.handler.message(displayString)\n\t\ttry:\n\t\t\tshouldAnnounceNotification = (\n\t\t\t\tobj.previous.UIAAutomationId in\n\t\t\t\t(\"numberPad\", \"UnitConverterRootGrid\")\n\t\t\t)\n\t\texcept AttributeError:\n\t\t\tresultElement = api.getForegroundObject().children[1].lastChild\n\t\t\t# Redesigned in 2019 due to introduction of \"always on top\" i.e. compact overlay mode.\n\t\t\tif resultElement.UIAElement.cachedClassName != \"LandmarkTarget\":\n\t\t\t\tresultElement = resultElement.parent.children[1]\n\t\t\tshouldAnnounceNotification = (\n\t\t\t\tresultElement\n\t\t\t\tand resultElement.firstChild\n\t\t\t\tand resultElement.firstChild.UIAAutomationId not in noCalculatorEntryAnnouncements\n\t\t\t)\n\t\t# Display updated activity ID seen when entering calculations should be ignored\n\t\t# as as it is redundant if speak typed characters is on.\n\t\tif shouldAnnounceNotification or activityId != \"DisplayUpdated\":\n\t\t\tnextHandler()\n\n\t# A list of native commands to handle calculator result announcement.\n\t_calculatorResultGestures = (\n\t\t\"kb:enter\",\n\t\t\"kb:numpadEnter\",\n\t\t\"kb:escape\",\n\t\t\"kb:delete\",\n\t\t\"kb:numpadDelete\"\n\t)\n\n\t@scriptHandler.script(gestures=_calculatorResultGestures)\n\tdef script_calculatorResult(self, gesture):\n\t\t# To prevent double focus announcement, check where we are.\n\t\tfocus = api.getFocusObject()\n\t\tgesture.send()\n\t\t# In redstone, calculator result keeps firing name change,\n\t\t# so tell it to do so if and only if enter has been pressed.\n\t\tself._shouldAnnounceResult = True\n\t\t# Hack: only announce display text when an actual calculator button (usually equals button) is pressed.\n\t\t# In redstone, pressing enter does not move focus to equals button.\n\t\tif isinstance(focus, UIA):\n\t\t\tif focus.UIAAutomationId in (\"CalculatorResults\", \"CalculatorAlwaysOnTopResults\"):\n\t\t\t\tqueueHandler.queueFunction(queueHandler.eventQueue, ui.message, focus.name)\n\t\t\telse:\n\t\t\t\tresultsScreen = api.getForegroundObject().children[1].lastChild\n\t\t\t\tif isinstance(resultsScreen, UIA) and resultsScreen.UIAElement.cachedClassName == \"LandmarkTarget\":\n\t\t\t\t\t# And no, do not allow focus to move.\n\t\t\t\t\tqueueHandler.queueFunction(queueHandler.eventQueue, ui.message, resultsScreen.firstChild.name)\n", "path": "source/appModules/calculator.py"}], "after_files": [{"content": "# A part of NonVisual Desktop Access (NVDA)\n# Copyright (C) 2020-2022 NV Access Limited, Joseph Lee\n# This file is covered by the GNU General Public License.\n# See the file COPYING for more details.\n\n\"\"\"App module for Windows 10 Calculator\"\"\"\n\nimport appModuleHandler\nimport api\nfrom NVDAObjects.UIA import UIA\nimport queueHandler\nimport ui\nimport scriptHandler\nimport braille\n\n# #9428: do not announce current values until calculations are done in order to avoid repetitions.\nnoCalculatorEntryAnnouncements = [\n\t# Display field with Calculator set to full screen mode.\n\t\"CalculatorResults\",\n\t# In the middle of a calculation expression entry.\n\t\"CalculatorExpression\",\n\t# Results display with Calculator set to compact overlay i.e. always on top mode.\n\t\"CalculatorAlwaysOnTopResults\",\n\t# Calculator expressions with Calculator set to always on top mode.\n\t\"ExpressionContainer\",\n\t# Date range selector.\n\t\"ContentPresenter\",\n\t# Briefly shown when closing date calculation calendar.\n\t\"Light Dismiss\",\n\t# Unit conversion/convert from.\n\t\"Value1\",\n\t# Unit conversion/converts into.\n\t\"Value2\",\n]\n\n\nclass AppModule(appModuleHandler.AppModule):\n\n\t_shouldAnnounceResult = False\n\t# Name change says the same thing multiple times for some items.\n\t_resultsCache = \"\"\n\n\tdef event_NVDAObject_init(self, obj):\n\t\tif not isinstance(obj, UIA):\n\t\t\treturn\n\t\t# #11858: version 10.2009 introduces a regression where history and memory items have no names\n\t\t# but can be fetched through its children.\n\t\t# Resolved in version 10.2109 which is exclusive to Windows 11.\n\t\tif not obj.name and obj.parent.UIAAutomationId in (\"HistoryListView\", \"MemoryListView\"):\n\t\t\tobj.name = \"\".join([item.name for item in obj.children])\n\n\tdef event_nameChange(self, obj, nextHandler):\n\t\tif not isinstance(obj, UIA):\n\t\t\treturn\n\t\t# No, announce value changes immediately except for calculator results and expressions.\n\t\tif (\n\t\t\tobj.UIAAutomationId in noCalculatorEntryAnnouncements\n\t\t\tor obj.UIAElement.cachedClassName == \"LandmarkTarget\"\n\t\t):\n\t\t\tself._shouldAnnounceResult = False\n\t\t# For the rest:\n\t\telif (\n\t\t\tobj.UIAAutomationId not in noCalculatorEntryAnnouncements\n\t\t\tand obj.name != self._resultsCache\n\t\t):\n\t\t\t# For unit conversion, both name change and notification events are fired,\n\t\t\t# although UIA notification event presents much better messages.\n\t\t\t# For date calculation, live region change event is also fired for difference between dates.\n\t\t\tif obj.UIAAutomationId != \"DateDiffAllUnitsResultLabel\":\n\t\t\t\tui.message(obj.name)\n\t\t\tself._resultsCache = obj.name\n\t\tif not self._shouldAnnounceResult:\n\t\t\treturn\n\t\tself._shouldAnnounceResult = False\n\t\tnextHandler()\n\n\tdef event_UIA_notification(self, obj, nextHandler, displayString=None, activityId=None, **kwargs):\n\t\t# #12268: for \"DisplayUpdated\", announce display strings in braille and move on.\n\t\tif activityId == \"DisplayUpdated\":\n\t\t\tbraille.handler.message(displayString)\n\t\ttry:\n\t\t\tshouldAnnounceNotification = (\n\t\t\t\tobj.previous.UIAAutomationId in\n\t\t\t\t(\"numberPad\", \"UnitConverterRootGrid\")\n\t\t\t)\n\t\texcept AttributeError:\n\t\t\tresultElement = api.getForegroundObject().children[1].lastChild\n\t\t\t# Redesigned in 2019 due to introduction of \"always on top\" i.e. compact overlay mode.\n\t\t\tif resultElement.UIAElement.cachedClassName != \"LandmarkTarget\":\n\t\t\t\tresultElement = resultElement.parent.children[1]\n\t\t\tshouldAnnounceNotification = (\n\t\t\t\tresultElement\n\t\t\t\tand resultElement.firstChild\n\t\t\t\tand resultElement.firstChild.UIAAutomationId not in noCalculatorEntryAnnouncements\n\t\t\t)\n\t\t# Display updated activity ID seen when entering calculations should be ignored\n\t\t# as as it is redundant if speak typed characters is on.\n\t\tif shouldAnnounceNotification or activityId != \"DisplayUpdated\":\n\t\t\tnextHandler()\n\n\t# A list of native commands to handle calculator result announcement.\n\t_calculatorResultGestures = (\n\t\t\"kb:enter\",\n\t\t\"kb:numpadEnter\",\n\t\t\"kb:escape\",\n\t\t\"kb:delete\",\n\t\t\"kb:numpadDelete\"\n\t)\n\n\t@scriptHandler.script(gestures=_calculatorResultGestures)\n\tdef script_calculatorResult(self, gesture):\n\t\t# To prevent double focus announcement, check where we are.\n\t\tfocus = api.getFocusObject()\n\t\tgesture.send()\n\t\t# In redstone, calculator result keeps firing name change,\n\t\t# so tell it to do so if and only if enter has been pressed.\n\t\tself._shouldAnnounceResult = True\n\t\t# Hack: only announce display text when an actual calculator button (usually equals button) is pressed.\n\t\t# In redstone, pressing enter does not move focus to equals button.\n\t\tif isinstance(focus, UIA):\n\t\t\tif focus.UIAAutomationId in (\"CalculatorResults\", \"CalculatorAlwaysOnTopResults\"):\n\t\t\t\tqueueHandler.queueFunction(queueHandler.eventQueue, ui.message, focus.name)\n\t\t\telse:\n\t\t\t\tresultsScreen = api.getForegroundObject().children[1].lastChild\n\t\t\t\tif isinstance(resultsScreen, UIA) and resultsScreen.UIAElement.cachedClassName == \"LandmarkTarget\":\n\t\t\t\t\t# And no, do not allow focus to move.\n\t\t\t\t\tqueueHandler.queueFunction(queueHandler.eventQueue, ui.message, resultsScreen.firstChild.name)\n", "path": "source/appModules/calculator.py"}]}