diff --git a/ChangeLog b/ChangeLog index 5f3983eb..9efdd8d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ on the FreeBSD console for the accelerator key access (Console switching is still possible with Ctrl-Alt-F1 through Ctrl-Alt-F8) + * Avoid non-printable ASCII codes < 0x1c on a FreeBSD console 2017-03-30 Markus Gans * Fixed bug: termcap "me" does not reset diff --git a/src/fterm.cpp b/src/fterm.cpp index 9a3cdeda..a64854c8 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1625,6 +1625,21 @@ void FTerm::initLinuxConsoleCharMap() } #endif +#if defined(BSD) +//---------------------------------------------------------------------- +void FTerm::initBSDConsoleCharMap() +{ + // A FreeBSD console can't show ASCII codes from 0x00 to 0x1b + + if ( ! isBSDConsole() ) + return; + + for (int i=0; i <= lastCharItem; i++ ) + if ( character[i][fc::PC] < 0x1c ) + character[i][fc::PC] = character[i][fc::ASCII]; +} +#endif + //---------------------------------------------------------------------- bool FTerm::charEncodable (uInt c) { @@ -2749,22 +2764,29 @@ void FTerm::init_termcaps() status = tgetent(term_buffer, termtype); } + if ( status != success && color256 ) + { + // use "xterm-256color" as fallback if not found + std::strncpy (termtype, const_cast("xterm-256color"), 15); + status = tgetent(term_buffer, termtype); + } + if ( status != success ) { - // use xterm as fallback if not found + // use "xterm" as fallback if not found std::strncpy (termtype, const_cast("xterm"), 6); status = tgetent(term_buffer, termtype); if ( status != success ) { - // use ansi as fallback if not found + // use "ansi" as fallback if not found std::strncpy (termtype, const_cast("ansi"), 5); status = tgetent(term_buffer, termtype); ansi_terminal = true; if ( status != success ) { - // use vt100 as fallback if not found + // use "vt100" as fallback if not found std::strncpy (termtype, const_cast("vt100"), 6); status = tgetent(term_buffer, termtype); ansi_terminal = false; diff --git a/src/fterm.h b/src/fterm.h index f3e50fff..98bc4d0e 100644 --- a/src/fterm.h +++ b/src/fterm.h @@ -257,6 +257,10 @@ class FTerm static void initLinuxConsoleCharMap(); #endif +#if defined(BSD) + static void initBSDConsoleCharMap(); +#endif + static bool charEncodable (uInt); static uInt charEncode (uInt); static uInt charEncode (uInt, fc::encoding); diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 476791b8..f0cbf676 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -1163,6 +1163,10 @@ void FWidget::show() initLinuxConsoleCharMap(); #endif +#if defined(BSD) + initBSDConsoleCharMap(); +#endif + // set xterm underline cursor setXTermCursorStyle(fc::blinking_underline);