diff --git a/source/appModules/code.py b/source/appModules/code.py index a30fab78369..46ee323a1e1 100644 --- a/source/appModules/code.py +++ b/source/appModules/code.py @@ -1,5 +1,5 @@ # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2020 NV Access Limited, Leonard de Ruijter +# Copyright (C) 2020-2024 NV Access Limited, Leonard de Ruijter, Cary-Rowen # This file is covered by the GNU General Public License. # See the file COPYING for more details. @@ -7,9 +7,9 @@ """ import appModuleHandler +import controlTypes from NVDAObjects.IAccessible.chromium import Document -from NVDAObjects import NVDAObject - +from NVDAObjects import NVDAObject, NVDAObjectTextInfo class VSCodeDocument(Document): """The only content in the root document node of Visual Studio code is the application object. @@ -24,3 +24,12 @@ class AppModule(appModuleHandler.AppModule): def chooseNVDAObjectOverlayClasses(self, obj, clsList): if Document in clsList and obj.IA2Attributes.get("tag") == "#document": clsList.insert(0, VSCodeDocument) + + def event_NVDAObject_init(self, obj: NVDAObject): + # This is a specific fix for Visual Studio Code, + # However, the root cause of the issue is issue #15159. + # Once issue #15159 is fixed, + # The PR #16248 that introduced this code can be immediately reverted. + # (see issue #15159 for full description) + if obj.role != controlTypes.Role.EDITABLETEXT: + obj.TextInfo = NVDAObjectTextInfo diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index 40f524868dc..6d4be4423ff 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -67,6 +67,7 @@ Unicode CLDR has also been updated. * In LibreOffice Writer (version 24.8 and newer), when toggling text formatting (bold, italic, underline, subscript/superscript, alignment) using the corresponding keyboard shortcut, NVDA announces the new formatting attribute (e.g. "Bold on", "Bold off"). (#4248, @michaelweghorn) * When navigating with the cursor keys in text boxes in applications which use UI Automation, NVDA no longer sometimes reports the wrong character, word, etc. (#16711, @jcsteh) * When pasting into the Windows 10/11 Calculator, NVDA now correctly reports the full number pasted. (#16573, @TristanBurchett) +* Support added for text review commands for an object's name in Visual Studio Code. (#16248, @Cary-Rowen) ### Changes for Developers