Repository navigation
PowerPoint: fix errors when reading text formatting and hyperlinks - #21007
Closed
ChristosBouronikos wants to merge 1 commit into
Closed
ChristosBouronikos wants to merge 1 commit into
ChristosBouronikos wants to merge 1 commit into
Conversation
_getFormatFieldAndOffsets passed the text info itself to _getCurrentRun instead of the character offset, so looking up the formatting run failed with a TypeError. The fallback range for a missing run covered the rest of the story rather than one character, _getPptTextRange built a ValueError with an unsupported keyword argument, and the hyperlink lookup referenced _LinkData through textInfos, where it does not exist, and did not handle a missing run.
ChristosBouronikos
marked this pull request as ready for review
October 16, 2026 08:30
ChristosBouronikos
requested review from
seanbudd
and
a balanced review from Copilot
October 16, 2026 08:30
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
None. These are coding errors in
appModules/powerpnt.py, found while reviewing the PowerPoint app module.Summary of the issue:
Several code paths in the PowerPoint text frame text info cannot work as written:
_getFormatFieldAndOffsetscalls_getCurrentRun(self), passing the text info where a character offset is expected. Finding the formatting run for a position therefore raises aTypeErrorinstead of returning a run.characters(offset + 1)has no length, so it covers the rest of the story instead of the single character at the offset._getPptTextRangeraisesValueError(..., stack_info=True).ValueErrordoes not accept keyword arguments, so the intendedValueErroris replaced by aTypeError._getLinkDataAtCaretPositionbuilds the result withtextInfos._LinkData, which does not exist (the class is imported fromutils.urlUtils), and it dereferences the formatting run without checking whether one was found.Description of user facing changes:
In Microsoft PowerPoint, formatting information and the link at the caret can be reported without NVDA raising an error.
Description of developer facing changes:
None.
Description of development approach:
_getCurrentRun, and request a single character when falling back tocharacters().ValueError. The message already contains the start and end values._LinkDataand returnNonewhen there is no formatting run at the caret.Testing strategy:
tests/unit/test_appModules/test_powerpnt_textFrame.py. The tests cover finding the run from an offset, the single-character fallback, theValueError, a link lookup without a run, and a link lookup that returns the shared_LinkDatatype. Without the change, every test fails.Known issues with pull request:
None known. The change log entry is deliberately generic because there is no issue to reference.
Code Review Checklist: