Skip to content

Commit

Permalink
MSHTML NVDAObject's event_caret: its posible for makeTextInfo positio…
Browse files Browse the repository at this point in the history
…n_caret to raise RuntimeError if the object the event is for is not really the MSHTML selection (i.e. caret moves but the focus is not actually on the selected object). Just return early if this happens
  • Loading branch information
michaelDCurran committed Jun 30, 2011
1 parent 299a82a commit 79d52c9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/NVDAObjects/IAccessible/MSHTML.py
Expand Up @@ -311,8 +311,11 @@ def event_caret(self):
if self._ignoreCaretEvents: return
if self.TextInfo is not MSHTMLTextInfo:
return
newCaretBookmark=self.makeTextInfo(textInfos.POSITION_CARET).bookmark
if newCaretBookmark==getattr(self,'_oldCaretBookmark',None):
try:
newCaretBookmark=self.makeTextInfo(textInfos.POSITION_CARET).bookmark
except RuntimeError: #caret events can be fired on the object (focus) when its not the real MSHTML selection
newCaretBookmark=None
if not newCaretBookmark or newCaretBookmark==getattr(self,'_oldCaretBookmark',None):
return
self._oldCaretBookmark=newCaretBookmark
return super(MSHTML,self).event_caret()
Expand Down

0 comments on commit 79d52c9

Please sign in to comment.