Avoid non-printable ASCII codes < 0x1c on FreeBSD

This commit is contained in:
Markus Gans 2017-04-02 21:32:48 +02:00
parent 09eb75c14b
commit 8de22dc903
4 changed files with 34 additions and 3 deletions

View File

@ -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 <guru.mail@muenster.de>
* Fixed bug: termcap "me" does not reset

View File

@ -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<char*>("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<char*>("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<char*>("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<char*>("vt100"), 6);
status = tgetent(term_buffer, termtype);
ansi_terminal = false;

View File

@ -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);

View File

@ -1163,6 +1163,10 @@ void FWidget::show()
initLinuxConsoleCharMap();
#endif
#if defined(BSD)
initBSDConsoleCharMap();
#endif
// set xterm underline cursor
setXTermCursorStyle(fc::blinking_underline);