[BRLTTY] Clearing display contents with BrlAPI
Aura Kelloniemi
kaura.dev at sange.fi
Tue Dec 8 08:36:21 EST 2020
Hello list,
Dave Mielke <Dave at mielke.cc> writes:
> [quoted lines by Sébastien Hinderer on 2020/12/08 at 10:08 +0100]
> >To clear the display you could use the writeDots method and pass it as
> >many zeros as the display's size.
> The idea, I think, is that the user shouldn't need to know the display's size
> just to clear it.
Absolutely, but I have other points as well:
1) I checked how the C function behaves, and doing brlapi_writeText(0, "")
clears the display. I believe that Python should follow the C API here,
especially because the C API works logically in my opinion.
2) Python's writeText differs from the C method in other important respect: if
I write an empty string, but ask the cursor to be shown on the display, the
curosr placement is completely ignored as well. The C function happily places
the cursor wherever I want, even when the text string is empty.
3) I don't see the coherence of special casing writeText('') as a no-op to
which Sébastien points to. In Python an empty string does not mean a value is
missing, None is used for that. writeText uses (with non-empty strings)
_replace all_, and not _append to previous_ semantics, which perfectly makes
sense.
4) I am not clearing the display intentionally. It just happens that the data
I sometimes want to write happens to be empty. For example, if the user reads
a piece of text, and one of its lines is empty, the normal logic of the
application (i.e. writeText(lines[current]) ) does not work any more. IMO I
shouldn't need to special-case this.
So after all I consider the current writeText behaviour in Python to be a bug
or a misfeature.
--
Aura
More information about the BRLTTY
mailing list