From cbf836877b7998c18adc2b04f131c6d9a8a0115a Mon Sep 17 00:00:00 2001 From: James Teh Date: Fri, 1 Feb 2013 09:48:01 +1000 Subject: [PATCH] When using a contracted braille table and expand to computer braille for the word at the cursor is enabled, the braille cursor is now positioned correctly when located after a word wherein a character is represented by multiple braille cells (e.g. capital sign, letter sign, number sign, etc.). Specifically, we no longer rely on the output cursorPos provided by liblouis, instead calculating this based on rawToBraillePos, which is usually accurate. Fixes #2947. --- source/braille.py | 9 ++++++--- user_docs/en/changes.t2t | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/braille.py b/source/braille.py index e9b1560d3..7c4f0806b 100644 --- a/source/braille.py +++ b/source/braille.py @@ -377,9 +377,12 @@ class Region(object): self.brailleCells.append(0) self.brailleToRawPos.append(0) if self.cursorPos is not None: - # HACK: Work around a liblouis bug whereby the returned cursor position is not within the braille cells returned. - if brailleCursorPos >= len(self.brailleCells): - brailleCursorPos = len(self.brailleCells) - 1 + # HACK: The cursorPos returned by liblouis is notoriously buggy (#2947 among other issues). + # rawToBraillePos is usually accurate. + try: + brailleCursorPos = self.rawToBraillePos[self.cursorPos] + except IndexError: + pass else: brailleCursorPos = None self.brailleCursorPos = brailleCursorPos diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index d7b1c0b56..19828dce7 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -43,6 +43,7 @@ - The HumanWare Brailliant BI/B series braille display driver can now be selected when the display is connected via Bluetooth but has never been connected via USB. - Filtering elements in the Browse Mode Elements list with uppercase filter text now returns case-insensitive results just like lowercase rather than nothing at all. (#2951) - In Mozilla browsers, browse mode can again be used when Flash content is focused. (#2546) +- When using a contracted braille table and expand to computer braille for the word at the cursor is enabled, the braille cursor is now positioned correctly when located after a word wherein a character is represented by multiple braille cells (e.g. capital sign, letter sign, number sign, etc.). (#2947) == Changes for Developers == -- 2.11.0