Implemented fix for failed cursor iteration (#729)

A long time ago, I identified this failure but wasn't sure why it was
failing. I still don't know why, but the emergency fix at least prevents
other people from running into it. As a bonus, since we have a proper
logging facility now, we can actually log it as I desired to do back
then!

This commit tentatively fixes issue 729.
This commit is contained in:
Jan Wester 2021-07-10 18:21:07 +02:00
parent 32caf6aa04
commit d6e472b939

View file

@ -500,7 +500,10 @@ class MDEditView(textEditView):
r3.setLeft(self.viewport().geometry().left())
r3.setRight(self.viewport().geometry().right())
refs.append(ClickThing(r3, rx, rx.capturedTexts()))
cursor.movePosition(cursor.Down)
if not cursor.movePosition(cursor.Down):
# Super-rare failure. Leaving log message for future investigation.
LOGGER.debug("Failed to move cursor down while calculating clickables. Aborting.")
break
self.clickRects = refs