Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions source/NVDAObjects/window/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def _setCaretOffset(self, offset):

def _getStoryText(self):
if controlTypes.State.PROTECTED in self.obj.states:
return "*" * (self._getStoryLength() - 1)
return "*" * self._getStoryLength()
return self.obj.windowText

def _getStoryLength(self):
Expand Down Expand Up @@ -500,18 +500,12 @@ def _getStoryLength(self):
)
finally:
winKernel.virtualFreeEx(processHandle, internalInfo, 0, winKernel.MEM_RELEASE)
# Py3 review: investigation with Python 2 NVDA revealed that
# adding 1 to this creates an off by one error.
# Tested using Wordpad, enforcing EditTextInfo as the textInfo implementation.
return textLen + 1
return textLen
else:
# ForWM_GETTEXTLENGTH documentation, see
# https://docs.microsoft.com/en-us/windows/desktop/winmsg/wm-gettextlength
# It determines the length, in characters, of the text associated with a window.
# Py3 review: investigation with Python 2 NVDA revealed that
# adding 1 to this created an off by one error.
# Tested using Notepad
return watchdog.cancellableSendMessage(self.obj.windowHandle, winUser.WM_GETTEXTLENGTH, 0, 0) + 1
return watchdog.cancellableSendMessage(self.obj.windowHandle, winUser.WM_GETTEXTLENGTH, 0, 0)

def _getLineCount(self):
return self.obj.windowTextLineCount
Expand Down
2 changes: 1 addition & 1 deletion source/textInfos/offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def _calculateUniscribeOffsets(
ctypes.byref(relEnd),
):
relStart = relStart.value
relEnd = min(lineLength, relEnd.value)
relEnd = relEnd.value
if self.encoding != textUtils.WCHAR_ENCODING:
# We need to convert the uniscribe based offsets to str offsets.
relStart, relEnd = offsetConverter.encodedToStrOffsets(relStart, relEnd)
Expand Down
19 changes: 4 additions & 15 deletions tests/system/robot/symbolPronunciationTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,24 +596,13 @@ def test_symbolInSpeechUI():
"""Replace a translation string to include a character that is can be substituted,
check if the 'speech UI' translation string the character substituted.
"""
_notepad.prepareNotepad(
(
"t" # Character doesn't matter, we just want to invoke "Right" speech UI.
),
)
character = "t" # Character doesn't matter, we just want to invoke "Right" speech UI.
_notepad.prepareNotepad(character)
_setConfig(SymLevel.ALL)
spy = _NvdaLib.getSpyLib()
expected = "shouldn't sub tick symbol"
spy.override_translationString(EndSpeech.RIGHT.value, expected)

# get to the end char
actual = _pressKeyAndCollectSpeech(Move.REVIEW_CHAR.value, numberOfTimes=1)
_builtIn.should_be_equal(
actual,
["blank"],
msg="actual vs expected. Unexpected speech when moving to final character.",
)

actual = _pressKeyAndCollectSpeech(Move.REVIEW_CHAR.value, numberOfTimes=1)
_builtIn.should_be_equal(
actual,
Expand All @@ -622,7 +611,7 @@ def test_symbolInSpeechUI():
[
# todo: 'tick' is a bug
"shouldn tick t sub tick symbol" # intentionally concatenate strings
"\nblank",
f"\n{character}",
],
msg="actual vs expected. NVDA speech UI substitutes symbols",
)
Expand All @@ -632,7 +621,7 @@ def test_symbolInSpeechUI():
actual = _pressKeyAndCollectSpeech(Move.REVIEW_CHAR.value, numberOfTimes=1)
_builtIn.should_be_equal(
actual,
[f"{expected}\nblank"],
[f"{expected}\n{character}"],
msg="actual vs expected. NVDA speech UI substitutes symbols",
)

Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ We recommend using Windows 11, or if that is not possible, the latest Windows 10
### Bug Fixes

* When unicode normalization is enabled for speech, navigating by character will again correctly announce combining diacritic characters like acute ( ́ ). (#18722, @LeonarddeR)
* When reporting the location of the caret in classic versions of Notepad and other Win32 edit controls, text position is now more accurate. (#18767, @LeonarddeR)

### Changes for Developers

Expand Down
Loading