[BRLTTY] brlapi__write and regionSize

Aura Kelloniemi kaura.dev at sange.fi
Wed Feb 16 00:48:09 EST 2022


Hello,

If I call brlapi__write setting regionSize to -N (a negative interger),
andMask and OrMask to NULL and text to something meaningful, BRLTTY writes
only N characters from the text to the display and clears the rest of the
display. If, on the other hand, I set regionSize to -1 * displaySizeInCells, I
get the desired behaviour of writing as much of the text as possible, or
padding, if necessary.

I have an eery feeling that we did not discuss this properly last spring, when
changes were made to brlapi__write. The current behaviour is a bit odd in my
opinion. I think that truncation and padding should happen within the same
region (either abs(regionSize) or displaySize). But currently truncation
happens within abs(regionSize) and padding within displaySize (if regionSize
is negative). I find this not to be logical. I suggest that we change this in
either of the following three ways:

1) Pad/truncate text to the absolute value of regionSize, and don't clear the
rest of the display. This way regionSize's value imposes a hard limit on the
number of characters written, regardless of it being negative or positive,
which is logical in my opinion.

2) Allow text to be longer than andMask and orMask and pad/truncate to the end
of the display, not to the absolute value of regionSize. This will allow using
brlapi__write to write arbitary length text to the display without first
querying the display size, which reduces the number of redundant display size
requests.

3) Treat negatie values of regionSize as in option 1, but add a special case
for value 0 of regionSize. If regionSize is 0, don't allow andMask or OrMask
to be used. Instead write as much of the text as possible, and pad to the end
of the display, if text is too short. I think this option gives both the
logical behaviour of option 1 and allows for writing arbitrary text without
querying the display size. As discussed before, clients that want to write
text (without knowing its length) most likely don't want to use andMask or
orMask, so this would not limit clients' possibilities.

So I'm for opption three. What do you think?

-- 
Aura


More information about the BRLTTY mailing list