[BRLTTY] Adding a dot display to tt driver
Dave Mielke
dave at mielke.cc
Sun Sep 18 08:47:33 EDT 2016
[quoted lines by Christoph-Simon Senjak on 2016/09/18 at 14:06 +0200]
>Ok, I found a problem: I compiled it without ncurses support
>originally (because you have to give ncurses as explicit dependency
>in your nix-shell) and it worked.
>
>With ncurses support, only the dot display is shown, and I think I
>have located the problem: [1] says that Newline does a clrtoeol,
>which deletes the current line. So addstr("\r\n") will set the cursor
>to the beginning of the current line and then delete it. Replacing it
>with just "\n" will make it work for me, but I am not sure how that
>will be when no ncurses is available.
Please test the attached patch (tty-newline-1.patch) with and without ncurses.
--
Dave Mielke | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario | http://Mielke.cc/bible/
EMail: Dave at Mielke.cc | Canada K2A 1H7 | http://FamilyRadio.org/
-------------- next part --------------
diff --git a/Drivers/Braille/TTY/braille.c b/Drivers/Braille/TTY/braille.c
index a8c3317..2230199 100644
--- a/Drivers/Braille/TTY/braille.c
+++ b/Drivers/Braille/TTY/braille.c
@@ -39,10 +39,13 @@ static iconv_t conversionDescriptor = NULL;
#include "unicode.h"
#include "get_curses.h"
-#ifndef GOT_CURSES
+#ifdef GOT_CURSES
+#define newline() addstr("\n")
+#else /* GOT_CURSES */
#define addstr(string) serialWriteData(ttyDevice, string, strlen(string))
#define addch(character) do { unsigned char __c = (character); serialWriteData(ttyDevice, &__c, 1); } while(0)
#define getch() my_getch()
+#define newline() addstr("\r\n")
#endif /* GOT_CURSES */
#ifdef GOT_CURSES
@@ -286,7 +289,7 @@ brl_writeWindow (BrailleDisplay *brl, const wchar_t *text) {
#ifdef GOT_CURSES
clear();
#else /* GOT_CURSES */
- addstr("\r\n");
+ newline();
#endif /* GOT_CURSES */
{
@@ -310,11 +313,11 @@ brl_writeWindow (BrailleDisplay *brl, const wchar_t *text) {
;
}
- addstr("\r\n");
+ newline();
writeText(braille, brl->textColumns);
if (row < (brl->textRows - 1)) {
- addstr("\r\n");
+ newline();
}
}
}
@@ -332,7 +335,7 @@ brl_writeWindow (BrailleDisplay *brl, const wchar_t *text) {
addch('\r');
writeText(text, brl->cursor);
} else {
- addstr("\r\n");
+ newline();
}
#endif /* GOT_CURSES */
More information about the BRLTTY
mailing list