[liblouis-liblouisxml] Problem with capital sign and compbrlAtCursor

  • From: James Teh <jamie@xxxxxxxxxxx>
  • To: liblouis/liblouisxml mailing list <liblouis-liblouisxml@xxxxxxxxxxxxx>
  • Date: Mon, 19 Jan 2009 23:13:34 +1000

Hi John,

There is a bug with regard to the capital sign and compbrlAtCursor.

Using en-us-g1.ctb, if you pass the string:
"Aa a"
with compbrlAtCursor and cursorPos set to 0, the result is:
"Aaa"
Observe that the space has been removed. Also, the outputPos array is wrong, indicating a 0 in the position of the space.

I think this might be another case of for_updatePositions() unexpectedly handling computer braille for compbrlAtCursor. This caused similar problems for my patch in 1.3.9.

I don't quite understand where capital signs are inserted, etc. in liblouis. I initially started looking at calls to insertBrailleIndicators(), but I had no luck there. I then notice that after the comment:
/* replacement processing */
there is a check for CTO_UPPERCASE which checks for a capital sign. This calls putCharacter(), which in turn calls for_updatePositions(). I figure that this *could* be the culprit. I guarded this by placing the following just below the case statement:
        case CTO_UpperCase:
          if (mode & compbrlAtCursor && src >= compbrlStart && src <= 
compbrlEnd)
            break;
I've attached a patch for further examination.

This does seem to fix the problem, but I'm not sure if it is the correct solution and I'm concerned it may break something else. Your thoughts and explanations would be greatly appreciated. :) One question in particular is: what is the CTO_UPPERCASE opcode? I assume this isn't quite a direct translation from the tables, given the checking of the capital sign.

--
James Teh
Email/MSN Messenger/Jabber: jamie@xxxxxxxxxxx
Web site: http://www.jantrid.net/
Index: liblouis/lou_translateString.c
===================================================================
--- liblouis/lou_translateString.c      (revision 79)
+++ liblouis/lou_translateString.c      (working copy)
@@ -1851,6 +1851,8 @@
          src++;
          break;
        case CTO_UpperCase:
+         if (mode & compbrlAtCursor && src >= compbrlStart && src <= 
compbrlEnd)
+           break;
          if (transRule->dotslen == 1 && table->capitalSign)
            {
              putCharacter (curCharDef->lowercase);

Other related posts: