Ignore RuntimeError when moving in word.#7133
Merged
Merged
Conversation
Fix for 7009
michaelDCurran
approved these changes
May 3, 2017
| try: | ||
| info.collapse(end=posUnitEnd) | ||
| except RuntimeError: | ||
| # MS Word has a "virtual linefeed" at the end of the document which can cause RuntimError to be raised. |
Member
There was a problem hiding this comment.
runtimError -> RuntimeError
Contributor
Author
|
Incubated in commit 90941f4656 but the comment refered to the wrong PR. I will apply the labels manually. |
feerrenrut
added a commit
that referenced
this pull request
May 30, 2017
- PR #7169 : Editable div elements in Chrome are no longer have their label reported as their value while in browse mode. (Issue #7153) - PR #6396 : An unbound gesture (script_restart) has been added to allow NVDA to be restarted quickly. (PR #6396) - PR #6777 : A Braille setting has been added to "show messages indefinitely". (Issue #6669) - PR #7133 : Pressing end while in browse mode of an empty Microsoft Word document no longer causes a runtime error. (Issue #7009) - PR #6868 : The keyboard layout can now be set from the NVDA Welcome dialog. (Issue #6863) - PR #6813 : The names of "landmarks" are abbreviated in Braille (Issue #3975)
Collaborator
|
Should we close #7009 now? |
Contributor
Author
|
Opps, I wrote "Fix for..." instead of "Fixes..." I'll close it now. |
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.
Fix for #7009
When opening a blank word document there seems to be a "virtual line-feed" character. The caret can not be moved past this character (I.E. you can not insert after it). It can be selected and copied, but not deleted. It acts as an exclusive end in
textInfoend offset. The exception is thrown when the new end offset is less than the old end offset. When calling collapse (withend=true) on an object that has its end offset set to this "virtual line-feed" character, theendOffsetis reduced by one, since start can not be this final character (since its exclusive).The exception seen in #7009 is used to control the program flow for say-all. Several other options for fixing this have been considered:
Returning an error code:
This would require that all implementations of collapse return appropriate values.
Move the check to the say-all code.
Since say-all seems to be the only thing depending on this functionality (to stop an infinite loop), we could move this check to there. To do this we would be relying on
textInfo.copy()to cache the precollapsevalue, and thentextInfo.compareEndpoints()to see if theendOffsetwas now less. Since there is some concern thatcompareEndpoints()does not behave consistently in all implementations this option is considered too risky.Ignore this exception when moving the caret
This PR proposes handling this (by ignoring the exception) in the
_caretMovementScriptHelperfunction incursorManager.py.