Repository: nvaccess/nvda

Issue:
NVDA fails to announce cursor movement and character deletion in go to edit field in excel 2010
### Steps to reproduce:
1. Start excel 2010.
2. Press CTRL+g
3. Type b2:b11.
4. try to move with arrow keys or deleting with backspace.
### Actual behavior:
Blank is spoken.
### Expected behavior:
Deleted characters should be announced and characters to which cared moves should be spoken.
### System configuration
#### NVDA installed/portable/running from source:
Installed
#### NVDA version:
NVDA version alpha-16405,19bb21c2

#### Windows version:
Windows 7 x64
#### Name and version of other software in use when reproducing the issue:
Microsoft  Excel 2010  32-bit
#### Other information about your system:
The developer info for this field is as follows.
Developer info for navigator object:
name: u'Odwo\u0142anie:'
role: ROLE_EDITABLETEXT
states: STATE_FOCUSABLE, STATE_FOCUSED
isFocusable: True
hasFocus: True
Python object: <baseObject.Dynamic_IAccessibleUnidentifiedEditWindowNVDAObject object at 0x056734F0>
Python class mro: (<class 'baseObject.Dynamic_IAccessibleUnidentifiedEditWindowNVDAObject'>, <class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.edit.UnidentifiedEdit'>, <class 'NVDAObjects.window.edit.RichEdit'>, <class 'NVDAObjects.window.edit.Edit'>, <class 'NVDAObjects.behaviors.EditableTextWithAutoSelectDetection'>, <class 'NVDAObjects.behaviors.EditableText'>, <class 'editableText.EditableText'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'documentBase.TextContainerObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: None
location: RectLTWH(left=476, top=394, width=261, height=14)
value: None
appModule: <'appModuleHandler' (appName u'excel', process ID 5196) at address 5261370>
appModule.productName: u'Microsoft Office 2010'
appModule.productVersion: u'14.0.7224.5000'
TextInfo: <class 'NVDAObjects.window.edit.EditTextInfo'>
windowHandle: 4588610
windowClassName: u'EDTBX'
windowControlID: 1027
windowStyle: 1409286272
windowThreadID: 5624
windowText: u'b2:b11'
displayText: u'b2:b11'
IAccessibleObject: <POINTER(IAccessible) ptr=0x70bd060 at 548eda0>
IAccessibleChildID: 0
IAccessible event parameters: windowHandle=4588610, objectID=-4, childID=0
IAccessible accName: u'b2:b11'
IAccessible accRole: ROLE_SYSTEM_CLIENT
IAccessible accState: STATE_SYSTEM_FOCUSED, STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048580)
IAccessible accDescription: None
IAccessible accValue: None

### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA?
Yes it is a regression. This is working correctly in NVDA 2018.1 and failing in NVDA 2018.2 and above
cc @michaelDCurran @feerrenrut This is pretty serious for those using Excel 2010, because it fails similarly in many more edit fields. Can this be assigned P2 ad least and fixed asap?


Discussion:
I've bisected it and the results are as follows
874948c70ce8bfc1a52580f1c1d83988e8094e08 is the first bad commit
commit 874948c70ce8bfc1a52580f1c1d83988e8094e08
Author: Leonard de Ruijter <leonardder@users.noreply.github.com>
Date:   Tue May 8 07:41:17 2018 +0200

    Try to use window.edit.Edit when an editable window supports it (#8165)

    * Try to use NVDAObjects.window.edit.Edit when an editable window supports it regardless of window class. Also, try ITextDocument in more cases and remove old pre Windows Vista code

    Inherrit from RichEdit

    * Fixed one case where the movement of EM_CHARFROMPOS to winUser wasn't reflected

:040000 040000 145afb219aac181fbaae5b353094852f08bb419c 1b84e46023fd6a1a68342b3a6c3123447635dc1e M  source

@leonardder can you please look into this? It makes more advanced operations in Excel 2010 pretty frustrating to achieve.
It fails also in Excel 2019. Can this be looked into?

Resolving patch:
diff --git a/source/appModules/excel.py b/source/appModules/excel.py
new file mode 100644
--- /dev/null
+++ b/source/appModules/excel.py
@@ -0,0 +1,21 @@
+# -*- coding: UTF-8 -*-
+# A part of NonVisual Desktop Access (NVDA)
+# Copyright (C) 2018 NV Access Limited, Łukasz Golonka
+# This file may be used under the terms of the GNU General Public License, version 2 or later.
+# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
+
+import appModuleHandler
+from NVDAObjects.window import DisplayModelEditableText
+from NVDAObjects.window.edit import UnidentifiedEdit
+
+class AppModule(appModuleHandler.AppModule):
+
+	def chooseNVDAObjectOverlayClasses(self, obj, clsList):
+		windowClass = obj.windowClassName
+		# #9042: Edit fields in Excel have to be accessed via displayModel.
+		if windowClass == "EDTBX":
+			try:
+				clsList.remove(UnidentifiedEdit)
+			except ValueError:
+				pass
+			clsList.insert(0, DisplayModelEditableText)


Test patch: