Skip to content

Commit 9eca851

Browse files
authored
Merge pull request #16798 from nvaccess/beta
Merge beta to master
2 parents 8e8f27c + eb452d6 commit 9eca851

4 files changed

Lines changed: 39 additions & 31 deletions

File tree

source/UIAHandler/_remoteOps/remoteTypes/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
TypeVar,
1616
cast
1717
)
18+
from types import NoneType
1819
import ctypes
1920
from ctypes import (
2021
_SimpleCData,
@@ -716,6 +717,8 @@ def _generateInitInstructions(self) -> Iterable[instructions.InstructionBase]:
716717
def getRemoteTypeForLocalType(LocalType: Type[object]) -> Type[RemoteBaseObject]:
717718
if issubclass(LocalType, enum.IntEnum):
718719
return RemoteIntEnum
720+
elif issubclass(LocalType, NoneType):
721+
return RemoteNull
719722
elif issubclass(LocalType, bool):
720723
return RemoteBool
721724
elif issubclass(LocalType, int):

source/UIAHandler/remote.py

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from comtypes import GUID
1414
from comInterfaces import UIAutomationClient as UIA
1515
import winVersion
16+
from logHandler import log
1617
from ._remoteOps import remoteAlgorithms
1718
from ._remoteOps.remoteTypes import (
1819
RemoteExtensionTarget,
@@ -69,40 +70,41 @@ def code(ra: remoteAPI.RemoteAPI):
6970
remoteDocElement = ra.newElement(docElement)
7071
remoteTextRange = ra.newTextRange(textRange)
7172
remoteCustomAttribValue = ra.newVariant()
72-
with ra.ifBlock(remoteDocElement.isExtensionSupported(guid_msWord_extendedTextRangePattern)):
73-
ra.logRuntimeMessage("docElement supports extendedTextRangePattern")
74-
remoteResult = ra.newVariant()
75-
ra.logRuntimeMessage("doing callExtension for extendedTextRangePattern")
76-
remoteDocElement.callExtension(
77-
guid_msWord_extendedTextRangePattern,
78-
remoteResult
79-
)
80-
with ra.ifBlock(remoteResult.isNull()):
81-
ra.logRuntimeMessage("extendedTextRangePattern is null")
82-
ra.halt()
83-
with ra.elseBlock():
84-
ra.logRuntimeMessage("got extendedTextRangePattern")
85-
remoteExtendedTextRangePattern = remoteResult.asType(RemoteExtensionTarget)
86-
with ra.ifBlock(
87-
remoteExtendedTextRangePattern.isExtensionSupported(guid_msWord_getCustomAttributeValue)
88-
):
89-
ra.logRuntimeMessage("extendedTextRangePattern supports getCustomAttributeValue")
90-
ra.logRuntimeMessage("doing callExtension for getCustomAttributeValue")
91-
remoteExtendedTextRangePattern.callExtension(
92-
guid_msWord_getCustomAttributeValue,
93-
remoteTextRange,
94-
customAttribID,
95-
remoteCustomAttribValue
96-
)
97-
ra.logRuntimeMessage("got customAttribValue of ", remoteCustomAttribValue)
98-
ra.Return(remoteCustomAttribValue)
99-
with ra.elseBlock():
100-
ra.logRuntimeMessage("extendedTextRangePattern does not support getCustomAttributeValue")
101-
with ra.elseBlock():
73+
extendedTextRangeIsSupported = remoteDocElement.isExtensionSupported(guid_msWord_extendedTextRangePattern)
74+
with ra.ifBlock(extendedTextRangeIsSupported.inverse()):
10275
ra.logRuntimeMessage("docElement does not support extendedTextRangePattern")
103-
ra.logRuntimeMessage("msWord_getCustomAttributeValue end")
76+
ra.Return(None)
77+
ra.logRuntimeMessage("docElement supports extendedTextRangePattern")
78+
remoteResult = ra.newVariant()
79+
ra.logRuntimeMessage("doing callExtension for extendedTextRangePattern")
80+
remoteDocElement.callExtension(
81+
guid_msWord_extendedTextRangePattern,
82+
remoteResult
83+
)
84+
with ra.ifBlock(remoteResult.isNull()):
85+
ra.logRuntimeMessage("extendedTextRangePattern is null")
86+
ra.Return(None)
87+
ra.logRuntimeMessage("got extendedTextRangePattern")
88+
remoteExtendedTextRangePattern = remoteResult.asType(RemoteExtensionTarget)
89+
customAttributeValueIsSupported = remoteExtendedTextRangePattern.isExtensionSupported(guid_msWord_getCustomAttributeValue)
90+
with ra.ifBlock(customAttributeValueIsSupported.inverse()):
91+
ra.logRuntimeMessage("extendedTextRangePattern does not support getCustomAttributeValue")
92+
ra.Return(None)
93+
ra.logRuntimeMessage("extendedTextRangePattern supports getCustomAttributeValue")
94+
ra.logRuntimeMessage("doing callExtension for getCustomAttributeValue")
95+
remoteExtendedTextRangePattern.callExtension(
96+
guid_msWord_getCustomAttributeValue,
97+
remoteTextRange,
98+
customAttribID,
99+
remoteCustomAttribValue
100+
)
101+
ra.logRuntimeMessage("got customAttribValue of ", remoteCustomAttribValue)
102+
ra.Return(remoteCustomAttribValue)
104103

105104
customAttribValue = op.execute()
105+
if customAttribValue is None:
106+
log.debugWarning("Custom attribute value not available")
107+
return None
106108
return customAttribValue
107109

108110

source/speech/speech.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ def processText(
181181
text = RE_CONVERT_WHITESPACE.sub(" ", text)
182182
if normalize:
183183
text = unicodeNormalize(text)
184+
# keep leading space for normalization message
185+
return text.rstrip()
184186
return text.strip()
185187

186188

user_docs/en/userGuide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,6 +1972,7 @@ Most synthesizers do support it.
19721972

19731973
This option should generally be enabled.
19741974
However, some Microsoft Speech API synthesizers do not implement this correctly and behave strangely when it is enabled.
1975+
Synthesizers from Code Factory, both the add-on and the SAPI application, do not implement it correctly either and cause unwanted spelling of the spoken text (e.g. in NVDA menu or dialogs).
19751976
If you are having problems with the pronunciation of individual characters, try disabling this option.
19761977

19771978
##### Delayed descriptions for characters on cursor movement {#delayedCharacterDescriptions}

0 commit comments

Comments
 (0)