macOS build fix

This commit is contained in:
Markus Gans 2020-04-25 02:32:33 +02:00
parent 2b1774e578
commit 159d086af4
29 changed files with 2132 additions and 1948 deletions

View File

@ -49,9 +49,9 @@ AC_CHECK_FUNCS( \
vsnprintf ) vsnprintf )
# Checks for 'tgetent' # Checks for 'tgetent'
AC_SEARCH_LIBS([tgetent], [termcap tinfo curses ncurses]) AC_SEARCH_LIBS([tgetent], [terminfo mytinfo termlib termcap tinfo ncurses curses])
# Checks for 'tparm' # Checks for 'tparm'
AC_SEARCH_LIBS([tparm], [termcap tinfo curses ncurses]) AC_SEARCH_LIBS([tparm], [terminfo mytinfo termlib termcap tinfo ncurses curses])
# Checks for libtool # Checks for libtool
AC_ENABLE_SHARED AC_ENABLE_SHARED

View File

@ -172,6 +172,7 @@ class Calc final : public finalcut::FDialog
// Methods // Methods
void drawDispay(); void drawDispay();
void draw() override; void draw() override;
void sendOnButtonAccelerator();
void clear (const lDouble&); void clear (const lDouble&);
void zero (const lDouble&); void zero (const lDouble&);
void one (const lDouble&); void one (const lDouble&);
@ -341,11 +342,7 @@ void Calc::onKeyPress (finalcut::FKeyEvent* ev)
case fc::Fkey_escape: case fc::Fkey_escape:
case fc::Fkey_escape_mintty: case fc::Fkey_escape_mintty:
{ sendOnButtonAccelerator();
finalcut::FAccelEvent a_ev( fc::Accelerator_Event
, getFocusWidget() );
calculator_buttons[On]->onAccel(&a_ev);
}
ev->accept(); ev->accept();
break; break;
@ -466,6 +463,13 @@ void Calc::drawDispay()
} }
} }
//----------------------------------------------------------------------
void Calc::sendOnButtonAccelerator()
{
finalcut::FAccelEvent a_ev(fc::Accelerator_Event, getFocusWidget());
calculator_buttons[On]->onAccel(&a_ev);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Calc::clear (const lDouble&) void Calc::clear (const lDouble&)
{ {

View File

@ -36,6 +36,10 @@ using finalcut::FSize;
sInt64 StringToNumber (const finalcut::FString&); sInt64 StringToNumber (const finalcut::FString&);
bool sortAscending (const finalcut::FObject*, const finalcut::FObject*); bool sortAscending (const finalcut::FObject*, const finalcut::FObject*);
bool sortDescending (const finalcut::FObject*, const finalcut::FObject*); bool sortDescending (const finalcut::FObject*, const finalcut::FObject*);
bool isLessThanInteger (const finalcut::FString&, const finalcut::FString&);
bool isLessThanDouble (const finalcut::FString&, const finalcut::FString&);
bool isGreaterThanInteger (const finalcut::FString&, const finalcut::FString&);
bool isGreaterThanDouble (const finalcut::FString&, const finalcut::FString&);
// non-member functions // non-member functions
@ -50,6 +54,44 @@ sInt64 StringToNumber (const finalcut::FString& str)
return number; return number;
} }
//----------------------------------------------------------------------
bool isLessThanInteger ( const finalcut::FString& lhs
, const finalcut::FString& rhs )
{
const sInt64 l_number = StringToNumber(lhs);
const sInt64 r_number = StringToNumber(rhs);
return bool( l_number < r_number ); // lhs < rhs
}
//----------------------------------------------------------------------
bool isLessThanDouble ( const finalcut::FString& lhs
, const finalcut::FString& rhs )
{
std::setlocale(LC_NUMERIC, "C");
const double l_number = lhs.toDouble();
const double r_number = rhs.toDouble();
return bool( l_number < r_number ); // lhs < rhs
}
//----------------------------------------------------------------------
bool isGreaterThanInteger ( const finalcut::FString& lhs
, const finalcut::FString& rhs )
{
const sInt64 l_number = StringToNumber(lhs);
const sInt64 r_number = StringToNumber(rhs);
return bool( l_number > r_number ); // lhs > rhs
}
//----------------------------------------------------------------------
bool isGreaterThanDouble ( const finalcut::FString& lhs
, const finalcut::FString& rhs )
{
std::setlocale(LC_NUMERIC, "C");
const double l_number = lhs.toDouble();
const double r_number = rhs.toDouble();
return bool( l_number > r_number ); // lhs > rhs
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool sortAscending ( const finalcut::FObject* lhs bool sortAscending ( const finalcut::FObject* lhs
, const finalcut::FObject* rhs ) , const finalcut::FObject* rhs )
@ -57,26 +99,16 @@ bool sortAscending ( const finalcut::FObject* lhs
const auto& l_item = static_cast<const finalcut::FListViewItem*>(lhs); const auto& l_item = static_cast<const finalcut::FListViewItem*>(lhs);
const auto& r_item = static_cast<const finalcut::FListViewItem*>(rhs); const auto& r_item = static_cast<const finalcut::FListViewItem*>(rhs);
const int column = l_item->getSortColumn(); const int column = l_item->getSortColumn();
const auto& l_str = l_item->getText(column);
const auto& r_str = r_item->getText(column);
switch ( column ) if ( column == 2 )
{ {
case 2: return isGreaterThanInteger(l_str, r_str);
{ }
const sInt64 l_number = StringToNumber(l_item->getText(column)); else if ( column == 3 )
const sInt64 r_number = StringToNumber(r_item->getText(column)); {
return bool( l_number < r_number ); // lhs < rhs return isGreaterThanDouble(l_str, r_str);
}
case 3:
{
std::setlocale(LC_NUMERIC, "C");
const double l_number = l_item->getText(column).toDouble();
const double r_number = r_item->getText(column).toDouble();
return bool( l_number < r_number ); // lhs < rhs
}
default:
break; // Don't do anything
} }
return false; return false;
@ -89,26 +121,16 @@ bool sortDescending ( const finalcut::FObject* lhs
const auto& l_item = static_cast<const finalcut::FListViewItem*>(lhs); const auto& l_item = static_cast<const finalcut::FListViewItem*>(lhs);
const auto& r_item = static_cast<const finalcut::FListViewItem*>(rhs); const auto& r_item = static_cast<const finalcut::FListViewItem*>(rhs);
const int column = l_item->getSortColumn(); const int column = l_item->getSortColumn();
const auto& l_str = l_item->getText(column);
const auto& r_str = r_item->getText(column);
switch ( column ) if ( column == 2 )
{ {
case 2: return isLessThanInteger(l_str, r_str);
{ }
const sInt64 l_number = StringToNumber(l_item->getText(column)); else if ( column == 3 )
const sInt64 r_number = StringToNumber(r_item->getText(column)); {
return bool( l_number > r_number ); // lhs > rhs return isLessThanDouble(l_str, r_str);
}
case 3:
{
std::setlocale(LC_NUMERIC, "C");
const double l_number = l_item->getText(column).toDouble();
const double r_number = r_item->getText(column).toDouble();
return bool( l_number > r_number ); // lhs > rhs
}
default:
break; // Don't do anything
} }
return false; return false;

View File

@ -361,24 +361,24 @@ void FApplication::cmd_options (const int& argc, char* argv[])
{ {
static struct option long_options[] = static struct option long_options[] =
{ {
{C_STR("encoding"), required_argument, nullptr, 0 }, {"encoding", required_argument, nullptr, 0 },
{C_STR("no-mouse"), no_argument, nullptr, 0 }, {"no-mouse", no_argument, nullptr, 0 },
{C_STR("no-optimized-cursor"), no_argument, nullptr, 0 }, {"no-optimized-cursor", no_argument, nullptr, 0 },
{C_STR("no-terminal-detection"), no_argument, nullptr, 0 }, {"no-terminal-detection", no_argument, nullptr, 0 },
{C_STR("no-terminal-data-request"), no_argument, nullptr, 0 }, {"no-terminal-data-request", no_argument, nullptr, 0 },
{C_STR("no-color-change"), no_argument, nullptr, 0 }, {"no-color-change", no_argument, nullptr, 0 },
{C_STR("no-sgr-optimizer"), no_argument, nullptr, 0 }, {"no-sgr-optimizer", no_argument, nullptr, 0 },
{C_STR("vgafont"), no_argument, nullptr, 0 }, {"vgafont", no_argument, nullptr, 0 },
{C_STR("newfont"), no_argument, nullptr, 0 }, {"newfont", no_argument, nullptr, 0 },
#if defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__DragonFly__)
{C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, {"no-esc-for-alt-meta", no_argument, nullptr, 0 },
{C_STR("no-cursorstyle-change"), no_argument, nullptr, 0 }, {"no-cursorstyle-change", no_argument, nullptr, 0 },
#elif defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__NetBSD__) || defined(__OpenBSD__)
{C_STR("no-esc-for-alt-meta"), no_argument, nullptr, 0 }, {"no-esc-for-alt-meta", no_argument, nullptr, 0 },
#endif #endif
{nullptr, 0, nullptr, 0 } {nullptr, 0, nullptr, 0 }
}; };
opterr = 0; opterr = 0;

View File

@ -2960,11 +2960,8 @@ void FListView::cb_hbarChange (const FWidget*, const FDataPtr)
break; break;
case FScrollbar::scrollJump: case FScrollbar::scrollJump:
{ scrollToX (hbar->getValue());
const int value = hbar->getValue();
scrollToX(value);
break; break;
}
case FScrollbar::scrollWheelUp: case FScrollbar::scrollWheelUp:
scrollBy (-wheel_distance, 0); scrollBy (-wheel_distance, 0);

View File

@ -877,7 +877,7 @@ void FMouseSGR::setMoveState (const FPoint& mouse_position, int btn)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseSGR::setPressedButtonState (const int btn, struct timeval* time) void FMouseSGR::setPressedButtonState (const int btn, const struct timeval* time)
{ {
// Gets the extended x11 mouse mode (SGR) status for pressed buttons // Gets the extended x11 mouse mode (SGR) status for pressed buttons

View File

@ -956,7 +956,7 @@ bool FOptiAttr::setTermAttributes ( FChar*& term
{ {
if ( term && F_set_attributes.cap ) if ( term && F_set_attributes.cap )
{ {
const char* sgr = tparm ( F_set_attributes.cap const char* sgr = tparm ( C_STR(F_set_attributes.cap)
, p1 && ! fake_reverse , p1 && ! fake_reverse
, p2 , p2
, p3 && ! fake_reverse , p3 && ! fake_reverse
@ -1462,9 +1462,9 @@ inline void FOptiAttr::change_to_default_color ( FChar*& term
const auto& op = F_orig_pair.cap; const auto& op = F_orig_pair.cap;
if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 ) if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 )
sgr_49 = C_STR(CSI "49;25m"); sgr_49 = CSI "49;25m";
else else
sgr_49 = C_STR(CSI "49m"); sgr_49 = CSI "49m";
append_sequence (sgr_49); append_sequence (sgr_49);
term->bg_color = fc::Default; term->bg_color = fc::Default;
@ -1500,13 +1500,13 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term
if ( term->fg_color != fg || frev ) if ( term->fg_color != fg || frev )
{ {
color_str = tparm(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0); color_str = tparm(C_STR(AF), ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0);
append_sequence (color_str); append_sequence (color_str);
} }
if ( term->bg_color != bg || frev ) if ( term->bg_color != bg || frev )
{ {
color_str = tparm(AB, ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0); color_str = tparm(C_STR(AB), ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0);
append_sequence (color_str); append_sequence (color_str);
} }
} }
@ -1514,13 +1514,13 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term
{ {
if ( term->fg_color != fg || frev ) if ( term->fg_color != fg || frev )
{ {
color_str = tparm(Sf, fg, 0, 0, 0, 0, 0, 0, 0, 0); color_str = tparm(C_STR(Sf), fg, 0, 0, 0, 0, 0, 0, 0, 0);
append_sequence (color_str); append_sequence (color_str);
} }
if ( term->bg_color != bg || frev ) if ( term->bg_color != bg || frev )
{ {
color_str = tparm(Sb, bg, 0, 0, 0, 0, 0, 0, 0, 0); color_str = tparm(C_STR(Sb), bg, 0, 0, 0, 0, 0, 0, 0, 0);
append_sequence (color_str); append_sequence (color_str);
} }
} }
@ -1528,7 +1528,7 @@ inline void FOptiAttr::change_current_color ( const FChar* const& term
{ {
fg = vga2ansi(fg); fg = vga2ansi(fg);
bg = vga2ansi(bg); bg = vga2ansi(bg);
color_str = tparm(sp, fg, bg, 0, 0, 0, 0, 0, 0, 0); color_str = tparm(C_STR(sp), fg, bg, 0, 0, 0, 0, 0, 0, 0);
append_sequence (color_str); append_sequence (color_str);
} }
} }

View File

@ -42,11 +42,11 @@ FOptiMove::FOptiMove (int baud)
calculateCharDuration(); calculateCharDuration();
// ANSI set cursor address preset for undefined terminals // ANSI set cursor address preset for undefined terminals
set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); set_cursor_address (CSI "%i%p1%d;%p2%dH");
// Set carriage return preset // Set carriage return preset
set_carriage_return (C_STR("\r")); set_carriage_return ("\r");
// Set cursor down preset // Set cursor down preset
set_cursor_down (C_STR("\n")); set_cursor_down ("\n");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -267,7 +267,7 @@ void FOptiMove::set_cursor_address (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tgoto(cap, 23, 23); const char* temp = tgoto(C_STR(cap), 23, 23);
F_cursor_address.cap = cap; F_cursor_address.cap = cap;
F_cursor_address.duration = capDuration (temp, 1); F_cursor_address.duration = capDuration (temp, 1);
F_cursor_address.length = capDurationToLength (F_cursor_address.duration); F_cursor_address.length = capDurationToLength (F_cursor_address.duration);
@ -285,7 +285,7 @@ void FOptiMove::set_column_address (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_column_address.cap = cap; F_column_address.cap = cap;
F_column_address.duration = capDuration (temp, 1); F_column_address.duration = capDuration (temp, 1);
F_column_address.length = capDurationToLength (F_column_address.duration); F_column_address.length = capDurationToLength (F_column_address.duration);
@ -303,7 +303,7 @@ void FOptiMove::set_row_address (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_row_address.cap = cap; F_row_address.cap = cap;
F_row_address.duration = capDuration (temp, 1); F_row_address.duration = capDuration (temp, 1);
F_row_address.length = capDurationToLength (F_row_address.duration); F_row_address.length = capDurationToLength (F_row_address.duration);
@ -321,7 +321,7 @@ void FOptiMove::set_parm_up_cursor (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_parm_up_cursor.cap = cap; F_parm_up_cursor.cap = cap;
F_parm_up_cursor.duration = capDuration (temp, 1); F_parm_up_cursor.duration = capDuration (temp, 1);
F_parm_up_cursor.length = capDurationToLength (F_parm_up_cursor.duration); F_parm_up_cursor.length = capDurationToLength (F_parm_up_cursor.duration);
@ -339,7 +339,7 @@ void FOptiMove::set_parm_down_cursor (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_parm_down_cursor.cap = cap; F_parm_down_cursor.cap = cap;
F_parm_down_cursor.duration = capDuration (temp, 1); F_parm_down_cursor.duration = capDuration (temp, 1);
F_parm_down_cursor.length = capDurationToLength (F_parm_down_cursor.duration); F_parm_down_cursor.length = capDurationToLength (F_parm_down_cursor.duration);
@ -357,7 +357,7 @@ void FOptiMove::set_parm_left_cursor (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_parm_left_cursor.cap = cap; F_parm_left_cursor.cap = cap;
F_parm_left_cursor.duration = capDuration (temp, 1); F_parm_left_cursor.duration = capDuration (temp, 1);
F_parm_left_cursor.length = capDurationToLength (F_parm_left_cursor.duration); F_parm_left_cursor.length = capDurationToLength (F_parm_left_cursor.duration);
@ -375,7 +375,7 @@ void FOptiMove::set_parm_right_cursor (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_parm_right_cursor.cap = cap; F_parm_right_cursor.cap = cap;
F_parm_right_cursor.duration = capDuration (temp, 1); F_parm_right_cursor.duration = capDuration (temp, 1);
F_parm_right_cursor.length = capDurationToLength (F_parm_right_cursor.duration); F_parm_right_cursor.length = capDurationToLength (F_parm_right_cursor.duration);
@ -393,7 +393,7 @@ void FOptiMove::set_erase_chars (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_erase_chars.cap = cap; F_erase_chars.cap = cap;
F_erase_chars.duration = capDuration (temp, 1); F_erase_chars.duration = capDuration (temp, 1);
F_erase_chars.length = capDurationToLength (F_erase_chars.duration); F_erase_chars.length = capDurationToLength (F_erase_chars.duration);
@ -411,7 +411,7 @@ void FOptiMove::set_repeat_char (const char cap[])
{ {
if ( cap ) if ( cap )
{ {
const char* temp = tparm(cap, ' ', 23, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(C_STR(cap), ' ', 23, 0, 0, 0, 0, 0, 0, 0);
F_repeat_char.cap = cap; F_repeat_char.cap = cap;
F_repeat_char.duration = capDuration (temp, 1); F_repeat_char.duration = capDuration (temp, 1);
F_repeat_char.length = capDurationToLength (F_repeat_char.duration); F_repeat_char.length = capDurationToLength (F_repeat_char.duration);
@ -686,7 +686,7 @@ inline int FOptiMove::verticalMove (char move[], int from_y, int to_y)
if ( move ) if ( move )
{ {
std::strncpy ( move std::strncpy ( move
, tparm(F_row_address.cap, to_y, 0, 0, 0, 0, 0, 0, 0, 0) , tparm(C_STR(F_row_address.cap), to_y, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE ); , BUF_SIZE );
move[BUF_SIZE - 1] = '\0'; move[BUF_SIZE - 1] = '\0';
} }
@ -713,7 +713,7 @@ inline void FOptiMove::downMove ( char move[], int& vtime
if ( move ) if ( move )
{ {
std::strncpy ( move std::strncpy ( move
, tparm(F_parm_down_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , tparm(C_STR(F_parm_down_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE ); , BUF_SIZE );
move[BUF_SIZE - 1] = '\0'; move[BUF_SIZE - 1] = '\0';
} }
@ -741,7 +741,7 @@ inline void FOptiMove::upMove ( char move[], int& vtime
if ( move ) if ( move )
{ {
std::strncpy ( move std::strncpy ( move
, tparm(F_parm_up_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , tparm(C_STR(F_parm_up_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE ); , BUF_SIZE );
move[BUF_SIZE - 1] = '\0'; move[BUF_SIZE - 1] = '\0';
} }
@ -767,7 +767,7 @@ inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x)
{ {
// Move to fixed column position1 // Move to fixed column position1
std::strncat ( hmove std::strncat ( hmove
, tparm(F_column_address.cap, to_x, 0, 0, 0, 0, 0, 0, 0, 0) , tparm(C_STR(F_column_address.cap), to_x, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE - std::strlen(hmove) - 1 ); , BUF_SIZE - std::strlen(hmove) - 1 );
hmove[BUF_SIZE - 1] = '\0'; hmove[BUF_SIZE - 1] = '\0';
htime = F_column_address.duration; htime = F_column_address.duration;
@ -790,7 +790,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime ) if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime )
{ {
std::strncpy ( hmove std::strncpy ( hmove
, tparm(F_parm_right_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , tparm(C_STR(F_parm_right_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE - 1); , BUF_SIZE - 1);
hmove[BUF_SIZE - 1] = '\0'; hmove[BUF_SIZE - 1] = '\0';
htime = F_parm_right_cursor.duration; htime = F_parm_right_cursor.duration;
@ -845,7 +845,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime ) if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime )
{ {
std::strncpy ( hmove std::strncpy ( hmove
, tparm(F_parm_left_cursor.cap, num, 0, 0, 0, 0, 0, 0, 0, 0) , tparm(C_STR(F_parm_left_cursor.cap), num, 0, 0, 0, 0, 0, 0, 0, 0)
, BUF_SIZE - 1); , BUF_SIZE - 1);
hmove[BUF_SIZE - 1] = '\0'; hmove[BUF_SIZE - 1] = '\0';
htime = F_parm_left_cursor.duration; htime = F_parm_left_cursor.duration;
@ -906,7 +906,7 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
, int xnew, int ynew ) , int xnew, int ynew )
{ {
// Test method 0: direct cursor addressing // Test method 0: direct cursor addressing
const char* move_xy = tgoto(F_cursor_address.cap, xnew, ynew); const char* move_xy = tgoto(C_STR(F_cursor_address.cap), xnew, ynew);
if ( move_xy ) if ( move_xy )
{ {

View File

@ -395,7 +395,7 @@ const char* FString::c_str() const
if ( length > 0 ) if ( length > 0 )
return wc_to_c_str (string); return wc_to_c_str (string);
else if ( string ) else if ( string )
return const_cast<char*>(""); return const_cast<const char*>("");
else else
return nullptr; return nullptr;
} }
@ -1244,7 +1244,7 @@ void FString::_assign (const wchar_t s[])
if ( string && std::wcscmp(string, s) == 0 ) if ( string && std::wcscmp(string, s) == 0 )
return; // string == s return; // string == s
uInt new_length = uInt(std::wcslen(s)); std::size_t new_length{std::wcslen(s)};
if ( ! string || new_length > capacity() ) if ( ! string || new_length > capacity() )
{ {

View File

@ -836,7 +836,7 @@ const char* FTerm::moveCursorString (int xold, int yold, int xnew, int ynew)
if ( data->hasCursorOptimisation() ) if ( data->hasCursorOptimisation() )
return opti_move->moveCursor (xold, yold, xnew, ynew); return opti_move->moveCursor (xold, yold, xnew, ynew);
else else
return tgoto(TCAP(fc::t_cursor_address), xnew, ynew); return tgoto(C_STR(TCAP(fc::t_cursor_address)), xnew, ynew);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -987,9 +987,9 @@ void FTerm::setPalette (FColor index, int r, int g, int b)
const int bb = (b * 1001) / 256; const int bb = (b * 1001) / 256;
if ( Ic ) if ( Ic )
color_str = tparm(Ic, index, rr, gg, bb, 0, 0, 0, 0, 0); color_str = tparm(C_STR(Ic), index, rr, gg, bb, 0, 0, 0, 0, 0);
else if ( Ip ) else if ( Ip )
color_str = tparm(Ip, index, 0, 0, 0, rr, gg, bb, 0, 0); color_str = tparm(C_STR(Ip), index, 0, 0, 0, rr, gg, bb, 0, 0);
if ( color_str ) if ( color_str )
{ {
@ -1099,7 +1099,7 @@ void FTerm::setEncoding (fc::encoding enc)
{ {
if ( enc == fc::VT100 || enc == fc::PC ) if ( enc == fc::VT100 || enc == fc::PC )
{ {
char* empty{nullptr}; const char* empty{nullptr};
opti_move->set_tabular (empty); opti_move->set_tabular (empty);
} }
else else
@ -1433,14 +1433,12 @@ void FTerm::init_pc_charset()
if ( data->hasUTF8Console() ) if ( data->hasUTF8Console() )
{ {
// Select iso8859-1 + null mapping // Select iso8859-1 + null mapping
TCAP(fc::t_enter_pc_charset_mode) = \ TCAP(fc::t_enter_pc_charset_mode) = ESC "%@" ESC "(U";
C_STR(ESC "%@" ESC "(U");
} }
else else
{ {
// Select null mapping // Select null mapping
TCAP(fc::t_enter_pc_charset_mode) = \ TCAP(fc::t_enter_pc_charset_mode) = ESC "(U";
C_STR(ESC "(U");
} }
opti_attr->set_enter_pc_charset_mode \ opti_attr->set_enter_pc_charset_mode \
@ -1454,14 +1452,12 @@ void FTerm::init_pc_charset()
if ( data->hasUTF8Console() ) if ( data->hasUTF8Console() )
{ {
// Select ascii mapping + utf8 // Select ascii mapping + utf8
TCAP(fc::t_exit_pc_charset_mode) = \ TCAP(fc::t_exit_pc_charset_mode) = ESC "(B" ESC "%G";
C_STR(ESC "(B" ESC "%G");
} }
else else
{ {
// Select ascii mapping // Select ascii mapping
TCAP(fc::t_enter_pc_charset_mode) = \ TCAP(fc::t_enter_pc_charset_mode) = ESC "(B";
C_STR(ESC "(B");
} }
opti_attr->set_exit_pc_charset_mode \ opti_attr->set_exit_pc_charset_mode \
@ -1836,7 +1832,7 @@ void FTerm::init_tab_quirks()
if ( enc == fc::VT100 || enc == fc::PC ) if ( enc == fc::VT100 || enc == fc::PC )
{ {
char* empty{nullptr}; const char* empty{nullptr};
opti_move->set_tabular (empty); opti_move->set_tabular (empty);
} }
} }

View File

@ -164,7 +164,7 @@ void FTermcap::termcapVariables (char*& buffer)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcap::termcapBoleans() void FTermcap::termcapBoleans()
{ {
// Get termcap booleans // Get termcap flags/booleans
// Screen erased with the background color // Screen erased with the background color
background_color_erase = tgetflag(C_STR("ut")); background_color_erase = tgetflag(C_STR("ut"));
@ -195,7 +195,7 @@ void FTermcap::termcapBoleans()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTermcap::termcapNumerics() void FTermcap::termcapNumerics()
{ {
// Get termcap numeric // Get termcap numerics
// Maximum number of colors on screen // Maximum number of colors on screen
max_color = std::max(max_color, tgetnum(C_STR("Co"))); max_color = std::max(max_color, tgetnum(C_STR("Co")));
@ -222,7 +222,7 @@ void FTermcap::termcapStrings (char*& buffer)
// Read termcap output strings // Read termcap output strings
for (std::size_t i{0}; strings[i].tname[0] != 0; i++) for (std::size_t i{0}; strings[i].tname[0] != 0; i++)
strings[i].string = tgetstr(strings[i].tname, &buffer); strings[i].string = tgetstr(C_STR(strings[i].tname), &buffer);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -232,46 +232,46 @@ void FTermcap::termcapKeys (char*& buffer)
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++) for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{ {
fc::fkey[i].string = tgetstr(fc::fkey[i].tname, &buffer); fc::fkey[i].string = tgetstr(C_STR(fc::fkey[i].tname), &buffer);
// Fallback for rxvt with TERM=xterm // Fallback for rxvt with TERM=xterm
if ( std::strncmp(fc::fkey[i].tname, "khx", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "khx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "7~"); // Home key fc::fkey[i].string = CSI "7~"; // Home key
if ( std::strncmp(fc::fkey[i].tname, "@7x", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "@7x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "8~"); // End key fc::fkey[i].string = CSI "8~"; // End key
if ( std::strncmp(fc::fkey[i].tname, "k1x", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k1x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "11~"); // F1 fc::fkey[i].string = CSI "11~"; // F1
if ( std::strncmp(fc::fkey[i].tname, "k2x", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k2x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "12~"); // F2 fc::fkey[i].string = CSI "12~"; // F2
if ( std::strncmp(fc::fkey[i].tname, "k3x", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k3x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "13~"); // F3 fc::fkey[i].string = CSI "13~"; // F3
if ( std::strncmp(fc::fkey[i].tname, "k4x", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k4x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "14~"); // F4 fc::fkey[i].string = CSI "14~"; // F4
// Fallback for TERM=ansi // Fallback for TERM=ansi
if ( std::strncmp(fc::fkey[i].tname, "@7X", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "@7X", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "K"); // End key fc::fkey[i].string = CSI "K"; // End key
// Keypad keys // Keypad keys
if ( std::strncmp(fc::fkey[i].tname, "@8x", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "@8x", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OM"); // Enter key fc::fkey[i].string = ESC "OM"; // Enter key
if ( std::strncmp(fc::fkey[i].tname, "KP1", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP1", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Oo"); // Keypad slash fc::fkey[i].string = ESC "Oo"; // Keypad slash
if ( std::strncmp(fc::fkey[i].tname, "KP2", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP2", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Oj"); // Keypad asterisk fc::fkey[i].string = ESC "Oj"; // Keypad asterisk
if ( std::strncmp(fc::fkey[i].tname, "KP3", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP3", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Om"); // Keypad minus sign fc::fkey[i].string = ESC "Om"; // Keypad minus sign
if ( std::strncmp(fc::fkey[i].tname, "KP4", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP4", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "Ok"); // Keypad plus sign fc::fkey[i].string = ESC "Ok"; // Keypad plus sign
} }
// VT100 key codes for the arrow and function keys // VT100 key codes for the arrow and function keys
@ -287,40 +287,40 @@ void FTermcap::termcapKeysVt100()
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++) for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{ {
if ( std::strncmp(fc::fkey[i].tname, "kux", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kux", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "A"); // Key up (standard mode) fc::fkey[i].string = CSI "A"; // Key up (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "kuX", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kuX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OA"); // Key up (application mode) fc::fkey[i].string = ESC "OA"; // Key up (application mode)
if ( std::strncmp(fc::fkey[i].tname, "kdx", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kdx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "B"); // Key down (standard mode) fc::fkey[i].string = CSI "B"; // Key down (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "kdX", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kdX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OB"); // Key down (application mode) fc::fkey[i].string = ESC "OB"; // Key down (application mode)
if ( std::strncmp(fc::fkey[i].tname, "krx", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "krx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "C"); // Key right (standard mode) fc::fkey[i].string = CSI "C"; // Key right (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "krX", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "krX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OC"); // Key right (application mode) fc::fkey[i].string = ESC "OC"; // Key right (application mode)
if ( std::strncmp(fc::fkey[i].tname, "klx", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "klx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "D"); // Key left (standard mode) fc::fkey[i].string = CSI "D"; // Key left (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "klX", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "klX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OD"); // Key left (application mode) fc::fkey[i].string = ESC "OD"; // Key left (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k1X", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k1X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OP"); // PF1 (application mode) fc::fkey[i].string = ESC "OP"; // PF1 (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k2X", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k2X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OQ"); // PF2 (application mode) fc::fkey[i].string = ESC "OQ"; // PF2 (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k3X", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k3X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OR"); // PF3 (application mode) fc::fkey[i].string = ESC "OR"; // PF3 (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k4X", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k4X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OS"); // PF4 (application mode) fc::fkey[i].string = ESC "OS"; // PF4 (application mode)
} }
} }

View File

@ -118,21 +118,21 @@ void FTermcapQuirks::freebsd()
// FreeBSD console fixes // FreeBSD console fixes
TCAP(fc::t_acs_chars) = \ TCAP(fc::t_acs_chars) = \
C_STR("-\036.\0370\333" "-\036.\0370\333"
"a\260f\370g\361" "a\260f\370g\361"
"h\261j\331k\277" "h\261j\331k\277"
"l\332m\300n\305" "l\332m\300n\305"
"q\304t\303u\264" "q\304t\303u\264"
"v\301w\302x\263" "v\301w\302x\263"
"y\363z\362~\371"); "y\363z\362~\371";
TCAP(fc::t_set_attributes) = \ TCAP(fc::t_set_attributes) = \
C_STR(CSI "0" CSI "0"
"%?%p1%p6%|%t;1%;" "%?%p1%p6%|%t;1%;"
"%?%p2%t;4%;" "%?%p2%t;4%;"
"%?%p1%p3%|%t;7%;" "%?%p1%p3%|%t;7%;"
"%?%p4%t;5%;m" "%?%p4%t;5%;m"
"%?%p9%t\016%e\017%;"); "%?%p9%t\016%e\017%;";
FTermcap::attr_without_color = 18; FTermcap::attr_without_color = 18;
} }
@ -143,23 +143,19 @@ void FTermcapQuirks::cygwin()
{ {
// Set invisible cursor for cygwin terminal // Set invisible cursor for cygwin terminal
if ( ! TCAP(fc::t_cursor_invisible) ) if ( ! TCAP(fc::t_cursor_invisible) )
TCAP(fc::t_cursor_invisible) = \ TCAP(fc::t_cursor_invisible) = CSI "?25l";
C_STR(CSI "?25l");
// Set visible cursor for cygwin terminal // Set visible cursor for cygwin terminal
if ( ! TCAP(fc::t_cursor_visible) ) if ( ! TCAP(fc::t_cursor_visible) )
TCAP(fc::t_cursor_visible) = \ TCAP(fc::t_cursor_visible) = CSI "?25h";
C_STR(CSI "?25h");
// Set ansi blink for cygwin terminal // Set ansi blink for cygwin terminal
if ( ! TCAP(fc::t_enter_blink_mode) ) if ( ! TCAP(fc::t_enter_blink_mode) )
TCAP(fc::t_enter_blink_mode) = \ TCAP(fc::t_enter_blink_mode) = CSI "5m";
C_STR(CSI "5m");
// Set enable alternate character set for cygwin terminal // Set enable alternate character set for cygwin terminal
if ( ! TCAP(fc::t_enable_acs) ) if ( ! TCAP(fc::t_enable_acs) )
TCAP(fc::t_enable_acs) = \ TCAP(fc::t_enable_acs) = ESC "(B" ESC ")0";
C_STR(ESC "(B" ESC ")0");
// Set background color erase for cygwin terminal // Set background color erase for cygwin terminal
FTermcap::background_color_erase = true; FTermcap::background_color_erase = true;
@ -177,40 +173,38 @@ void FTermcapQuirks::linux()
if ( FTerm::getMaxColor() > 8 ) if ( FTerm::getMaxColor() > 8 )
{ {
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = \
C_STR(CSI "3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;22%;m"); CSI "3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;22%;m";
TCAP(fc::t_set_a_background) = \ TCAP(fc::t_set_a_background) = \
C_STR(CSI "4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m"); CSI "4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m";
// Avoid underline, blink, dim mode and reverse // Avoid underline, blink, dim mode and reverse
FTermcap::attr_without_color = 30; FTermcap::attr_without_color = 30;
} }
else else
{ {
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = CSI "3%p1%dm";
C_STR(CSI "3%p1%dm"); TCAP(fc::t_set_a_background) = CSI "4%p1%dm";
TCAP(fc::t_set_a_background) = \
C_STR(CSI "4%p1%dm");
// Avoid underline and dim mode // Avoid underline and dim mode
FTermcap::attr_without_color = 18; FTermcap::attr_without_color = 18;
} }
// Set select graphic rendition attributes // Set select graphic rendition attributes
TCAP(fc::t_set_attributes) = \ TCAP(fc::t_set_attributes) = \
C_STR(CSI "0" CSI "0"
"%?%p6%t;1%;" "%?%p6%t;1%;"
"%?%p1%p3%|%t;7%;" "%?%p1%p3%|%t;7%;"
"%?%p4%t;5%;m" "%?%p4%t;5%;m"
"%?%p9%t\016%e\017%;"); "%?%p9%t\016%e\017%;";
TCAP(fc::t_enter_alt_charset_mode) = C_STR(SO); TCAP(fc::t_enter_alt_charset_mode) = SO;
TCAP(fc::t_exit_alt_charset_mode) = C_STR(SI); TCAP(fc::t_exit_alt_charset_mode) = SI;
TCAP(fc::t_exit_attribute_mode) = C_STR(CSI "0m" SI); TCAP(fc::t_exit_attribute_mode) = CSI "0m" SI;
TCAP(fc::t_exit_bold_mode) = C_STR(CSI "22m"); TCAP(fc::t_exit_bold_mode) = CSI "22m";
TCAP(fc::t_exit_blink_mode) = C_STR(CSI "25m"); TCAP(fc::t_exit_blink_mode) = CSI "25m";
TCAP(fc::t_exit_reverse_mode) = C_STR(CSI "27m"); TCAP(fc::t_exit_reverse_mode) = CSI "27m";
TCAP(fc::t_exit_secure_mode) = nullptr; TCAP(fc::t_exit_secure_mode) = nullptr;
TCAP(fc::t_exit_protected_mode) = nullptr; TCAP(fc::t_exit_protected_mode) = nullptr;
TCAP(fc::t_exit_crossed_out_mode) = nullptr; TCAP(fc::t_exit_crossed_out_mode) = nullptr;
TCAP(fc::t_orig_pair) = C_STR(CSI "39;49;25m"); TCAP(fc::t_orig_pair) = CSI "39;49;25m";
// Avoid underline and dim mode // Avoid underline and dim mode
TCAP(fc::t_enter_dim_mode) = nullptr; TCAP(fc::t_enter_dim_mode) = nullptr;
@ -227,21 +221,19 @@ void FTermcapQuirks::xterm()
{ {
FTermcap::can_change_color_palette = true; FTermcap::can_change_color_palette = true;
TCAP(fc::t_initialize_color) = \ TCAP(fc::t_initialize_color) = \
C_STR(OSC "4;%p1%d;rgb:" OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
"%p3%{255}%*%{1000}%/%2.2X/" "%p3%{255}%*%{1000}%/%2.2X/"
"%p4%{255}%*%{1000}%/%2.2X" ESC "\\"); "%p4%{255}%*%{1000}%/%2.2X" ESC "\\";
} }
// Fallback if "vi" is not found // Fallback if "vi" is not found
if ( ! TCAP(fc::t_cursor_invisible) ) if ( ! TCAP(fc::t_cursor_invisible) )
TCAP(fc::t_cursor_invisible) = \ TCAP(fc::t_cursor_invisible) = CSI "?25l";
C_STR(CSI "?25l");
// Fallback if "ve" is not found // Fallback if "ve" is not found
if ( ! TCAP(fc::t_cursor_normal) ) if ( ! TCAP(fc::t_cursor_normal) )
TCAP(fc::t_cursor_normal) = \ TCAP(fc::t_cursor_normal) = CSI "?12l" CSI "?25h";
C_STR(CSI "?12l" CSI "?25h");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -252,19 +244,17 @@ void FTermcapQuirks::rxvt()
if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 ) if ( std::strncmp(termtype, "rxvt-16color", 12) == 0 )
{ {
TCAP(fc::t_enter_alt_charset_mode) = \ TCAP(fc::t_enter_alt_charset_mode) = ESC "(0";
C_STR(ESC "(0"); TCAP(fc::t_exit_alt_charset_mode) = ESC "(B";
TCAP(fc::t_exit_alt_charset_mode) = \
C_STR(ESC "(B");
} }
// Set ansi foreground and background color // Set ansi foreground and background color
if ( ! term_detection->isUrxvtTerminal() ) if ( ! term_detection->isUrxvtTerminal() )
{ {
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = \
C_STR(CSI "%?%p1%{8}%<%t%p1%{30}%+%e%p1%'R'%+%;%dm"); CSI "%?%p1%{8}%<%t%p1%{30}%+%e%p1%'R'%+%;%dm";
TCAP(fc::t_set_a_background) = \ TCAP(fc::t_set_a_background) = \
C_STR(CSI "%?%p1%{8}%<%t%p1%'('%+%e%p1%{92}%+%;%dm"); CSI "%?%p1%{8}%<%t%p1%'('%+%e%p1%{92}%+%;%dm";
} }
} }
@ -276,7 +266,7 @@ void FTermcapQuirks::vte()
// set exit underline for gnome terminal // set exit underline for gnome terminal
TCAP(fc::t_exit_underline_mode) = \ TCAP(fc::t_exit_underline_mode) = \
C_STR(CSI "24m"); CSI "24m";
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -291,86 +281,71 @@ void FTermcapQuirks::putty()
// Set ansi foreground and background color // Set ansi foreground and background color
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = \
C_STR(CSI "%?%p1%{8}%<" CSI "%?%p1%{8}%<"
"%t3%p1%d" "%t3%p1%d"
"%e%p1%{16}%<" "%e%p1%{16}%<"
"%t9%p1%{8}%-%d" "%t9%p1%{8}%-%d"
"%e38;5;%p1%d%;m"); "%e38;5;%p1%d%;m";
TCAP(fc::t_set_a_background) = \ TCAP(fc::t_set_a_background) = \
C_STR(CSI "%?%p1%{8}%<" CSI "%?%p1%{8}%<"
"%t4%p1%d" "%t4%p1%d"
"%e%p1%{16}%<" "%e%p1%{16}%<"
"%t10%p1%{8}%-%d" "%t10%p1%{8}%-%d"
"%e48;5;%p1%d%;m"); "%e48;5;%p1%d%;m";
TCAP(fc::t_set_attributes) = \ TCAP(fc::t_set_attributes) = \
C_STR(CSI "0" CSI "0"
"%?%p1%p6%|%t;1%;" "%?%p1%p6%|%t;1%;"
"%?%p5%t;2%;" // since putty 0.71 "%?%p5%t;2%;" // since putty 0.71
"%?%p2%t;4%;" "%?%p2%t;4%;"
"%?%p1%p3%|%t;7%;" "%?%p1%p3%|%t;7%;"
"%?%p4%t;5%;m" "%?%p4%t;5%;m"
"%?%p9%t\016%e\017%;"); "%?%p9%t\016%e\017%;";
// PuTTY 0.71 or higher // PuTTY 0.71 or higher
TCAP(fc::t_enter_dim_mode) = \ TCAP(fc::t_enter_dim_mode) = CSI "2m";
C_STR(CSI "2m");
// PuTTY 0.71 or higher // PuTTY 0.71 or higher
TCAP(fc::t_exit_dim_mode) = \ TCAP(fc::t_exit_dim_mode) = CSI "22m";
C_STR(CSI "22m");
if ( ! TCAP(fc::t_clr_bol) ) if ( ! TCAP(fc::t_clr_bol) )
TCAP(fc::t_clr_bol) = \ TCAP(fc::t_clr_bol) = CSI "1K";
C_STR(CSI "1K");
if ( ! TCAP(fc::t_orig_pair) ) if ( ! TCAP(fc::t_orig_pair) )
TCAP(fc::t_orig_pair) = \ TCAP(fc::t_orig_pair) = CSI "39;49m";
C_STR(CSI "39;49m");
if ( ! TCAP(fc::t_orig_colors) ) if ( ! TCAP(fc::t_orig_colors) )
TCAP(fc::t_orig_colors) = \ TCAP(fc::t_orig_colors) = OSC "R";
C_STR(OSC "R");
if ( ! TCAP(fc::t_column_address) ) if ( ! TCAP(fc::t_column_address) )
TCAP(fc::t_column_address) = \ TCAP(fc::t_column_address) = CSI "%i%p1%dG";
C_STR(CSI "%i%p1%dG");
if ( ! TCAP(fc::t_row_address) ) if ( ! TCAP(fc::t_row_address) )
TCAP(fc::t_row_address) = \ TCAP(fc::t_row_address) = CSI "%i%p1%dd";
C_STR(CSI "%i%p1%dd");
if ( ! TCAP(fc::t_enable_acs) ) if ( ! TCAP(fc::t_enable_acs) )
TCAP(fc::t_enable_acs) = \ TCAP(fc::t_enable_acs) = ESC "(B" ESC ")0";
C_STR(ESC "(B" ESC ")0");
if ( ! TCAP(fc::t_enter_am_mode) ) if ( ! TCAP(fc::t_enter_am_mode) )
TCAP(fc::t_enter_am_mode) = \ TCAP(fc::t_enter_am_mode) = CSI "?7h";
C_STR(CSI "?7h");
if ( ! TCAP(fc::t_exit_am_mode) ) if ( ! TCAP(fc::t_exit_am_mode) )
TCAP(fc::t_exit_am_mode) = \ TCAP(fc::t_exit_am_mode) = CSI "?7l";
C_STR(CSI "?7l");
if ( ! TCAP(fc::t_enter_pc_charset_mode) ) if ( ! TCAP(fc::t_enter_pc_charset_mode) )
TCAP(fc::t_enter_pc_charset_mode) = \ TCAP(fc::t_enter_pc_charset_mode) = CSI "11m";
C_STR(CSI "11m");
if ( ! TCAP(fc::t_exit_pc_charset_mode) ) if ( ! TCAP(fc::t_exit_pc_charset_mode) )
TCAP(fc::t_exit_pc_charset_mode) = \ TCAP(fc::t_exit_pc_charset_mode) = CSI "10m";
C_STR(CSI "10m");
if ( ! TCAP(fc::t_keypad_xmit) ) if ( ! TCAP(fc::t_keypad_xmit) )
TCAP(fc::t_keypad_xmit) = \ TCAP(fc::t_keypad_xmit) = CSI "?1h" ESC "=";
C_STR(CSI "?1h" ESC "=");
if ( ! TCAP(fc::t_keypad_local) ) if ( ! TCAP(fc::t_keypad_local) )
TCAP(fc::t_keypad_local) = \ TCAP(fc::t_keypad_local) = CSI "?1l" ESC ">";
C_STR(CSI "?1l" ESC ">");
if ( ! TCAP(fc::t_key_mouse) ) if ( ! TCAP(fc::t_key_mouse) )
TCAP(fc::t_key_mouse) = \ TCAP(fc::t_key_mouse) = CSI "M";
C_STR(CSI "M");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -380,14 +355,10 @@ void FTermcapQuirks::teraterm()
FTermcap::eat_nl_glitch = true; FTermcap::eat_nl_glitch = true;
// Tera Term color settings // Tera Term color settings
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = CSI "38;5;%p1%dm";
C_STR(CSI "38;5;%p1%dm"); TCAP(fc::t_set_a_background) = CSI "48;5;%p1%dm";
TCAP(fc::t_set_a_background) = \ TCAP(fc::t_exit_attribute_mode) = CSI "0m" SI;
C_STR(CSI "48;5;%p1%dm"); TCAP(fc::t_orig_pair) = CSI "39;49m";
TCAP(fc::t_exit_attribute_mode) = \
C_STR(CSI "0m" SI);
TCAP(fc::t_orig_pair) = \
C_STR(CSI "39;49m");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -397,84 +368,77 @@ void FTermcapQuirks::sunConsole()
FTermcap::eat_nl_glitch = true; FTermcap::eat_nl_glitch = true;
// Sun Microsystems workstation console parameter cursor control // Sun Microsystems workstation console parameter cursor control
TCAP(fc::t_parm_up_cursor) = \ TCAP(fc::t_parm_up_cursor) = CSI "%p1%dA";
C_STR(CSI "%p1%dA"); TCAP(fc::t_parm_down_cursor) = CSI "%p1%dB";
TCAP(fc::t_parm_right_cursor) = CSI "%p1%dC";
TCAP(fc::t_parm_down_cursor) = \ TCAP(fc::t_parm_left_cursor) = CSI "%p1%dD";
C_STR(CSI "%p1%dB");
TCAP(fc::t_parm_right_cursor) = \
C_STR(CSI "%p1%dC");
TCAP(fc::t_parm_left_cursor) = \
C_STR(CSI "%p1%dD");
// Sun Microsystems workstation console keys // Sun Microsystems workstation console keys
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++) for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{ {
if ( std::strncmp(fc::fkey[i].tname, "K2", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "K2", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "218z"); // center of keypad fc::fkey[i].string = CSI "218z"; // center of keypad
if ( std::strncmp(fc::fkey[i].tname, "kb", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kb", 2) == 0 )
fc::fkey[i].string = C_STR("\b"); // backspace key fc::fkey[i].string = "\b"; // backspace key
if ( std::strncmp(fc::fkey[i].tname, "kD", 2) == 0 if ( std::strncmp(fc::fkey[i].tname, "kD", 2) == 0
&& std::strlen(fc::fkey[i].tname) == 2 ) && std::strlen(fc::fkey[i].tname) == 2 )
fc::fkey[i].string = C_STR("\177"); // delete-character key fc::fkey[i].string = "\177"; // delete-character key
if ( std::strncmp(fc::fkey[i].tname, "@7", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "@7", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "220z"); // end key fc::fkey[i].string = CSI "220z"; // end key
if ( std::strncmp(fc::fkey[i].tname, "k;", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "k;", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "233z"); // F10 function key fc::fkey[i].string = CSI "233z"; // F10 function key
if ( std::strncmp(fc::fkey[i].tname, "F1", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "F1", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "234z"); // F11 function key fc::fkey[i].string = CSI "234z"; // F11 function key
if ( std::strncmp(fc::fkey[i].tname, "F2", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "F2", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "235z"); // F12 function key fc::fkey[i].string = CSI "235z"; // F12 function key
if ( std::strncmp(fc::fkey[i].tname, "kh", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kh", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "214z"); // home key fc::fkey[i].string = CSI "214z"; // home key
if ( std::strncmp(fc::fkey[i].tname, "kI", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kI", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "247z"); // insert-character key fc::fkey[i].string = CSI "247z"; // insert-character key
if ( std::strncmp(fc::fkey[i].tname, "kN", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kN", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "222z"); // next-page key fc::fkey[i].string = CSI "222z"; // next-page key
if ( std::strncmp(fc::fkey[i].tname, "%7", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "%7", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "194z"); // options key fc::fkey[i].string = CSI "194z"; // options key
if ( std::strncmp(fc::fkey[i].tname, "kP", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kP", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "216z"); // prev-page key fc::fkey[i].string = CSI "216z"; // prev-page key
if ( std::strncmp(fc::fkey[i].tname, "&5", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "&5", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "193z"); // resume key fc::fkey[i].string = CSI "193z"; // resume key
if ( std::strncmp(fc::fkey[i].tname, "&8", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "&8", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "195z"); // undo key fc::fkey[i].string = CSI "195z"; // undo key
if ( std::strncmp(fc::fkey[i].tname, "K2", 2) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "K2", 2) == 0 )
fc::fkey[i].string = C_STR(CSI "218z"); // center of keypad fc::fkey[i].string = CSI "218z"; // center of keypad
if ( std::strncmp(fc::fkey[i].tname, "kDx", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "kDx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "249z"); // keypad delete fc::fkey[i].string = CSI "249z"; // keypad delete
if ( std::strncmp(fc::fkey[i].tname, "@8x", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "@8x", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "250z"); // enter/send key fc::fkey[i].string = CSI "250z"; // enter/send key
if ( std::strncmp(fc::fkey[i].tname, "KP1", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP1", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "212z"); // keypad slash fc::fkey[i].string = CSI "212z"; // keypad slash
if ( std::strncmp(fc::fkey[i].tname, "KP2", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP2", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "213z"); // keypad asterisk fc::fkey[i].string = CSI "213z"; // keypad asterisk
if ( std::strncmp(fc::fkey[i].tname, "KP3", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP3", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "254z"); // keypad minus sign fc::fkey[i].string = CSI "254z"; // keypad minus sign
if ( std::strncmp(fc::fkey[i].tname, "KP4", 3) == 0 ) if ( std::strncmp(fc::fkey[i].tname, "KP4", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "253z"); // keypad plus sign fc::fkey[i].string = CSI "253z"; // keypad plus sign
} }
} }
@ -489,18 +453,18 @@ void FTermcapQuirks::screen()
if ( term_detection->isTmuxTerm() ) if ( term_detection->isTmuxTerm() )
{ {
TCAP(fc::t_initialize_color) = \ TCAP(fc::t_initialize_color) = \
C_STR(ESC "Ptmux;" ESC OSC "4;%p1%d;rgb:" ESC "Ptmux;" ESC OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
"%p3%{255}%*%{1000}%/%2.2X/" "%p3%{255}%*%{1000}%/%2.2X/"
"%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\"); "%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\";
} }
else else
{ {
TCAP(fc::t_initialize_color) = \ TCAP(fc::t_initialize_color) = \
C_STR(ESC "P" OSC "4;%p1%d;rgb:" ESC "P" OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
"%p3%{255}%*%{1000}%/%2.2X/" "%p3%{255}%*%{1000}%/%2.2X/"
"%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\"); "%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\";
} }
} }
} }
@ -518,39 +482,34 @@ void FTermcapQuirks::general()
// Fallback if "AF" is not found // Fallback if "AF" is not found
if ( ! TCAP(fc::t_set_a_foreground) ) if ( ! TCAP(fc::t_set_a_foreground) )
TCAP(fc::t_set_a_foreground) = \ TCAP(fc::t_set_a_foreground) = CSI "3%p1%dm";
C_STR(CSI "3%p1%dm");
// Fallback if "AB" is not found // Fallback if "AB" is not found
if ( ! TCAP(fc::t_set_a_background) ) if ( ! TCAP(fc::t_set_a_background) )
TCAP(fc::t_set_a_background) = \ TCAP(fc::t_set_a_background) = CSI "4%p1%dm";
C_STR(CSI "4%p1%dm");
// Fallback if "Ic" is not found // Fallback if "Ic" is not found
if ( ! TCAP(fc::t_initialize_color) ) if ( ! TCAP(fc::t_initialize_color) )
{ {
FTermcap::can_change_color_palette = true; FTermcap::can_change_color_palette = true;
TCAP(fc::t_initialize_color) = \ TCAP(fc::t_initialize_color) = \
C_STR(OSC "P%p1%x" OSC "P%p1%x"
"%p2%{255}%*%{1000}%/%02x" "%p2%{255}%*%{1000}%/%02x"
"%p3%{255}%*%{1000}%/%02x" "%p3%{255}%*%{1000}%/%02x"
"%p4%{255}%*%{1000}%/%02x"); "%p4%{255}%*%{1000}%/%02x";
} }
// Fallback if "ti" is not found // Fallback if "ti" is not found
if ( ! TCAP(fc::t_enter_ca_mode) ) if ( ! TCAP(fc::t_enter_ca_mode) )
TCAP(fc::t_enter_ca_mode) = \ TCAP(fc::t_enter_ca_mode) = ESC "7" CSI "?47h";
C_STR(ESC "7" CSI "?47h");
// Fallback if "te" is not found // Fallback if "te" is not found
if ( ! TCAP(fc::t_exit_ca_mode) ) if ( ! TCAP(fc::t_exit_ca_mode) )
TCAP(fc::t_exit_ca_mode) = \ TCAP(fc::t_exit_ca_mode) = CSI "?47l" ESC "8" CSI "m";
C_STR(CSI "?47l" ESC "8" CSI "m");
// Set ansi move if "cm" is not found // Set ansi move if "cm" is not found
if ( ! TCAP(fc::t_cursor_address) ) if ( ! TCAP(fc::t_cursor_address) )
TCAP(fc::t_cursor_address) = \ TCAP(fc::t_cursor_address) = CSI "%i%p1%d;%p2%dH";
C_STR(CSI "%i%p1%d;%p2%dH");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -562,35 +521,16 @@ void FTermcapQuirks::ecma48()
return; return;
// Seems to be a ECMA-48 (ANSI X3.64) compatible terminal // Seems to be a ECMA-48 (ANSI X3.64) compatible terminal
TCAP(fc::t_enter_dbl_underline_mode) = \ TCAP(fc::t_enter_dbl_underline_mode) = CSI "21m"; // Leaves single underlined too
C_STR(CSI "21m"); // Exit single underline, too TCAP(fc::t_exit_dbl_underline_mode) = CSI "24m";
TCAP(fc::t_exit_bold_mode) = CSI "22m"; // Exit dim, too
TCAP(fc::t_exit_dbl_underline_mode) = \ TCAP(fc::t_exit_dim_mode) = CSI "22m";
C_STR(CSI "24m"); TCAP(fc::t_exit_underline_mode) = CSI "24m";
TCAP(fc::t_exit_blink_mode) = CSI "25m";
TCAP(fc::t_exit_bold_mode) = \ TCAP(fc::t_exit_reverse_mode) = CSI "27m";
C_STR(CSI "22m"); // Exit dim, too TCAP(fc::t_exit_secure_mode) = CSI "28m";
TCAP(fc::t_enter_crossed_out_mode) = CSI "9m";
TCAP(fc::t_exit_dim_mode) = \ TCAP(fc::t_exit_crossed_out_mode) = CSI "29m";
C_STR(CSI "22m");
TCAP(fc::t_exit_underline_mode) = \
C_STR(CSI "24m");
TCAP(fc::t_exit_blink_mode) = \
C_STR(CSI "25m");
TCAP(fc::t_exit_reverse_mode) = \
C_STR(CSI "27m");
TCAP(fc::t_exit_secure_mode) = \
C_STR(CSI "28m");
TCAP(fc::t_enter_crossed_out_mode) = \
C_STR(CSI "9m");
TCAP(fc::t_exit_crossed_out_mode) = \
C_STR(CSI "29m");
} }
} // namespace finalcut } // namespace finalcut

View File

@ -86,7 +86,7 @@ FTermDetection::FTermDetection()
gnome_terminal_id = 0; gnome_terminal_id = 0;
// Set default ttytype file // Set default ttytype file
std::strncpy (ttytypename, C_STR("/etc/ttytype"), sizeof(ttytypename)); std::strncpy (ttytypename, "/etc/ttytype", sizeof(ttytypename));
ttytypename[sizeof(ttytypename) - 1] = '\0'; ttytypename[sizeof(ttytypename) - 1] = '\0';
} }
@ -155,7 +155,7 @@ void FTermDetection::deallocation()
void FTermDetection::getSystemTermType() void FTermDetection::getSystemTermType()
{ {
// Import the untrusted environment variable TERM // Import the untrusted environment variable TERM
const char* const& term_env = std::getenv(C_STR("TERM")); const char* const& term_env = std::getenv("TERM");
const char* termfilename = fterm_data->getTermFileName(); const char* termfilename = fterm_data->getTermFileName();
if ( term_env ) if ( term_env )
@ -177,7 +177,7 @@ void FTermDetection::getSystemTermType()
} }
// 2nd fallback: use vt100 if not found // 2nd fallback: use vt100 if not found
std::strncpy (termtype, C_STR("vt100"), sizeof(termtype)); std::strncpy (termtype, "vt100", sizeof(termtype));
termtype[sizeof(termtype) - 1] = '\0'; termtype[sizeof(termtype) - 1] = '\0';
} }
@ -328,12 +328,12 @@ void FTermDetection::termtypeAnalysis()
} }
// Linux console // Linux console
if ( std::strncmp(termtype, C_STR("linux"), 5) == 0 if ( std::strncmp(termtype, "linux", 5) == 0
|| std::strncmp(termtype, C_STR("con"), 3) == 0 ) || std::strncmp(termtype, "con", 3) == 0 )
terminal_type.linux_con = true; terminal_type.linux_con = true;
// NetBSD workstation console // NetBSD workstation console
if ( std::strncmp(termtype, C_STR("wsvt25"), 6) == 0 ) if ( std::strncmp(termtype, "wsvt25", 6) == 0 )
terminal_type.netbsd_con = true; terminal_type.netbsd_con = true;
} }
@ -368,20 +368,20 @@ void FTermDetection::detectTerminal()
// //
// Test if the terminal is a xterm // Test if the terminal is a xterm
if ( std::strncmp(termtype, C_STR("xterm"), 5) == 0 if ( std::strncmp(termtype, "xterm", 5) == 0
|| std::strncmp(termtype, C_STR("Eterm"), 5) == 0 ) || std::strncmp(termtype, "Eterm", 5) == 0 )
{ {
terminal_type.xterm = true; terminal_type.xterm = true;
// Each xterm should be able to use at least 16 colors // Each xterm should be able to use at least 16 colors
if ( ! new_termtype && std::strlen(termtype) == 5 ) if ( ! new_termtype && std::strlen(termtype) == 5 )
new_termtype = C_STR("xterm-16color"); new_termtype = "xterm-16color";
} }
// set the new environment variable TERM // set the new environment variable TERM
if ( new_termtype ) if ( new_termtype )
{ {
setenv(C_STR("TERM"), new_termtype, 1); setenv("TERM", new_termtype, 1);
std::strncpy (termtype, new_termtype, sizeof(termtype)); std::strncpy (termtype, new_termtype, sizeof(termtype));
termtype[sizeof(termtype) - 1] = '\0'; termtype[sizeof(termtype) - 1] = '\0';
} }
@ -464,29 +464,29 @@ const char* FTermDetection::termtype_256color_quirks()
color256 = true; color256 = true;
if ( ! isScreenTerm() ) if ( ! isScreenTerm() )
return (new_termtype = C_STR("gnome-256color")); return (new_termtype = "gnome-256color");
} }
if ( ! color256 ) if ( ! color256 )
return new_termtype; return new_termtype;
if ( std::strncmp(termtype, "xterm", 5) == 0 ) if ( std::strncmp(termtype, "xterm", 5) == 0 )
new_termtype = C_STR("xterm-256color"); new_termtype = "xterm-256color";
if ( std::strncmp(termtype, "screen", 6) == 0 ) if ( std::strncmp(termtype, "screen", 6) == 0 )
new_termtype = C_STR("screen-256color"); new_termtype = "screen-256color";
if ( std::strncmp(termtype, "Eterm", 5) == 0 ) if ( std::strncmp(termtype, "Eterm", 5) == 0 )
new_termtype = C_STR("Eterm-256color"); new_termtype = "Eterm-256color";
if ( std::strncmp(termtype, "mlterm", 6) == 0 ) if ( std::strncmp(termtype, "mlterm", 6) == 0 )
new_termtype = C_STR("mlterm-256color"); new_termtype = "mlterm-256color";
if ( std::strncmp(termtype, "rxvt", 4) != 0 if ( std::strncmp(termtype, "rxvt", 4) != 0
&& color_env.string1 && color_env.string1
&& std::strncmp(color_env.string1, "rxvt-xpm", 8) == 0 ) && std::strncmp(color_env.string1, "rxvt-xpm", 8) == 0 )
{ {
new_termtype = C_STR("rxvt-256color"); new_termtype = "rxvt-256color";
terminal_type.rxvt = true; terminal_type.rxvt = true;
} }
@ -494,7 +494,7 @@ const char* FTermDetection::termtype_256color_quirks()
|| (color_env.string6 && std::strlen(color_env.string6) > 0) ) || (color_env.string6 && std::strlen(color_env.string6) > 0) )
{ {
terminal_type.kde_konsole = true; terminal_type.kde_konsole = true;
new_termtype = C_STR("konsole-256color"); new_termtype = "konsole-256color";
} }
if ( color_env.string3 && std::strlen(color_env.string3) > 0 ) if ( color_env.string3 && std::strlen(color_env.string3) > 0 )
@ -522,17 +522,17 @@ const char* FTermDetection::determineMaxColor (const char current_termtype[])
color256 = true; color256 = true;
if ( isPuttyTerminal() ) if ( isPuttyTerminal() )
new_termtype = C_STR("putty-256color"); new_termtype = "putty-256color";
else else
new_termtype = C_STR("xterm-256color"); new_termtype = "xterm-256color";
} }
else if ( ! getXTermColorName(87).isEmpty() ) else if ( ! getXTermColorName(87).isEmpty() )
{ {
new_termtype = C_STR("xterm-88color"); new_termtype = "xterm-88color";
} }
else if ( ! getXTermColorName(15).isEmpty() ) else if ( ! getXTermColorName(15).isEmpty() )
{ {
new_termtype = C_STR("xterm-16color"); new_termtype = "xterm-16color";
} }
} }
@ -598,9 +598,9 @@ const char* FTermDetection::parseAnswerbackMsg (const char current_termtype[])
terminal_type.putty = true; terminal_type.putty = true;
if ( color256 ) if ( color256 )
new_termtype = C_STR("putty-256color"); new_termtype = "putty-256color";
else else
new_termtype = C_STR("putty"); new_termtype = "putty";
} }
// cygwin needs a backspace to delete the '♣' char // cygwin needs a backspace to delete the '♣' char
@ -889,12 +889,12 @@ inline const char* FTermDetection::secDA_Analysis_24 (const char current_termtyp
&& FTermOpenBSD::isBSDConsole() ) && FTermOpenBSD::isBSDConsole() )
{ {
// NetBSD/OpenBSD workstation console // NetBSD/OpenBSD workstation console
if ( std::strncmp(termtype, C_STR("wsvt25"), 6) == 0 ) if ( std::strncmp(termtype, "wsvt25", 6) == 0 )
terminal_type.netbsd_con = true; terminal_type.netbsd_con = true;
else if ( std::strncmp(termtype, C_STR("vt220"), 5) == 0 ) else if ( std::strncmp(termtype, "vt220", 5) == 0 )
{ {
terminal_type.openbsd_con = true; terminal_type.openbsd_con = true;
new_termtype = C_STR("pccon"); new_termtype = "pccon";
} }
} }
@ -909,7 +909,7 @@ inline const char* FTermDetection::secDA_Analysis_32 (const char[])
// Terminal ID 32 - Tera Term // Terminal ID 32 - Tera Term
terminal_type.tera_term = true; terminal_type.tera_term = true;
const char* new_termtype = C_STR("teraterm"); const char* new_termtype = "teraterm";
return new_termtype; return new_termtype;
} }
@ -927,7 +927,7 @@ inline const char* FTermDetection::secDA_Analysis_67 (const char[])
// Terminal ID 67 - cygwin // Terminal ID 67 - cygwin
terminal_type.cygwin = true; terminal_type.cygwin = true;
const char* new_termtype = C_STR("cygwin"); const char* new_termtype = "cygwin";
std::fflush(stdout); std::fflush(stdout);
return new_termtype; return new_termtype;
} }
@ -939,7 +939,7 @@ inline const char* FTermDetection::secDA_Analysis_77 (const char[])
terminal_type.mintty = true; terminal_type.mintty = true;
decscusr_support = true; decscusr_support = true;
const char* new_termtype = C_STR("xterm-256color"); const char* new_termtype = "xterm-256color";
std::fflush(stdout); std::fflush(stdout);
return new_termtype; return new_termtype;
} }
@ -953,9 +953,9 @@ inline const char* FTermDetection::secDA_Analysis_82()
terminal_type.rxvt = true; terminal_type.rxvt = true;
if ( std::strncmp(termtype, "rxvt-cygwin-native", 18) == 0 ) if ( std::strncmp(termtype, "rxvt-cygwin-native", 18) == 0 )
new_termtype = C_STR("rxvt-16color"); new_termtype = "rxvt-16color";
else else
new_termtype = C_STR("rxvt"); new_termtype = "rxvt";
return new_termtype; return new_termtype;
} }
@ -993,9 +993,9 @@ inline const char* FTermDetection::secDA_Analysis_85()
if ( std::strncmp(termtype, "rxvt-", 5) != 0 ) if ( std::strncmp(termtype, "rxvt-", 5) != 0 )
{ {
if ( color256 ) if ( color256 )
new_termtype = C_STR("rxvt-256color"); new_termtype = "rxvt-256color";
else else
new_termtype = C_STR("rxvt"); new_termtype = "rxvt";
} }
else else
new_termtype = termtype; new_termtype = termtype;
@ -1016,7 +1016,7 @@ inline const char* FTermDetection::secDA_Analysis_vte (const char current_termty
terminal_type.gnome_terminal = true; terminal_type.gnome_terminal = true;
// Each gnome-terminal should be able to use 256 colors // Each gnome-terminal should be able to use 256 colors
color256 = true; color256 = true;
new_termtype = C_STR("gnome-256color"); new_termtype = "gnome-256color";
gnome_terminal_id = secondary_da.terminal_id_version; gnome_terminal_id = secondary_da.terminal_id_version;
// VTE 0.40.0 or higher and gnome-terminal 3.16 or higher // VTE 0.40.0 or higher and gnome-terminal 3.16 or higher

View File

@ -496,7 +496,7 @@ FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
int FTermLinux::getFramebuffer_bpp() int FTermLinux::getFramebuffer_bpp()
{ {
int fd{-1}; int fd{-1};
const char* fb = C_STR("/dev/fb/0"); const char* fb = "/dev/fb/0";
struct fb_var_screeninfo fb_var{}; struct fb_var_screeninfo fb_var{};
struct fb_fix_screeninfo fb_fix{}; struct fb_fix_screeninfo fb_fix{};
@ -508,7 +508,7 @@ int FTermLinux::getFramebuffer_bpp()
if ( errno != ENOENT && errno != ENOTDIR ) if ( errno != ENOENT && errno != ENOTDIR )
return -1; return -1;
fb = C_STR("/dev/fb0"); fb = "/dev/fb0";
if ( (fd = fsystem->open(fb, O_RDWR)) < 0 ) if ( (fd = fsystem->open(fb, O_RDWR)) < 0 )
return -1; return -1;

View File

@ -787,16 +787,12 @@ void FTextView::cb_vbarChange (const FWidget*, const FDataPtr)
break; break;
case FScrollbar::scrollWheelUp: case FScrollbar::scrollWheelUp:
{
scrollBy (0, -wheel_distance); scrollBy (0, -wheel_distance);
break; break;
}
case FScrollbar::scrollWheelDown: case FScrollbar::scrollWheelDown:
{
scrollBy (0, wheel_distance); scrollBy (0, wheel_distance);
break; break;
}
} }
update_scrollbar = true; update_scrollbar = true;

View File

@ -843,7 +843,7 @@ void FVTerm::restoreVTerm (const FRect& box)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FVTerm::updateVTermCursor (FTermArea* area) bool FVTerm::updateVTermCursor (const FTermArea* area)
{ {
if ( ! area ) if ( ! area )
return false; return false;
@ -1586,7 +1586,7 @@ void FVTerm::updateInheritBackground ( const FTermArea* area
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::updateCharacter ( FTermArea* area void FVTerm::updateCharacter ( const FTermArea* area
, const FPoint& area_pos , const FPoint& area_pos
, const FPoint& terminal_pos ) , const FPoint& terminal_pos )
{ {
@ -2006,7 +2006,7 @@ void FVTerm::putAreaLine (const FChar* ac, FChar* tc, int length)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::putAreaCharacter ( const FPoint& pos, FVTerm* obj void FVTerm::putAreaCharacter ( const FPoint& pos, FVTerm* obj
, FChar* ac , const FChar* ac
, FChar* tc ) , FChar* tc )
{ {
if ( ac->attr.bit.transparent ) // Transparent if ( ac->attr.bit.transparent ) // Transparent
@ -2478,7 +2478,7 @@ void FVTerm::printFullWidthPaddingCharacter ( uInt& x, uInt y
if ( le ) if ( le )
appendOutputBuffer (le); appendOutputBuffer (le);
else if ( RI ) else if ( RI )
appendOutputBuffer (tparm(RI, 1, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (tparm(C_STR(RI), 1, 0, 0, 0, 0, 0, 0, 0, 0));
else else
{ {
skipPaddingCharacter (x, y, prev_char); skipPaddingCharacter (x, y, prev_char);
@ -2518,7 +2518,7 @@ void FVTerm::printHalfCovertFullWidthCharacter ( uInt& x, uInt y
if ( le ) if ( le )
appendOutputBuffer (le); appendOutputBuffer (le);
else if ( RI ) else if ( RI )
appendOutputBuffer (tparm(RI, 1, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (tparm(C_STR(RI), 1, 0, 0, 0, 0, 0, 0, 0, 0));
if ( le || RI ) if ( le || RI )
{ {
@ -2590,7 +2590,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
&& (ut || normal) ) && (ut || normal) )
{ {
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (tparm(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (tparm(C_STR(ec), whitespace, 0, 0, 0, 0, 0, 0, 0, 0));
if ( x + whitespace - 1 < xmax || draw_trailing_ws ) if ( x + whitespace - 1 < xmax || draw_trailing_ws )
setTermXY (int(x + whitespace), int(y)); setTermXY (int(x + whitespace), int(y));
@ -2655,7 +2655,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
newFontChanges (print_char); newFontChanges (print_char);
charsetChanges (print_char); charsetChanges (print_char);
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (tparm(rp, print_char->ch, repetitions, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (tparm(C_STR(rp), print_char->ch, repetitions, 0, 0, 0, 0, 0, 0, 0));
term_pos->x_ref() += int(repetitions); term_pos->x_ref() += int(repetitions);
x = x + repetitions - 1; x = x + repetitions - 1;
} }
@ -2742,7 +2742,7 @@ bool FVTerm::printWrap (FTermArea* area)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FVTerm::printPaddingCharacter (FTermArea* area, FChar& term_char) void FVTerm::printPaddingCharacter (FTermArea* area, const FChar& term_char)
{ {
// Creates a padding-character from the current character (term_char) // Creates a padding-character from the current character (term_char)
// and prints it. It is a placeholder for the column after // and prints it. It is a placeholder for the column after
@ -3038,7 +3038,7 @@ int FVTerm::appendLowerRight (FChar*& screen_char)
if ( IC ) if ( IC )
{ {
appendOutputBuffer (tparm(IC, 1, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (tparm(C_STR(IC), 1, 0, 0, 0, 0, 0, 0, 0, 0));
appendChar (screen_char); appendChar (screen_char);
} }
else if ( im && ei ) else if ( im && ei )

View File

@ -30,7 +30,7 @@
#include <final/ftypes.h> #include <final/ftypes.h>
// Typecast to c-string // Typecast to c-string
#define C_STR const_cast<const char*> #define C_STR const_cast<char*>
// ASCII sequences // ASCII sequences
#define ESC "\033" // Escape #define ESC "\033" // Escape

View File

@ -370,7 +370,7 @@ class FMouseSGR final : public FMouse
// Methods // Methods
void setKeyState (int); void setKeyState (int);
void setMoveState (const FPoint&, int); void setMoveState (const FPoint&, int);
void setPressedButtonState (const int, struct timeval*); void setPressedButtonState (const int, const struct timeval*);
void setReleasedButtonState (const int); void setReleasedButtonState (const int);
// Data members // Data members

View File

@ -35,9 +35,6 @@
#error "Only <final/final.h> can be included directly." #error "Only <final/final.h> can be included directly."
#endif #endif
// Typecast to c-string
#define C_STR const_cast<const char*>
#include <assert.h> #include <assert.h>
#if defined(__sun) && defined(__SVR4) #if defined(__sun) && defined(__SVR4)

View File

@ -137,18 +137,19 @@ struct FCharAttribute
uInt8 : 8; // padding byte uInt8 : 8; // padding byte
}; };
union attribute
{
FCharAttribute bit;
uInt8 byte[4];
};
typedef struct typedef struct
{ {
wchar_t ch; // character code wchar_t ch; // Character code
wchar_t encoded_char; // encoded output character wchar_t encoded_char; // Encoded output character
FColor fg_color; // foreground color FColor fg_color; // Foreground color
FColor bg_color; // background color FColor bg_color; // Background color
attribute attr; // Attributes
union attribute
{
FCharAttribute bit;
uInt8 byte[4];
} attr;
} FChar; } FChar;

View File

@ -353,7 +353,7 @@ class FVTerm
, FTermArea* ); , FTermArea* );
static void removeArea (FTermArea*&); static void removeArea (FTermArea*&);
static void restoreVTerm (const FRect&); static void restoreVTerm (const FRect&);
bool updateVTermCursor (FTermArea*); bool updateVTermCursor (const FTermArea*);
static void setAreaCursor ( const FPoint& static void setAreaCursor ( const FPoint&
, bool, FTermArea* ); , bool, FTermArea* );
static void getArea (const FPoint&, const FTermArea*); static void getArea (const FPoint&, const FTermArea*);
@ -411,7 +411,7 @@ class FVTerm
static void updateInheritBackground ( const FTermArea* static void updateInheritBackground ( const FTermArea*
, const FPoint& , const FPoint&
, const FPoint& ); , const FPoint& );
static void updateCharacter ( FTermArea* static void updateCharacter ( const FTermArea*
, const FPoint& , const FPoint&
, const FPoint& ); , const FPoint& );
static bool updateVTermCharacter ( FTermArea* static bool updateVTermCharacter ( FTermArea*
@ -433,7 +433,7 @@ class FVTerm
void finish(); void finish();
static void putAreaLine (const FChar*, FChar*, int); static void putAreaLine (const FChar*, FChar*, int);
static void putAreaCharacter ( const FPoint&, FVTerm* static void putAreaCharacter ( const FPoint&, FVTerm*
, FChar*, FChar* ); , const FChar*, FChar* );
static void getAreaCharacter ( const FPoint&, const FTermArea* static void getAreaCharacter ( const FPoint&, const FTermArea*
, FChar*& ); , FChar*& );
bool clearTerm (int = ' '); bool clearTerm (int = ' ');
@ -456,7 +456,7 @@ class FVTerm
bool isFullWidthPaddingChar (const FChar* const&); bool isFullWidthPaddingChar (const FChar* const&);
static void cursorWrap(); static void cursorWrap();
bool printWrap (FTermArea*); bool printWrap (FTermArea*);
void printPaddingCharacter (FTermArea*, FChar&); void printPaddingCharacter (FTermArea*, const FChar&);
void updateTerminalLine (uInt); void updateTerminalLine (uInt);
bool updateTerminalCursor(); bool updateTerminalCursor();
bool isInsideTerminal (const FPoint&); bool isInsideTerminal (const FPoint&);

View File

@ -44,181 +44,181 @@ FKeyMap;
FKeyMap fkey[] = FKeyMap fkey[] =
{ {
{ finalcut::fc::Fkey_backspace , C_STR("\177") , "kb" }, // backspace key { finalcut::fc::Fkey_backspace , "\177" , "kb" }, // backspace key
{ finalcut::fc::Fkey_catab , 0 , "ka" }, // clear-all-tabs key { finalcut::fc::Fkey_catab , 0 , "ka" }, // clear-all-tabs key
{ finalcut::fc::Fkey_clear , 0 , "kC" }, // clear-screen or erase key { finalcut::fc::Fkey_clear , 0 , "kC" }, // clear-screen or erase key
{ finalcut::fc::Fkey_ctab , C_STR(CSI "3~") , "kt" }, // clear-tab key { finalcut::fc::Fkey_ctab , CSI "3~" , "kt" }, // clear-tab key
{ finalcut::fc::Fkey_dc , 0 , "kD" }, // delete-character key { finalcut::fc::Fkey_dc , 0 , "kD" }, // delete-character key
{ finalcut::fc::Fkey_dc , 0 , "kDx" }, // delete-character key { finalcut::fc::Fkey_dc , 0 , "kDx" }, // delete-character key
{ finalcut::fc::Fkey_dl , 0 , "kL" }, // delete-line key { finalcut::fc::Fkey_dl , 0 , "kL" }, // delete-line key
{ finalcut::fc::Fkey_down , C_STR(ESC "OB") , "kd" }, // down-arrow key { finalcut::fc::Fkey_down , ESC "OB" , "kd" }, // down-arrow key
{ finalcut::fc::Fkey_down , C_STR(CSI "B") , "kdx"}, // down-arrow key { finalcut::fc::Fkey_down , CSI "B" , "kdx"}, // down-arrow key
{ finalcut::fc::Fkey_down , C_STR(ESC "OB") , "kd" }, // down-arrow key { finalcut::fc::Fkey_down , ESC "OB" , "kd" }, // down-arrow key
{ finalcut::fc::Fkey_eic , 0 , "kM" }, // sent by rmir or smir in insert mode { finalcut::fc::Fkey_eic , 0 , "kM" }, // sent by rmir or smir in insert mode
{ finalcut::fc::Fkey_eol , 0 , "kE" }, // clear-to-end-of-line key { finalcut::fc::Fkey_eol , 0 , "kE" }, // clear-to-end-of-line key
{ finalcut::fc::Fkey_eos , 0 , "kS" }, // clear-to-end-of-screen key { finalcut::fc::Fkey_eos , 0 , "kS" }, // clear-to-end-of-screen key
{ finalcut::fc::Fkey_f0 , 0 , "k0" }, // F0 function key { finalcut::fc::Fkey_f0 , 0 , "k0" }, // F0 function key
{ finalcut::fc::Fkey_f1 , C_STR(ESC "OP") , "k1" }, // F1 function key { finalcut::fc::Fkey_f1 , ESC "OP" , "k1" }, // F1 function key
{ finalcut::fc::Fkey_f1 , C_STR(CSI "11~") , "k1x"}, // F1 function key { finalcut::fc::Fkey_f1 , CSI "11~" , "k1x"}, // F1 function key
{ finalcut::fc::Fkey_f1 , C_STR(ESC "OP") , "k1X"}, // F1 function key { finalcut::fc::Fkey_f1 , ESC "OP" , "k1X"}, // F1 function key
{ finalcut::fc::Fkey_f2 , C_STR(ESC "OQ") , "k2" }, // F2 function key { finalcut::fc::Fkey_f2 , ESC "OQ" , "k2" }, // F2 function key
{ finalcut::fc::Fkey_f2 , C_STR(CSI "12~") , "k2x"}, // F2 function key { finalcut::fc::Fkey_f2 , CSI "12~" , "k2x"}, // F2 function key
{ finalcut::fc::Fkey_f2 , C_STR(CSI "OQ") , "k2X"}, // F2 function key { finalcut::fc::Fkey_f2 , CSI "OQ" , "k2X"}, // F2 function key
{ finalcut::fc::Fkey_f3 , C_STR(ESC "OR") , "k3" }, // F3 function key { finalcut::fc::Fkey_f3 , ESC "OR" , "k3" }, // F3 function key
{ finalcut::fc::Fkey_f3 , C_STR(CSI "13~") , "k3x"}, // F3 function key { finalcut::fc::Fkey_f3 , CSI "13~" , "k3x"}, // F3 function key
{ finalcut::fc::Fkey_f3 , C_STR(ESC "OR") , "k3X"}, // F3 function key { finalcut::fc::Fkey_f3 , ESC "OR" , "k3X"}, // F3 function key
{ finalcut::fc::Fkey_f4 , C_STR(ESC "OS") , "k4" }, // F4 function key { finalcut::fc::Fkey_f4 , ESC "OS" , "k4" }, // F4 function key
{ finalcut::fc::Fkey_f4 , C_STR(CSI "14~") , "k4x"}, // F4 function key { finalcut::fc::Fkey_f4 , CSI "14~" , "k4x"}, // F4 function key
{ finalcut::fc::Fkey_f4 , C_STR(ESC "OS") , "k4X"}, // F4 function key { finalcut::fc::Fkey_f4 , ESC "OS" , "k4X"}, // F4 function key
{ finalcut::fc::Fkey_f5 , C_STR(CSI "15~") , "k5" }, // F5 function key { finalcut::fc::Fkey_f5 , CSI "15~" , "k5" }, // F5 function key
{ finalcut::fc::Fkey_f6 , C_STR(CSI "17~") , "k6" }, // F6 function key { finalcut::fc::Fkey_f6 , CSI "17~" , "k6" }, // F6 function key
{ finalcut::fc::Fkey_f7 , C_STR(CSI "18~") , "k7" }, // F7 function key { finalcut::fc::Fkey_f7 , CSI "18~" , "k7" }, // F7 function key
{ finalcut::fc::Fkey_f8 , C_STR(CSI "19~") , "k8" }, // F8 fucntion key { finalcut::fc::Fkey_f8 , CSI "19~" , "k8" }, // F8 fucntion key
{ finalcut::fc::Fkey_f9 , C_STR(CSI "20~") , "k9" }, // F9 function key { finalcut::fc::Fkey_f9 , CSI "20~" , "k9" }, // F9 function key
{ finalcut::fc::Fkey_f10 , C_STR(CSI "21~") , "k;" }, // F10 function key { finalcut::fc::Fkey_f10 , CSI "21~" , "k;" }, // F10 function key
{ finalcut::fc::Fkey_home , C_STR(ESC "OH") , "kh" }, // home key { finalcut::fc::Fkey_home , ESC "OH" , "kh" }, // home key
{ finalcut::fc::Fkey_home , C_STR(CSI "7~") , "khx"}, // home key { finalcut::fc::Fkey_home , CSI "7~" , "khx"}, // home key
{ finalcut::fc::Fkey_ic , C_STR(CSI "2~") , "kI" }, // insert-character key { finalcut::fc::Fkey_ic , CSI "2~" , "kI" }, // insert-character key
{ finalcut::fc::Fkey_il , 0 , "kA" }, // insert-line key { finalcut::fc::Fkey_il , 0 , "kA" }, // insert-line key
{ finalcut::fc::Fkey_left , C_STR(ESC "OD") , "kl" }, // left-arrow key { finalcut::fc::Fkey_left , ESC "OD" , "kl" }, // left-arrow key
{ finalcut::fc::Fkey_left , C_STR(CSI "D") , "klx"}, // left-arrow key { finalcut::fc::Fkey_left , CSI "D" , "klx"}, // left-arrow key
{ finalcut::fc::Fkey_left , C_STR(ESC "OD") , "kl" }, // left-arrow key { finalcut::fc::Fkey_left , ESC "OD" , "kl" }, // left-arrow key
{ finalcut::fc::Fkey_ll , 0 , "kH" }, // last-line key { finalcut::fc::Fkey_ll , 0 , "kH" }, // last-line key
{ finalcut::fc::Fkey_npage , C_STR(CSI "6~") , "kN" }, // next-page key { finalcut::fc::Fkey_npage , CSI "6~" , "kN" }, // next-page key
{ finalcut::fc::Fkey_ppage , C_STR(CSI "5~") , "kP" }, // prev-page key { finalcut::fc::Fkey_ppage , CSI "5~" , "kP" }, // prev-page key
{ finalcut::fc::Fkey_right , C_STR(ESC "OC") , "kr" }, // right-arrow key { finalcut::fc::Fkey_right , ESC "OC" , "kr" }, // right-arrow key
{ finalcut::fc::Fkey_right , C_STR(CSI "C") , "krx"}, // right-arrow key { finalcut::fc::Fkey_right , CSI "C" , "krx"}, // right-arrow key
{ finalcut::fc::Fkey_right , C_STR(ESC "OC") , "kr" }, // right-arrow key { finalcut::fc::Fkey_right , ESC "OC" , "kr" }, // right-arrow key
{ finalcut::fc::Fkey_sf , C_STR(CSI "1;2B") , "kF" }, // scroll-forward key (shift-up) { finalcut::fc::Fkey_sf , CSI "1;2B" , "kF" }, // scroll-forward key (shift-up)
{ finalcut::fc::Fkey_sr , C_STR(CSI "1;2A") , "kR" }, // scroll-backward key (shift-down) { finalcut::fc::Fkey_sr , CSI "1;2A" , "kR" }, // scroll-backward key (shift-down)
{ finalcut::fc::Fkey_stab , 0 , "kT" }, // set-tab key { finalcut::fc::Fkey_stab , 0 , "kT" }, // set-tab key
{ finalcut::fc::Fkey_up , C_STR(ESC "OA") , "ku" }, // up-arrow key { finalcut::fc::Fkey_up , ESC "OA" , "ku" }, // up-arrow key
{ finalcut::fc::Fkey_up , C_STR(CSI "A") , "kux"}, // up-arrow key { finalcut::fc::Fkey_up , CSI "A" , "kux"}, // up-arrow key
{ finalcut::fc::Fkey_up , C_STR(ESC "OA") , "ku" }, // up-arrow key { finalcut::fc::Fkey_up , ESC "OA" , "ku" }, // up-arrow key
{ finalcut::fc::Fkey_a1 , 0 , "K1" }, // upper left of keypad { finalcut::fc::Fkey_a1 , 0 , "K1" }, // upper left of keypad
{ finalcut::fc::Fkey_a3 , 0 , "K3" }, // upper right of keypad { finalcut::fc::Fkey_a3 , 0 , "K3" }, // upper right of keypad
{ finalcut::fc::Fkey_b2 , C_STR(CSI "E") , "K2" }, // center of keypad { finalcut::fc::Fkey_b2 , CSI "E" , "K2" }, // center of keypad
{ finalcut::fc::Fkey_c1 , 0 , "K4" }, // lower left of keypad { finalcut::fc::Fkey_c1 , 0 , "K4" }, // lower left of keypad
{ finalcut::fc::Fkey_c3 , 0 , "K5" }, // lower right of keypad { finalcut::fc::Fkey_c3 , 0 , "K5" }, // lower right of keypad
{ finalcut::fc::Fkey_btab , C_STR(CSI "Z") , "kB" }, // back-tab key { finalcut::fc::Fkey_btab , CSI "Z" , "kB" }, // back-tab key
{ finalcut::fc::Fkey_beg , 0 , "@1" }, // begin key { finalcut::fc::Fkey_beg , 0 , "@1" }, // begin key
{ finalcut::fc::Fkey_cancel , 0 , "@2" }, // cancel key { finalcut::fc::Fkey_cancel , 0 , "@2" }, // cancel key
{ finalcut::fc::Fkey_close , 0 , "@3" }, // close key { finalcut::fc::Fkey_close , 0 , "@3" }, // close key
{ finalcut::fc::Fkey_command , 0 , "@4" }, // command key { finalcut::fc::Fkey_command , 0 , "@4" }, // command key
{ finalcut::fc::Fkey_copy , 0 , "@5" }, // copy key { finalcut::fc::Fkey_copy , 0 , "@5" }, // copy key
{ finalcut::fc::Fkey_create , 0 , "@6" }, // create key { finalcut::fc::Fkey_create , 0 , "@6" }, // create key
{ finalcut::fc::Fkey_end , C_STR(ESC "OF") , "@7" }, // end key { finalcut::fc::Fkey_end , ESC "OF" , "@7" }, // end key
{ finalcut::fc::Fkey_end , C_STR(CSI "8~") , "@7x"}, // end key { finalcut::fc::Fkey_end , CSI "8~" , "@7x"}, // end key
{ finalcut::fc::Fkey_end , C_STR(CSI "K") , "@7X"}, // end key { finalcut::fc::Fkey_end , CSI "K" , "@7X"}, // end key
{ finalcut::fc::Fkey_enter , 0 , "@8" }, // enter/send key { finalcut::fc::Fkey_enter , 0 , "@8" }, // enter/send key
{ finalcut::fc::Fkey_enter , C_STR(ESC "OM") , "@8x"}, // enter/send key { finalcut::fc::Fkey_enter , ESC "OM" , "@8x"}, // enter/send key
{ finalcut::fc::Fkey_exit , 0 , "@9" }, // exit key { finalcut::fc::Fkey_exit , 0 , "@9" }, // exit key
{ finalcut::fc::Fkey_find , C_STR(CSI "1~") , "@0" }, // find key { finalcut::fc::Fkey_find , CSI "1~" , "@0" }, // find key
{ finalcut::fc::Fkey_slash , C_STR(ESC "Oo") , "KP1"}, // keypad slash { finalcut::fc::Fkey_slash , ESC "Oo" , "KP1"}, // keypad slash
{ finalcut::fc::Fkey_asterisk , C_STR(ESC "Oj") , "KP2"}, // keypad asterisk { finalcut::fc::Fkey_asterisk , ESC "Oj" , "KP2"}, // keypad asterisk
{ finalcut::fc::Fkey_minus_sign, C_STR(ESC "Om") , "KP3"}, // keypad minus sign { finalcut::fc::Fkey_minus_sign, ESC "Om" , "KP3"}, // keypad minus sign
{ finalcut::fc::Fkey_plus_sign , C_STR(ESC "Ok") , "KP4"}, // keypad plus sign { finalcut::fc::Fkey_plus_sign , ESC "Ok" , "KP4"}, // keypad plus sign
{ finalcut::fc::Fkey_help , 0 , "%1" }, // help key { finalcut::fc::Fkey_help , 0 , "%1" }, // help key
{ finalcut::fc::Fkey_mark , 0 , "%2" }, // mark key { finalcut::fc::Fkey_mark , 0 , "%2" }, // mark key
{ finalcut::fc::Fkey_message , 0 , "%3" }, // message key { finalcut::fc::Fkey_message , 0 , "%3" }, // message key
{ finalcut::fc::Fkey_move , 0 , "%4" }, // move key { finalcut::fc::Fkey_move , 0 , "%4" }, // move key
{ finalcut::fc::Fkey_next , 0 , "%5" }, // next key { finalcut::fc::Fkey_next , 0 , "%5" }, // next key
{ finalcut::fc::Fkey_open , 0 , "%6" }, // open key { finalcut::fc::Fkey_open , 0 , "%6" }, // open key
{ finalcut::fc::Fkey_options , 0 , "%7" }, // options key { finalcut::fc::Fkey_options , 0 , "%7" }, // options key
{ finalcut::fc::Fkey_previous , 0 , "%8" }, // previous key { finalcut::fc::Fkey_previous , 0 , "%8" }, // previous key
{ finalcut::fc::Fkey_print , 0 , "%9" }, // print key { finalcut::fc::Fkey_print , 0 , "%9" }, // print key
{ finalcut::fc::Fkey_redo , 0 , "%0" }, // redo key { finalcut::fc::Fkey_redo , 0 , "%0" }, // redo key
{ finalcut::fc::Fkey_reference , 0 , "&1" }, // reference key { finalcut::fc::Fkey_reference , 0 , "&1" }, // reference key
{ finalcut::fc::Fkey_refresh , 0 , "&2" }, // refresh key { finalcut::fc::Fkey_refresh , 0 , "&2" }, // refresh key
{ finalcut::fc::Fkey_replace , 0 , "&3" }, // replace key { finalcut::fc::Fkey_replace , 0 , "&3" }, // replace key
{ finalcut::fc::Fkey_restart , 0 , "&4" }, // restart key { finalcut::fc::Fkey_restart , 0 , "&4" }, // restart key
{ finalcut::fc::Fkey_resume , 0 , "&5" }, // resume key { finalcut::fc::Fkey_resume , 0 , "&5" }, // resume key
{ finalcut::fc::Fkey_save , 0 , "&6" }, // save key { finalcut::fc::Fkey_save , 0 , "&6" }, // save key
{ finalcut::fc::Fkey_suspend , 0 , "&7" }, // suspend key { finalcut::fc::Fkey_suspend , 0 , "&7" }, // suspend key
{ finalcut::fc::Fkey_undo , 0 , "&8" }, // undo key { finalcut::fc::Fkey_undo , 0 , "&8" }, // undo key
{ finalcut::fc::Fkey_sbeg , 0 , "&9" }, // shifted begin key { finalcut::fc::Fkey_sbeg , 0 , "&9" }, // shifted begin key
{ finalcut::fc::Fkey_scancel , 0 , "&0" }, // shifted cancel key { finalcut::fc::Fkey_scancel , 0 , "&0" }, // shifted cancel key
{ finalcut::fc::Fkey_scommand , 0 , "*1" }, // shifted command key { finalcut::fc::Fkey_scommand , 0 , "*1" }, // shifted command key
{ finalcut::fc::Fkey_scopy , 0 , "*2" }, // shifted copy key { finalcut::fc::Fkey_scopy , 0 , "*2" }, // shifted copy key
{ finalcut::fc::Fkey_screate , 0 , "*3" }, // shifted create key { finalcut::fc::Fkey_screate , 0 , "*3" }, // shifted create key
{ finalcut::fc::Fkey_sdc , C_STR(CSI "3;2~") , "*4" }, // shifted delete-character key { finalcut::fc::Fkey_sdc , CSI "3;2~" , "*4" }, // shifted delete-character key
{ finalcut::fc::Fkey_sdl , 0 , "*5" }, // shifted delete-line key { finalcut::fc::Fkey_sdl , 0 , "*5" }, // shifted delete-line key
{ finalcut::fc::Fkey_select , C_STR(CSI "4~") , "*6" }, // select key { finalcut::fc::Fkey_select , CSI "4~" , "*6" }, // select key
{ finalcut::fc::Fkey_send , C_STR(CSI "1;2F") , "*7" }, // shifted end key { finalcut::fc::Fkey_send , CSI "1;2F" , "*7" }, // shifted end key
{ finalcut::fc::Fkey_seol , 0 , "*8" }, // shifted clear-to-end-of-line key { finalcut::fc::Fkey_seol , 0 , "*8" }, // shifted clear-to-end-of-line key
{ finalcut::fc::Fkey_sexit , 0 , "*9" }, // shifted exit key { finalcut::fc::Fkey_sexit , 0 , "*9" }, // shifted exit key
{ finalcut::fc::Fkey_sfind , 0 , "*0" }, // shifted find key { finalcut::fc::Fkey_sfind , 0 , "*0" }, // shifted find key
{ finalcut::fc::Fkey_shelp , 0 , "#1" }, // shifted help key { finalcut::fc::Fkey_shelp , 0 , "#1" }, // shifted help key
{ finalcut::fc::Fkey_shome , C_STR(CSI "1;2H") , "#2" }, // shifted home key { finalcut::fc::Fkey_shome , CSI "1;2H" , "#2" }, // shifted home key
{ finalcut::fc::Fkey_sic , C_STR(CSI "2;2~") , "#3" }, // shifted insert-character key { finalcut::fc::Fkey_sic , CSI "2;2~" , "#3" }, // shifted insert-character key
{ finalcut::fc::Fkey_sleft , C_STR(CSI "1;2D") , "#4" }, // shifted left-arrow key { finalcut::fc::Fkey_sleft , CSI "1;2D" , "#4" }, // shifted left-arrow key
{ finalcut::fc::Fkey_smessage , 0 , "%a" }, // shifted message key { finalcut::fc::Fkey_smessage , 0 , "%a" }, // shifted message key
{ finalcut::fc::Fkey_smove , 0 , "%b" }, // shifted move key { finalcut::fc::Fkey_smove , 0 , "%b" }, // shifted move key
{ finalcut::fc::Fkey_snext , C_STR(CSI "6;2~") , "%c" }, // shifted next key { finalcut::fc::Fkey_snext , CSI "6;2~" , "%c" }, // shifted next key
{ finalcut::fc::Fkey_soptions , 0 , "%d" }, // shifted options key { finalcut::fc::Fkey_soptions , 0 , "%d" }, // shifted options key
{ finalcut::fc::Fkey_sprevious , C_STR(CSI "5;2~") , "%e" }, // shifted previous key { finalcut::fc::Fkey_sprevious , CSI "5;2~" , "%e" }, // shifted previous key
{ finalcut::fc::Fkey_sprint , 0 , "%f" }, // shifted print key { finalcut::fc::Fkey_sprint , 0 , "%f" }, // shifted print key
{ finalcut::fc::Fkey_sredo , 0 , "%g" }, // shifted redo key { finalcut::fc::Fkey_sredo , 0 , "%g" }, // shifted redo key
{ finalcut::fc::Fkey_sreplace , 0 , "%h" }, // shifted replace key { finalcut::fc::Fkey_sreplace , 0 , "%h" }, // shifted replace key
{ finalcut::fc::Fkey_sright , C_STR(CSI "1;2C") , "%i" }, // shifted right-arrow key { finalcut::fc::Fkey_sright , CSI "1;2C" , "%i" }, // shifted right-arrow key
{ finalcut::fc::Fkey_srsume , 0 , "%j" }, // shifted resume key { finalcut::fc::Fkey_srsume , 0 , "%j" }, // shifted resume key
{ finalcut::fc::Fkey_ssave , 0 , "!1" }, // shifted save key { finalcut::fc::Fkey_ssave , 0 , "!1" }, // shifted save key
{ finalcut::fc::Fkey_ssuspend , 0 , "!2" }, // shifted suspend key { finalcut::fc::Fkey_ssuspend , 0 , "!2" }, // shifted suspend key
{ finalcut::fc::Fkey_sundo , 0 , "!3" }, // shifted undo key { finalcut::fc::Fkey_sundo , 0 , "!3" }, // shifted undo key
{ finalcut::fc::Fkey_f11 , C_STR(CSI "23~") , "F1" }, // F11 function key { finalcut::fc::Fkey_f11 , CSI "23~" , "F1" }, // F11 function key
{ finalcut::fc::Fkey_f12 , C_STR(CSI "24~") , "F2" }, // F12 function key { finalcut::fc::Fkey_f12 , CSI "24~" , "F2" }, // F12 function key
{ finalcut::fc::Fkey_f13 , C_STR(ESC "O1;2P"), "F3" }, // F13 function key { finalcut::fc::Fkey_f13 , ESC "O1;2P", "F3" }, // F13 function key
{ finalcut::fc::Fkey_f14 , C_STR(ESC "O1;2Q"), "F4" }, // F14 function key { finalcut::fc::Fkey_f14 , ESC "O1;2Q", "F4" }, // F14 function key
{ finalcut::fc::Fkey_f15 , C_STR(ESC "O1;2R"), "F5" }, // F15 function key { finalcut::fc::Fkey_f15 , ESC "O1;2R", "F5" }, // F15 function key
{ finalcut::fc::Fkey_f16 , C_STR(ESC "O1;2S"), "F6" }, // F16 function key { finalcut::fc::Fkey_f16 , ESC "O1;2S", "F6" }, // F16 function key
{ finalcut::fc::Fkey_f17 , C_STR(CSI "15;2~"), "F7" }, // F17 function key { finalcut::fc::Fkey_f17 , CSI "15;2~", "F7" }, // F17 function key
{ finalcut::fc::Fkey_f18 , C_STR(CSI "17;2~"), "F8" }, // F18 function key { finalcut::fc::Fkey_f18 , CSI "17;2~", "F8" }, // F18 function key
{ finalcut::fc::Fkey_f19 , C_STR(CSI "18;2~"), "F9" }, // F19 function key { finalcut::fc::Fkey_f19 , CSI "18;2~", "F9" }, // F19 function key
{ finalcut::fc::Fkey_f20 , C_STR(CSI "19;2~"), "FA" }, // F20 function key { finalcut::fc::Fkey_f20 , CSI "19;2~", "FA" }, // F20 function key
{ finalcut::fc::Fkey_f21 , C_STR(CSI "20;2~"), "FB" }, // F21 function key { finalcut::fc::Fkey_f21 , CSI "20;2~", "FB" }, // F21 function key
{ finalcut::fc::Fkey_f22 , C_STR(CSI "21;2~"), "FC" }, // F22 function key { finalcut::fc::Fkey_f22 , CSI "21;2~", "FC" }, // F22 function key
{ finalcut::fc::Fkey_f23 , C_STR(CSI "23;2~"), "FD" }, // F23 function key { finalcut::fc::Fkey_f23 , CSI "23;2~", "FD" }, // F23 function key
{ finalcut::fc::Fkey_f24 , C_STR(CSI "24;2~"), "FE" }, // F24 function key { finalcut::fc::Fkey_f24 , CSI "24;2~", "FE" }, // F24 function key
{ finalcut::fc::Fkey_f25 , C_STR(ESC "O1;5P"), "FF" }, // F25 function key { finalcut::fc::Fkey_f25 , ESC "O1;5P", "FF" }, // F25 function key
{ finalcut::fc::Fkey_f26 , C_STR(ESC "O1;5Q"), "FG" }, // F26 function key { finalcut::fc::Fkey_f26 , ESC "O1;5Q", "FG" }, // F26 function key
{ finalcut::fc::Fkey_f27 , C_STR(ESC "O1;5R"), "FH" }, // F27 function key { finalcut::fc::Fkey_f27 , ESC "O1;5R", "FH" }, // F27 function key
{ finalcut::fc::Fkey_f28 , C_STR(ESC "O1;5S"), "FI" }, // F28 function key { finalcut::fc::Fkey_f28 , ESC "O1;5S", "FI" }, // F28 function key
{ finalcut::fc::Fkey_f29 , C_STR(CSI "15;5~"), "FJ" }, // F29 function key { finalcut::fc::Fkey_f29 , CSI "15;5~", "FJ" }, // F29 function key
{ finalcut::fc::Fkey_f30 , C_STR(CSI "17;5~"), "FK" }, // F30 function key { finalcut::fc::Fkey_f30 , CSI "17;5~", "FK" }, // F30 function key
{ finalcut::fc::Fkey_f31 , C_STR(CSI "18;5~"), "FL" }, // F31 function key { finalcut::fc::Fkey_f31 , CSI "18;5~", "FL" }, // F31 function key
{ finalcut::fc::Fkey_f32 , C_STR(CSI "19;5~"), "FM" }, // F32 function key { finalcut::fc::Fkey_f32 , CSI "19;5~", "FM" }, // F32 function key
{ finalcut::fc::Fkey_f33 , C_STR(CSI "20;5~"), "FN" }, // F33 function key { finalcut::fc::Fkey_f33 , CSI "20;5~", "FN" }, // F33 function key
{ finalcut::fc::Fkey_f34 , C_STR(CSI "21;5~"), "FO" }, // F34 function key { finalcut::fc::Fkey_f34 , CSI "21;5~", "FO" }, // F34 function key
{ finalcut::fc::Fkey_f35 , C_STR(CSI "23;5~"), "FP" }, // F35 function key { finalcut::fc::Fkey_f35 , CSI "23;5~", "FP" }, // F35 function key
{ finalcut::fc::Fkey_f36 , C_STR(CSI "24;5~"), "FQ" }, // F36 function key { finalcut::fc::Fkey_f36 , CSI "24;5~", "FQ" }, // F36 function key
{ finalcut::fc::Fkey_f37 , C_STR(ESC "O1;6P"), "FR" }, // F37 function key { finalcut::fc::Fkey_f37 , ESC "O1;6P", "FR" }, // F37 function key
{ finalcut::fc::Fkey_f38 , C_STR(ESC "O1;6Q"), "FS" }, // F38 function key { finalcut::fc::Fkey_f38 , ESC "O1;6Q", "FS" }, // F38 function key
{ finalcut::fc::Fkey_f39 , C_STR(ESC "O1;6R"), "FT" }, // F39 function key { finalcut::fc::Fkey_f39 , ESC "O1;6R", "FT" }, // F39 function key
{ finalcut::fc::Fkey_f40 , C_STR(ESC "O1;6S"), "FU" }, // F40 function key { finalcut::fc::Fkey_f40 , ESC "O1;6S", "FU" }, // F40 function key
{ finalcut::fc::Fkey_f41 , C_STR(CSI "15;6~"), "FV" }, // F41 function key { finalcut::fc::Fkey_f41 , CSI "15;6~", "FV" }, // F41 function key
{ finalcut::fc::Fkey_f42 , C_STR(CSI "17;6~"), "FW" }, // F42 function key { finalcut::fc::Fkey_f42 , CSI "17;6~", "FW" }, // F42 function key
{ finalcut::fc::Fkey_f43 , C_STR(CSI "18;6~"), "FX" }, // F43 function key { finalcut::fc::Fkey_f43 , CSI "18;6~", "FX" }, // F43 function key
{ finalcut::fc::Fkey_f44 , C_STR(CSI "19;6~"), "FY" }, // F44 function key { finalcut::fc::Fkey_f44 , CSI "19;6~", "FY" }, // F44 function key
{ finalcut::fc::Fkey_f45 , C_STR(CSI "20;6~"), "FZ" }, // F45 function key { finalcut::fc::Fkey_f45 , CSI "20;6~", "FZ" }, // F45 function key
{ finalcut::fc::Fkey_f46 , C_STR(CSI "21;6~"), "Fa" }, // F46 function key { finalcut::fc::Fkey_f46 , CSI "21;6~", "Fa" }, // F46 function key
{ finalcut::fc::Fkey_f47 , C_STR(CSI "23;6~"), "Fb" }, // F47 function key { finalcut::fc::Fkey_f47 , CSI "23;6~", "Fb" }, // F47 function key
{ finalcut::fc::Fkey_f48 , C_STR(CSI "24;6~"), "Fc" }, // F48 function key { finalcut::fc::Fkey_f48 , CSI "24;6~", "Fc" }, // F48 function key
{ finalcut::fc::Fkey_f49 , C_STR(ESC "O1;3P"), "Fd" }, // F49 function key { finalcut::fc::Fkey_f49 , ESC "O1;3P", "Fd" }, // F49 function key
{ finalcut::fc::Fkey_f50 , C_STR(ESC "O1;3Q"), "Fe" }, // F50 function key { finalcut::fc::Fkey_f50 , ESC "O1;3Q", "Fe" }, // F50 function key
{ finalcut::fc::Fkey_f51 , C_STR(ESC "O1;3R"), "Ff" }, // F51 function key { finalcut::fc::Fkey_f51 , ESC "O1;3R", "Ff" }, // F51 function key
{ finalcut::fc::Fkey_f52 , C_STR(ESC "O1;3S"), "Fg" }, // F52 function key { finalcut::fc::Fkey_f52 , ESC "O1;3S", "Fg" }, // F52 function key
{ finalcut::fc::Fkey_f53 , C_STR(CSI "15;3~"), "Fh" }, // F53 function key { finalcut::fc::Fkey_f53 , CSI "15;3~", "Fh" }, // F53 function key
{ finalcut::fc::Fkey_f54 , C_STR(CSI "17;3~"), "Fi" }, // F54 function key { finalcut::fc::Fkey_f54 , CSI "17;3~", "Fi" }, // F54 function key
{ finalcut::fc::Fkey_f55 , C_STR(CSI "18;3~"), "Fj" }, // F55 function key { finalcut::fc::Fkey_f55 , CSI "18;3~", "Fj" }, // F55 function key
{ finalcut::fc::Fkey_f56 , C_STR(CSI "19;3~"), "Fk" }, // F56 function key { finalcut::fc::Fkey_f56 , CSI "19;3~", "Fk" }, // F56 function key
{ finalcut::fc::Fkey_f57 , C_STR(CSI "20;3~"), "Fl" }, // F57 function key { finalcut::fc::Fkey_f57 , CSI "20;3~", "Fl" }, // F57 function key
{ finalcut::fc::Fkey_f58 , C_STR(CSI "21;3~"), "Fm" }, // F58 function key { finalcut::fc::Fkey_f58 , CSI "21;3~", "Fm" }, // F58 function key
{ finalcut::fc::Fkey_f59 , C_STR(CSI "23;3~"), "Fn" }, // F59 function key { finalcut::fc::Fkey_f59 , CSI "23;3~", "Fn" }, // F59 function key
{ finalcut::fc::Fkey_f60 , C_STR(CSI "24;3~"), "Fo" }, // F60 function key { finalcut::fc::Fkey_f60 , CSI "24;3~", "Fo" }, // F60 function key
{ finalcut::fc::Fkey_f61 , C_STR(ESC "O1;4P"), "Fp" }, // F61 function key { finalcut::fc::Fkey_f61 , ESC "O1;4P", "Fp" }, // F61 function key
{ finalcut::fc::Fkey_f62 , C_STR(ESC "O1;4Q"), "Fq" }, // F62 function key { finalcut::fc::Fkey_f62 , ESC "O1;4Q", "Fq" }, // F62 function key
{ finalcut::fc::Fkey_f63 , C_STR(ESC "O1;4R"), "Fr" }, // F63 function key { finalcut::fc::Fkey_f63 , ESC "O1;4R", "Fr" }, // F63 function key
{ 0 , 0 , "\0" } { 0 , 0 , "\0" }
}; };
} // namespace test } // namespace test

File diff suppressed because it is too large Load Diff

View File

@ -117,8 +117,8 @@ void FOptiMoveTest::classNameTest()
void FOptiMoveTest::noArgumentTest() void FOptiMoveTest::noArgumentTest()
{ {
finalcut::FOptiMove om; finalcut::FOptiMove om;
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 1, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 1, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 9, 9), C_STR(CSI "10;10H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 9, 9), CSI "10;10H");
// Delete all presets // Delete all presets
om.set_tabular (0); om.set_tabular (0);
@ -147,22 +147,22 @@ void FOptiMoveTest::homeTest()
int baud = 4800; int baud = 4800;
finalcut::FOptiMove om(baud); finalcut::FOptiMove om(baud);
om.setTermSize (80, 24); om.setTermSize (80, 24);
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_cursor_to_ll (C_STR(CSI "X")); om.set_cursor_to_ll (CSI "X");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(CSI "A")); om.set_cursor_up (CSI "A");
om.set_cursor_down (C_STR(CSI "B")); om.set_cursor_down (CSI "B");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR(CSI "D")); om.set_cursor_left (CSI "D");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
// Upper home (first line, first column) // Upper home (first line, first column)
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 10, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 10, 0, 0), CSI "H");
// Lower home (last line, first column) // Lower home (last line, first column)
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 10, 0, 23), C_STR(CSI "X")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 10, 0, 23), CSI "X");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -174,21 +174,21 @@ void FOptiMoveTest::fromLeftToRightTest()
om.setTabStop (8); om.setTabStop (8);
om.set_auto_left_margin (true); om.set_auto_left_margin (true);
om.set_eat_newline_glitch (false); om.set_eat_newline_glitch (false);
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(ESC "M")); om.set_cursor_up (ESC "M");
om.set_cursor_down (C_STR(ESC "D")); om.set_cursor_down (ESC "D");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH");
om.set_column_address (C_STR(CSI "%i%p1%dG")); om.set_column_address (CSI "%i%p1%dG");
om.set_row_address (C_STR(CSI "%i%p1%dd")); om.set_row_address (CSI "%i%p1%dd");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 1), C_STR("\r\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 1), "\r\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR("\r\b" ESC "D")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), "\r\b" ESC "D");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -198,55 +198,55 @@ void FOptiMoveTest::ansiTest()
om.setTermSize (80, 25); om.setTermSize (80, 25);
om.setBaudRate (19200); om.setBaudRate (19200);
om.setTabStop (8); om.setTabStop (8);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_back_tab (C_STR(CSI "Z")); om.set_back_tab (CSI "Z");
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(CSI "A")); om.set_cursor_up (CSI "A");
om.set_cursor_down (C_STR(CSI "B")); om.set_cursor_down (CSI "B");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR(CSI "D")); om.set_cursor_left (CSI "D");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH");
om.set_column_address (C_STR(CSI "%i%p1%dG")); om.set_column_address (CSI "%i%p1%dG");
om.set_row_address (C_STR(CSI "%i%p1%dd")); om.set_row_address (CSI "%i%p1%dd");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r" CSI "B")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR(CSI "D")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), CSI "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "12G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR(CSI "10G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), CSI "10G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR(CSI "B")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(CSI "A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR(CSI "3d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "Z")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\r\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), C_STR(CSI "25d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), CSI "25d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -257,52 +257,52 @@ void FOptiMoveTest::vt100Test()
om.setBaudRate (1200); om.setBaudRate (1200);
om.setTabStop (8); om.setTabStop (8);
om.set_eat_newline_glitch (true); om.set_eat_newline_glitch (true);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(CSI "A$<2>")); om.set_cursor_up (CSI "A$<2>");
om.set_cursor_down (C_STR("\n")); om.set_cursor_down ("\n");
om.set_cursor_right (C_STR(CSI "C$<2>")); om.set_cursor_right (CSI "C$<2>");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH$<5>")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH$<5>");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H$<5>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C$<2>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C$<2>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "2C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "2C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(CSI "A$<2>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A$<2>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR("\n\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(CSI "2A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "2A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "76C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "76C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H$<5>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "7D")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "7D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H$<5>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H$<5>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H$<5>");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H$<5>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H$<5>")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H$<5>");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "26C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "26C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(CSI "2A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "2A");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -313,55 +313,55 @@ void FOptiMoveTest::xtermTest()
om.setBaudRate (38400); om.setBaudRate (38400);
om.setTabStop (8); om.setTabStop (8);
om.set_eat_newline_glitch (true); om.set_eat_newline_glitch (true);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_back_tab (C_STR(CSI "Z")); om.set_back_tab (CSI "Z");
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(CSI "A")); om.set_cursor_up (CSI "A");
om.set_cursor_down (C_STR("\n")); om.set_cursor_down ("\n");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH");
om.set_column_address (C_STR(CSI "%i%p1%dG")); om.set_column_address (CSI "%i%p1%dG");
om.set_row_address (C_STR(CSI "%i%p1%dd")); om.set_row_address (CSI "%i%p1%dd");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "12G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(CSI "A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR("\n\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "Z")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\r\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -372,54 +372,54 @@ void FOptiMoveTest::rxvtTest()
om.setBaudRate (38400); om.setBaudRate (38400);
om.setTabStop (8); om.setTabStop (8);
om.set_eat_newline_glitch (true); om.set_eat_newline_glitch (true);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(CSI "A")); om.set_cursor_up (CSI "A");
om.set_cursor_down (C_STR("\n")); om.set_cursor_down ("\n");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH");
om.set_column_address (C_STR(CSI "%i%p1%dG")); om.set_column_address (CSI "%i%p1%dG");
om.set_row_address (C_STR(CSI "%i%p1%dd")); om.set_row_address (CSI "%i%p1%dd");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "12G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(CSI "A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR("\n\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "33G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -430,55 +430,55 @@ void FOptiMoveTest::linuxTest()
om.setBaudRate (38400); om.setBaudRate (38400);
om.setTabStop (8); om.setTabStop (8);
om.set_eat_newline_glitch (true); om.set_eat_newline_glitch (true);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_back_tab (C_STR(CSI "Z")); om.set_back_tab (CSI "Z");
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(CSI "A")); om.set_cursor_up (CSI "A");
om.set_cursor_down (C_STR("\n")); om.set_cursor_down ("\n");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH");
om.set_column_address (C_STR(CSI "%i%p1%dG")); om.set_column_address (CSI "%i%p1%dG");
om.set_row_address (C_STR(CSI "%i%p1%dd")); om.set_row_address (CSI "%i%p1%dd");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "12G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(CSI "A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR("\n\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "Z")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\r\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -488,57 +488,57 @@ void FOptiMoveTest::cygwinTest()
om.setTermSize (80, 25); om.setTermSize (80, 25);
om.setBaudRate (38400); om.setBaudRate (38400);
om.setTabStop (8); om.setTabStop (8);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_back_tab (C_STR(CSI "Z")); om.set_back_tab (CSI "Z");
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(CSI "A")); om.set_cursor_up (CSI "A");
om.set_cursor_down (C_STR(CSI "B")); om.set_cursor_down (CSI "B");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH");
om.set_column_address (C_STR(CSI "%i%p1%dG")); om.set_column_address (CSI "%i%p1%dG");
om.set_row_address (C_STR(CSI "%i%p1%dd")); om.set_row_address (CSI "%i%p1%dd");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING ( printSequence(om.moveCursor (1, 2, 3, 4)).c_str() CPPUNIT_ASSERT_CSTRING ( printSequence(om.moveCursor (1, 2, 3, 4)).c_str()
, C_STR("Esc [ 5 ; 4 H ") ); , "Esc [ 5 ; 4 H ") ;
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r" CSI "B")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "12G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR(CSI "B")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(CSI "A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR(CSI "3d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "Z")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\r\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), C_STR(CSI "B")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -550,55 +550,55 @@ void FOptiMoveTest::puttyTest()
om.setTabStop (8); om.setTabStop (8);
om.set_auto_left_margin (true); om.set_auto_left_margin (true);
om.set_eat_newline_glitch (true); om.set_eat_newline_glitch (true);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_back_tab (C_STR(CSI "Z")); om.set_back_tab (CSI "Z");
om.set_cursor_home (C_STR(CSI "H")); om.set_cursor_home (CSI "H");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR(ESC "M")); om.set_cursor_up (ESC "M");
om.set_cursor_down (C_STR(ESC "D")); om.set_cursor_down (ESC "D");
om.set_cursor_right (C_STR(CSI "C")); om.set_cursor_right (CSI "C");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(CSI "%i%p1%d;%p2%dH")); om.set_cursor_address (CSI "%i%p1%d;%p2%dH");
om.set_column_address (C_STR(CSI "%i%p1%dG")); om.set_column_address (CSI "%i%p1%dG");
om.set_row_address (C_STR(CSI "%i%p1%dd")); om.set_row_address (CSI "%i%p1%dd");
om.set_parm_up_cursor (C_STR(CSI "%p1%dA")); om.set_parm_up_cursor (CSI "%p1%dA");
om.set_parm_down_cursor (C_STR(CSI "%p1%dB")); om.set_parm_down_cursor (CSI "%p1%dB");
om.set_parm_right_cursor (C_STR(CSI "%p1%dC")); om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (C_STR(CSI "%p1%dD")); om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r" ESC "D")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "12G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR(ESC "D")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(ESC "M")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), ESC "M");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR(ESC "D" ESC "D")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), ESC "D" ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(ESC "M" ESC "M")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), ESC "M" ESC "M");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "Z")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\r\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), C_STR(ESC "D")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(ESC "M" ESC "M")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), ESC "M" ESC "M");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -610,26 +610,26 @@ void FOptiMoveTest::teratermTest()
finalcut::FOptiMove::termEnv optimove_env = finalcut::FOptiMove::termEnv optimove_env =
{ {
C_STR(CSI "H"), // Cursor home CSI "H", // Cursor home
C_STR("\r"), // Carriage return "\r", // Carriage return
0, // Cursor to ll 0, // Cursor to ll
C_STR("\t"), // Tabular "\t", // Tabular
0, // Back tabular 0, // Back tabular
C_STR(CSI "A"), // Cursor up CSI "A", // Cursor up
C_STR("\n"), // Cursor down "\n", // Cursor down
C_STR("\b"), // Cursor left "\b", // Cursor left
C_STR(CSI "C"), // Cursor right CSI "C", // Cursor right
C_STR(CSI "%i%p1%d;%p2%dH"), // Cursor address CSI "%i%p1%d;%p2%dH", // Cursor address
C_STR(CSI "%i%p1%dG"), // Column address CSI "%i%p1%dG", // Column address
C_STR(CSI "%i%p1%dd"), // Row address CSI "%i%p1%dd", // Row address
C_STR(CSI "%p1%dA"), // Parm up cursor CSI "%p1%dA", // Parm up cursor
C_STR(CSI "%p1%dB"), // Parm down cursor CSI "%p1%dB", // Parm down cursor
C_STR(CSI "%p1%dD"), // Parm left cursor CSI "%p1%dD", // Parm left cursor
C_STR(CSI "%p1%dC"), // Parm right cursor CSI "%p1%dC", // Parm right cursor
C_STR(CSI "%p1%dX"), // Erase characters CSI "%p1%dX", // Erase characters
0, // Repeat character 0, // Repeat character
C_STR(CSI "1K"), // Clear to beginning of line CSI "1K", // Clear to beginning of line
C_STR(CSI "K"), // Clear to end of line CSI "K", // Clear to end of line
8, // Tab stop 8, // Tab stop
false, // Automatic left margin false, // Automatic left margin
true // Eat newline glitch true // Eat newline glitch
@ -637,39 +637,39 @@ void FOptiMoveTest::teratermTest()
om.setTermEnvironment(optimove_env); om.setTermEnvironment(optimove_env);
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(CSI "6;6H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR(CSI "H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR(CSI "C")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR(CSI "12G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR("\t")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR(CSI "A")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR("\n\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(CSI "21;76H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(CSI "33G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(CSI "11;80H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(CSI "11;51H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(CSI "11;24H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(CSI "11;13H")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR(CSI "80G")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR(CSI "1d")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
} }
@ -680,54 +680,54 @@ void FOptiMoveTest::wyse50Test()
om.setTermSize (80, 25); om.setTermSize (80, 25);
om.setBaudRate (38400); om.setBaudRate (38400);
om.set_auto_left_margin (true); om.set_auto_left_margin (true);
om.set_tabular (C_STR("\t")); om.set_tabular ("\t");
om.set_back_tab (C_STR(ESC "I")); om.set_back_tab (ESC "I");
om.set_cursor_home (C_STR("\036")); om.set_cursor_home ("\036");
om.set_cursor_to_ll (C_STR("\036\v")); om.set_cursor_to_ll ("\036\v");
om.set_carriage_return (C_STR("\r")); om.set_carriage_return ("\r");
om.set_cursor_up (C_STR("\v")); om.set_cursor_up ("\v");
om.set_cursor_down (C_STR("\n")); om.set_cursor_down ("\n");
om.set_cursor_right (C_STR("\f")); om.set_cursor_right ("\f");
om.set_cursor_left (C_STR("\b")); om.set_cursor_left ("\b");
om.set_cursor_address (C_STR(ESC "=%p1%' '%+%c%p2%' '%+%c")); om.set_cursor_address (ESC "=%p1%' '%+%c%p2%' '%+%c");
//std::cout << "\nSequence: " //std::cout << "\nSequence: "
// << printSequence(om.moveCursor (1, 2, 3, 4)) // << printSequence(om.moveCursor (1, 2, 3, 4))
// << "\n"; // << "\n";
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), C_STR(ESC "=%%")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), ESC "=%%");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), C_STR("\036")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), "\036");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), C_STR("\r\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), C_STR("\f")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), "\f");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), C_STR("\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), C_STR("\f\f")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), "\f\f");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), C_STR(ESC "= (")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), ESC "= (");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), C_STR("\v")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), "\v");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), C_STR("\n\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), C_STR("\v\v")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), "\v\v");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), C_STR("\r\b\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), "\r\b\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), C_STR(ESC "=4k")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), ESC "=4k");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), C_STR(ESC "= @")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), ESC "= @");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), C_STR("\b\b")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen // xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), C_STR(ESC "=*o")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), ESC "=*o");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), C_STR(ESC "=*R")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), ESC "=*R");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), C_STR(ESC "=*7")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), ESC "=*7");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), C_STR(ESC "=*,")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), ESC "=*,");
// xnew is outside screen // xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), C_STR("\r\b\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), "\r\b\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), C_STR("\r")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen // ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), C_STR("\n")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), C_STR("\v\v")); CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), "\v\v");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -484,6 +484,9 @@ void FStringTest::additionTest()
{ {
// finalcut::FString member operator // finalcut::FString member operator
const finalcut::FString s1("abc"); const finalcut::FString s1("abc");
CPPUNIT_ASSERT ( s1.getLength() == 3 );
CPPUNIT_ASSERT ( *(s1.c_str() + s1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(s1.wc_str() + s1.getLength()) == L'\0' );
CPPUNIT_ASSERT ( s1 + finalcut::FString("def") == L"abcdef" ); CPPUNIT_ASSERT ( s1 + finalcut::FString("def") == L"abcdef" );
CPPUNIT_ASSERT ( s1 + std::wstring(L"def") == L"abcdef" ); CPPUNIT_ASSERT ( s1 + std::wstring(L"def") == L"abcdef" );
CPPUNIT_ASSERT ( s1 + const_cast<wchar_t*>(L"def") == L"abcdef" ); CPPUNIT_ASSERT ( s1 + const_cast<wchar_t*>(L"def") == L"abcdef" );
@ -492,8 +495,12 @@ void FStringTest::additionTest()
CPPUNIT_ASSERT ( s1 + wchar_t(L'd') == L"abcd" ); CPPUNIT_ASSERT ( s1 + wchar_t(L'd') == L"abcd" );
CPPUNIT_ASSERT ( s1 + char('d') == L"abcd" ); CPPUNIT_ASSERT ( s1 + char('d') == L"abcd" );
// finalcut::FString non-member operator // finalcut::FString non-member operator
finalcut::FString s2("abc"); finalcut::FString s2("abc");
CPPUNIT_ASSERT ( s2.getLength() == 3 );
CPPUNIT_ASSERT ( *(s2.c_str() + s2.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(s2.wc_str() + s2.getLength()) == L'\0' );
CPPUNIT_ASSERT ( s2 + finalcut::FString("def") == L"abcdef" ); CPPUNIT_ASSERT ( s2 + finalcut::FString("def") == L"abcdef" );
CPPUNIT_ASSERT ( s2 + std::wstring(L"def") == L"abcdef" ); CPPUNIT_ASSERT ( s2 + std::wstring(L"def") == L"abcdef" );
CPPUNIT_ASSERT ( s2 + const_cast<wchar_t*>(L"def") == L"abcdef" ); CPPUNIT_ASSERT ( s2 + const_cast<wchar_t*>(L"def") == L"abcdef" );
@ -541,12 +548,16 @@ void FStringTest::equalTest()
finalcut::FString fs = s1; finalcut::FString fs = s1;
const std::string s2 = fs.toString(); const std::string s2 = fs.toString();
CPPUNIT_ASSERT ( s1 == s2 ); CPPUNIT_ASSERT ( s1 == s2 );
CPPUNIT_ASSERT ( s1.size() == 6 );
CPPUNIT_ASSERT ( *(s1.c_str() + s1.size()) == '\0' );
// std::wstring -> finalcut::FString -> std::wstring // std::wstring -> finalcut::FString -> std::wstring
const std::wstring ws1 = L"wide string"; const std::wstring ws1 = L"wide string";
fs = ws1; fs = ws1;
std::wstring ws2 = fs.wc_str(); std::wstring ws2 = fs.wc_str();
CPPUNIT_ASSERT ( ws1 == ws2 ); CPPUNIT_ASSERT ( ws1 == ws2 );
CPPUNIT_ASSERT ( ws1.size() == 11 );
CPPUNIT_ASSERT ( *(ws1.c_str() + ws1.size()) == L'\0' );
const finalcut::FString one_char('a'); const finalcut::FString one_char('a');
constexpr char ch = 'a'; constexpr char ch = 'a';
@ -803,6 +814,9 @@ void FStringTest::streamInsertionTest()
finalcut::FString out; finalcut::FString out;
out << finalcut::FString("ABC"); out << finalcut::FString("ABC");
CPPUNIT_ASSERT ( out == L"ABC" ); CPPUNIT_ASSERT ( out == L"ABC" );
CPPUNIT_ASSERT ( out.getLength() == 3 );
CPPUNIT_ASSERT ( *(out.c_str() + out.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(out.wc_str() + out.getLength()) == L'\0' );
out.clear(); out.clear();
out << std::string("ABC"); out << std::string("ABC");
@ -949,6 +963,9 @@ void FStringTest::streamExtractionTest()
finalcut::FString in_1; finalcut::FString in_1;
finalcut::FString("ABC") >> in_1; finalcut::FString("ABC") >> in_1;
CPPUNIT_ASSERT ( in_1 == "ABC" ); CPPUNIT_ASSERT ( in_1 == "ABC" );
CPPUNIT_ASSERT ( in_1.getLength() == 3 );
CPPUNIT_ASSERT ( *(in_1.c_str() + in_1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(in_1.wc_str() + in_1.getLength()) == L'\0' );
std::wstring in_2; std::wstring in_2;
finalcut::FString("ABC") >> in_2; finalcut::FString("ABC") >> in_2;
@ -1024,6 +1041,9 @@ void FStringTest::subscriptOperatorTest()
CPPUNIT_ASSERT ( s[2] == L'C' ); CPPUNIT_ASSERT ( s[2] == L'C' );
CPPUNIT_ASSERT ( s[3] == L'\0' ); // pos == size CPPUNIT_ASSERT ( s[3] == L'\0' ); // pos == size
CPPUNIT_ASSERT ( s == L"ABC" ); CPPUNIT_ASSERT ( s == L"ABC" );
CPPUNIT_ASSERT ( s.getLength() == 3 );
CPPUNIT_ASSERT ( *(s.c_str() + s.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(s.wc_str() + s.getLength()) == L'\0' );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1370,23 +1390,39 @@ void FStringTest::exceptionTest()
void FStringTest::trimTest() void FStringTest::trimTest()
{ {
const finalcut::FString& trim_str1 = L"\r\n\t A string \n\t"; const finalcut::FString& trim_str1 = L"\r\n\t A string \n\t";
CPPUNIT_ASSERT ( trim_str1.getLength() == 16 );
CPPUNIT_ASSERT ( *(trim_str1.c_str() + trim_str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(trim_str1.wc_str() + trim_str1.getLength()) == L'\0' );
CPPUNIT_ASSERT ( trim_str1.rtrim() == L"\r\n\t A string" ); CPPUNIT_ASSERT ( trim_str1.rtrim() == L"\r\n\t A string" );
CPPUNIT_ASSERT ( trim_str1.rtrim().getLength() == 13 );
CPPUNIT_ASSERT ( *(trim_str1.rtrim().c_str() + trim_str1.rtrim().getLength()) == '\0' );
CPPUNIT_ASSERT ( *(trim_str1.rtrim().wc_str() + trim_str1.rtrim().getLength()) == L'\0' );
CPPUNIT_ASSERT ( trim_str1.ltrim() == L"A string \n\t" ); CPPUNIT_ASSERT ( trim_str1.ltrim() == L"A string \n\t" );
CPPUNIT_ASSERT ( trim_str1.ltrim().getLength() == 11 );
CPPUNIT_ASSERT ( *(trim_str1.ltrim().c_str() + trim_str1.ltrim().getLength()) == '\0' );
CPPUNIT_ASSERT ( *(trim_str1.ltrim().wc_str() + trim_str1.ltrim().getLength()) == L'\0' );
CPPUNIT_ASSERT ( trim_str1.trim() == L"A string" ); CPPUNIT_ASSERT ( trim_str1.trim() == L"A string" );
CPPUNIT_ASSERT ( trim_str1.trim().getLength() == 8 );
CPPUNIT_ASSERT ( *(trim_str1.trim().c_str() + trim_str1.trim().getLength()) == '\0' );
CPPUNIT_ASSERT ( *(trim_str1.trim().wc_str() + trim_str1.trim().getLength()) == L'\0' );
const finalcut::FString& trim_str2 = L"\n \n\n"; const finalcut::FString& trim_str2 = L"\n \n\n";
CPPUNIT_ASSERT ( trim_str2.rtrim().isEmpty() ); CPPUNIT_ASSERT ( trim_str2.rtrim().isEmpty() );
CPPUNIT_ASSERT ( ! trim_str2.rtrim().isNull() ); CPPUNIT_ASSERT ( ! trim_str2.rtrim().isNull() );
CPPUNIT_ASSERT ( trim_str2.rtrim().getLength() == 0 ); CPPUNIT_ASSERT ( trim_str2.rtrim().getLength() == 0 );
CPPUNIT_ASSERT ( trim_str2.rtrim().capacity() == 0 ); CPPUNIT_ASSERT ( trim_str2.rtrim().capacity() == 0 );
CPPUNIT_ASSERT ( *(trim_str2.rtrim().c_str() + trim_str2.rtrim().getLength()) == '\0' );
CPPUNIT_ASSERT ( *(trim_str2.rtrim().wc_str() + trim_str2.rtrim().getLength()) == L'\0' );
CPPUNIT_ASSERT ( trim_str2.ltrim().isEmpty() ); CPPUNIT_ASSERT ( trim_str2.ltrim().isEmpty() );
CPPUNIT_ASSERT ( ! trim_str2.ltrim().isNull() ); CPPUNIT_ASSERT ( ! trim_str2.ltrim().isNull() );
CPPUNIT_ASSERT ( trim_str2.ltrim().getLength() == 0 ); CPPUNIT_ASSERT ( trim_str2.ltrim().getLength() == 0 );
CPPUNIT_ASSERT ( trim_str2.ltrim().capacity() == 0 ); CPPUNIT_ASSERT ( trim_str2.ltrim().capacity() == 0 );
CPPUNIT_ASSERT ( *(trim_str2.ltrim().c_str() + trim_str2.ltrim().getLength()) == '\0' );
CPPUNIT_ASSERT ( *(trim_str2.ltrim().wc_str() + trim_str2.ltrim().getLength()) == L'\0' );
const finalcut::FString trim_str3{}; const finalcut::FString trim_str3{};
CPPUNIT_ASSERT ( trim_str3.ltrim().isEmpty() ); CPPUNIT_ASSERT ( trim_str3.ltrim().isEmpty() );
CPPUNIT_ASSERT ( trim_str3.ltrim().isEmpty() ); CPPUNIT_ASSERT ( trim_str3.ltrim().isNull() );
CPPUNIT_ASSERT ( trim_str3.ltrim().getLength() == 0 ); CPPUNIT_ASSERT ( trim_str3.ltrim().getLength() == 0 );
CPPUNIT_ASSERT ( trim_str3.ltrim().capacity() == 0 ); CPPUNIT_ASSERT ( trim_str3.ltrim().capacity() == 0 );
CPPUNIT_ASSERT ( trim_str3.rtrim().isEmpty() ); CPPUNIT_ASSERT ( trim_str3.rtrim().isEmpty() );
@ -1405,36 +1441,52 @@ void FStringTest::subStringTest()
finalcut::FString str1("Look behind you, a three-headed monkey!"); finalcut::FString str1("Look behind you, a three-headed monkey!");
CPPUNIT_ASSERT ( str1.left(uInt(11)) == L"Look behind" ); CPPUNIT_ASSERT ( str1.left(uInt(11)) == L"Look behind" );
CPPUNIT_ASSERT ( str1.left(int(11)) == L"Look behind" ); CPPUNIT_ASSERT ( str1.left(int(11)) == L"Look behind" );
CPPUNIT_ASSERT ( str1.left(11).getLength() == 11 );
CPPUNIT_ASSERT ( *(str1.left(11).c_str() + str1.left(11).getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.left(11).wc_str() + str1.left(11).getLength()) == L'\0' );
CPPUNIT_ASSERT ( str1.left(999) CPPUNIT_ASSERT ( str1.left(999)
== L"Look behind you, a three-headed monkey!" ); == L"Look behind you, a three-headed monkey!" );
CPPUNIT_ASSERT ( str1.left(999).getLength() == 39 );
CPPUNIT_ASSERT ( str1.left(-5) CPPUNIT_ASSERT ( str1.left(-5)
== L"Look behind you, a three-headed monkey!" ); == L"Look behind you, a three-headed monkey!" );
CPPUNIT_ASSERT ( str1.left(-5).getLength() == 39 );
CPPUNIT_ASSERT ( str1.left(0) == L"" ); CPPUNIT_ASSERT ( str1.left(0) == L"" );
CPPUNIT_ASSERT ( str1.left(0).isEmpty() ); CPPUNIT_ASSERT ( str1.left(0).isEmpty() );
CPPUNIT_ASSERT ( ! str1.left(0).isNull() ); CPPUNIT_ASSERT ( ! str1.left(0).isNull() );
CPPUNIT_ASSERT ( finalcut::FString().left(5).isNull() ); CPPUNIT_ASSERT ( finalcut::FString().left(5).isNull() );
CPPUNIT_ASSERT ( ! finalcut::FString("").left(5).isNull() ); CPPUNIT_ASSERT ( ! finalcut::FString("").left(5).isNull() );
CPPUNIT_ASSERT ( finalcut::FString("").left(5).isEmpty() ); CPPUNIT_ASSERT ( finalcut::FString("").left(5).isEmpty() );
CPPUNIT_ASSERT ( finalcut::FString("").left(5).getLength() == 0 );
CPPUNIT_ASSERT ( str1.right(uInt(7)) == L"monkey!" ); CPPUNIT_ASSERT ( str1.right(uInt(7)) == L"monkey!" );
CPPUNIT_ASSERT ( str1.right(int(7)) == L"monkey!" ); CPPUNIT_ASSERT ( str1.right(int(7)) == L"monkey!" );
CPPUNIT_ASSERT ( str1.right(7).getLength() == 7 );
CPPUNIT_ASSERT ( *(str1.right(7).c_str() + str1.right(7).getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.right(7).wc_str() + str1.right(7).getLength()) == L'\0' );
CPPUNIT_ASSERT ( str1.right(999) CPPUNIT_ASSERT ( str1.right(999)
== L"Look behind you, a three-headed monkey!" ); == L"Look behind you, a three-headed monkey!" );
CPPUNIT_ASSERT ( str1.right(999).getLength() == 39 );
CPPUNIT_ASSERT ( str1.right(-5) CPPUNIT_ASSERT ( str1.right(-5)
== L"Look behind you, a three-headed monkey!" ); == L"Look behind you, a three-headed monkey!" );
CPPUNIT_ASSERT ( str1.right(-5).getLength() == 39 );
CPPUNIT_ASSERT ( str1.right(0) == L"" ); CPPUNIT_ASSERT ( str1.right(0) == L"" );
CPPUNIT_ASSERT ( str1.right(0).isEmpty() ); CPPUNIT_ASSERT ( str1.right(0).isEmpty() );
CPPUNIT_ASSERT ( ! str1.right(0).isNull() ); CPPUNIT_ASSERT ( ! str1.right(0).isNull() );
CPPUNIT_ASSERT ( finalcut::FString().right(5).isNull() ); CPPUNIT_ASSERT ( finalcut::FString().right(5).isNull() );
CPPUNIT_ASSERT ( ! finalcut::FString("").right(5).isNull() ); CPPUNIT_ASSERT ( ! finalcut::FString("").right(5).isNull() );
CPPUNIT_ASSERT ( finalcut::FString("").right(5).isEmpty() ); CPPUNIT_ASSERT ( finalcut::FString("").right(5).isEmpty() );
CPPUNIT_ASSERT ( finalcut::FString("").right(5).getLength() == 0 );
CPPUNIT_ASSERT ( str1.mid(uInt(18), uInt(21)) CPPUNIT_ASSERT ( str1.mid(uInt(18), uInt(21))
== L"a three-headed monkey" ); == L"a three-headed monkey" );
CPPUNIT_ASSERT ( str1.mid(int(18), int(21)) CPPUNIT_ASSERT ( str1.mid(int(18), int(21))
== L"a three-headed monkey" ); == L"a three-headed monkey" );
CPPUNIT_ASSERT ( str1.mid(18, 21).getLength() == 21 );
CPPUNIT_ASSERT ( *(str1.mid(18, 21).c_str() + str1.mid(18, 21).getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.mid(18, 21).wc_str() + str1.mid(18, 21).getLength()) == L'\0' );
CPPUNIT_ASSERT ( str1.mid(1, 999) CPPUNIT_ASSERT ( str1.mid(1, 999)
== L"Look behind you, a three-headed monkey!" ); == L"Look behind you, a three-headed monkey!" );
CPPUNIT_ASSERT ( str1.mid(1, 999).getLength() == 39 );
CPPUNIT_ASSERT ( str1.mid(5, 0) == L"" ); CPPUNIT_ASSERT ( str1.mid(5, 0) == L"" );
CPPUNIT_ASSERT ( str1.mid(-5, 2) == L"" ); CPPUNIT_ASSERT ( str1.mid(-5, 2) == L"" );
CPPUNIT_ASSERT ( str1.mid(0, 0) == L"" ); CPPUNIT_ASSERT ( str1.mid(0, 0) == L"" );
@ -1444,6 +1496,7 @@ void FStringTest::subStringTest()
CPPUNIT_ASSERT ( finalcut::FString().mid(5, 0).isNull() ); CPPUNIT_ASSERT ( finalcut::FString().mid(5, 0).isNull() );
CPPUNIT_ASSERT ( ! finalcut::FString("").mid(5, 0).isNull() ); CPPUNIT_ASSERT ( ! finalcut::FString("").mid(5, 0).isNull() );
CPPUNIT_ASSERT ( finalcut::FString("").mid(5, 0).isEmpty() ); CPPUNIT_ASSERT ( finalcut::FString("").mid(5, 0).isEmpty() );
CPPUNIT_ASSERT ( str1.mid(5, 0).getLength() == 0 );
finalcut::FStringList string_parts = str1.split(" "); finalcut::FStringList string_parts = str1.split(" ");
finalcut::FStringList string_list; finalcut::FStringList string_list;
@ -1455,13 +1508,13 @@ void FStringTest::subStringTest()
string_list.push_back("monkey!"); string_list.push_back("monkey!");
CPPUNIT_ASSERT ( string_parts == string_list ); CPPUNIT_ASSERT ( string_parts == string_list );
string_parts = str1.split(L','); string_parts = str1.split(L','); // wchar_t
string_list.clear(); string_list.clear();
string_list.push_back("Look behind you"); string_list.push_back("Look behind you");
string_list.push_back(" a three-headed monkey!"); string_list.push_back(" a three-headed monkey!");
CPPUNIT_ASSERT ( string_parts == string_list ); CPPUNIT_ASSERT ( string_parts == string_list );
string_parts = str1.split(','); string_parts = str1.split(','); // char
CPPUNIT_ASSERT ( string_parts == string_list ); CPPUNIT_ASSERT ( string_parts == string_list );
string_parts = finalcut::FString().split(':'); string_parts = finalcut::FString().split(':');
@ -1474,53 +1527,133 @@ void FStringTest::insertTest()
{ {
finalcut::FString str1 = "ABC"; finalcut::FString str1 = "ABC";
const finalcut::FString str2 = "xyz"; const finalcut::FString str2 = "xyz";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str2, 0) == "xyzABC" ); CPPUNIT_ASSERT ( str1.insert(str2, 0) == "xyzABC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str2, 1) == "AxyzBC" ); CPPUNIT_ASSERT ( str1.insert(str2, 1) == "AxyzBC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str2, 2) == "ABxyzC" ); CPPUNIT_ASSERT ( str1.insert(str2, 2) == "ABxyzC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str2, 3) == "ABCxyz" ); CPPUNIT_ASSERT ( str1.insert(str2, 3) == "ABCxyz" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
constexpr wchar_t str3[] = L"xyz"; constexpr wchar_t str3[] = L"xyz";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str3, 0) == "xyzABC" ); CPPUNIT_ASSERT ( str1.insert(str3, 0) == "xyzABC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str3, 1) == "AxyzBC" ); CPPUNIT_ASSERT ( str1.insert(str3, 1) == "AxyzBC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str3, 2) == "ABxyzC" ); CPPUNIT_ASSERT ( str1.insert(str3, 2) == "ABxyzC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str3, 3) == "ABCxyz" ); CPPUNIT_ASSERT ( str1.insert(str3, 3) == "ABCxyz" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
constexpr char str4[] = "xyz"; constexpr char str4[] = "xyz";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str4, 0) == "xyzABC" ); CPPUNIT_ASSERT ( str1.insert(str4, 0) == "xyzABC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str4, 1) == "AxyzBC" ); CPPUNIT_ASSERT ( str1.insert(str4, 1) == "AxyzBC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str4, 2) == "ABxyzC" ); CPPUNIT_ASSERT ( str1.insert(str4, 2) == "ABxyzC" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(str4, 3) == "ABCxyz" ); CPPUNIT_ASSERT ( str1.insert(str4, 3) == "ABCxyz" );
CPPUNIT_ASSERT ( str1.getLength() == 6 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
constexpr wchar_t wc = L'*'; constexpr wchar_t wc = L'*';
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(wc, 0) == "*ABC" ); CPPUNIT_ASSERT ( str1.insert(wc, 0) == "*ABC" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(wc, 1) == "A*BC" ); CPPUNIT_ASSERT ( str1.insert(wc, 1) == "A*BC" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(wc, 2) == "AB*C" ); CPPUNIT_ASSERT ( str1.insert(wc, 2) == "AB*C" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(wc, 3) == "ABC*" ); CPPUNIT_ASSERT ( str1.insert(wc, 3) == "ABC*" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
constexpr char c = '*'; constexpr char c = '*';
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(c, 0) == "*ABC" ); CPPUNIT_ASSERT ( str1.insert(c, 0) == "*ABC" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(c, 1) == "A*BC" ); CPPUNIT_ASSERT ( str1.insert(c, 1) == "A*BC" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(c, 2) == "AB*C" ); CPPUNIT_ASSERT ( str1.insert(c, 2) == "AB*C" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
str1 = "ABC"; str1 = "ABC";
CPPUNIT_ASSERT ( str1.getLength() == 3 );
CPPUNIT_ASSERT ( str1.insert(c, 3) == "ABC*" ); CPPUNIT_ASSERT ( str1.insert(c, 3) == "ABC*" );
CPPUNIT_ASSERT ( str1.getLength() == 4 );
CPPUNIT_ASSERT ( *(str1.c_str() + str1.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str1.wc_str() + str1.getLength()) == L'\0' );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1693,16 +1826,31 @@ void FStringTest::replaceTest()
s1 = "A big ball and a small ball"; s1 = "A big ball and a small ball";
CPPUNIT_ASSERT ( s1.replace("ball", "globe") CPPUNIT_ASSERT ( s1.replace("ball", "globe")
== "A big globe and a small globe" ); == "A big globe and a small globe" );
CPPUNIT_ASSERT ( s1.getLength() == 27 );
CPPUNIT_ASSERT ( s1.replace("ball", "globe").getLength() == 29 );
CPPUNIT_ASSERT ( *(s1.replace("ball", "globe").c_str()
+ s1.replace("ball", "globe").getLength()) == '\0' );
CPPUNIT_ASSERT ( *(s1.replace("ball", "globe").wc_str()
+ s1.replace("ball", "globe").getLength()) == L'\0' );
s1 = "ABC"; s1 = "ABC";
finalcut::FString empty; finalcut::FString empty;
CPPUNIT_ASSERT ( s1.replace('B', "") == "AC" ); CPPUNIT_ASSERT ( s1.replace('B', "") == "AC" );
CPPUNIT_ASSERT ( s1.replace('B', "").getLength() == 2 );
CPPUNIT_ASSERT ( s1.replace(L'B', "") == "AC" ); CPPUNIT_ASSERT ( s1.replace(L'B', "") == "AC" );
CPPUNIT_ASSERT ( s1.replace(from1, empty) == "ABC" ); CPPUNIT_ASSERT ( s1.replace(L'B', "").getLength() == 2 );
CPPUNIT_ASSERT ( s1.replace(from3, empty) == "ABC" ); CPPUNIT_ASSERT ( s1.replace(from3, empty) == "ABC" );
CPPUNIT_ASSERT ( s1.replace(from3, empty).getLength() == 3 );
CPPUNIT_ASSERT ( s1.replace(from1, empty) == "ABC" );
CPPUNIT_ASSERT ( s1.replace(from1, empty).getLength() == 3 );
CPPUNIT_ASSERT ( s1.replace(from3, empty) == "ABC" );
CPPUNIT_ASSERT ( s1.replace(from3, empty).getLength() == 3 );
CPPUNIT_ASSERT ( s1.replace(from5, to5) == "ABC" ); CPPUNIT_ASSERT ( s1.replace(from5, to5) == "ABC" );
CPPUNIT_ASSERT ( s1.replace(from5, to5).getLength() == 3 );
CPPUNIT_ASSERT ( s1.replace(empty, to1) == "ABC" ); CPPUNIT_ASSERT ( s1.replace(empty, to1) == "ABC" );
CPPUNIT_ASSERT ( s1.replace(empty, to1).getLength() == 3 );
CPPUNIT_ASSERT ( s1.replace(from6, empty) == "ABC" ); CPPUNIT_ASSERT ( s1.replace(from6, empty) == "ABC" );
CPPUNIT_ASSERT ( s1.replace(from6, empty).getLength() == 3 );
empty = ""; empty = "";
CPPUNIT_ASSERT ( s1.replace(from1, empty) == "ABC" ); CPPUNIT_ASSERT ( s1.replace(from1, empty) == "ABC" );
@ -1728,13 +1876,30 @@ void FStringTest::overwriteTest()
{ {
// finalcut::FString // finalcut::FString
finalcut::FString str = "abcdefghijklm"; finalcut::FString str = "abcdefghijklm";
CPPUNIT_ASSERT ( str.getLength() == 13 );
CPPUNIT_ASSERT ( str.overwrite("+++++++", 3) == "abc+++++++klm" ); CPPUNIT_ASSERT ( str.overwrite("+++++++", 3) == "abc+++++++klm" );
CPPUNIT_ASSERT ( str.getLength() == 13 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
CPPUNIT_ASSERT ( str.overwrite(".............") == "............." ); CPPUNIT_ASSERT ( str.overwrite(".............") == "............." );
CPPUNIT_ASSERT ( str.getLength() == 13 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
CPPUNIT_ASSERT ( str.overwrite(",,,,,,,,,,,,,,,") == ",,,,,,,,,,,,,,," ); CPPUNIT_ASSERT ( str.overwrite(",,,,,,,,,,,,,,,") == ",,,,,,,,,,,,,,," );
CPPUNIT_ASSERT ( str.getLength() == 15 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
str = "abc"; str = "abc";
CPPUNIT_ASSERT ( str.getLength() == 3 );
CPPUNIT_ASSERT ( str.overwrite("+++++", 99) == "abc+++++" ); CPPUNIT_ASSERT ( str.overwrite("+++++", 99) == "abc+++++" );
CPPUNIT_ASSERT ( str.getLength() == 8 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
str = "abc"; str = "abc";
CPPUNIT_ASSERT ( str.overwrite("+++", -5) == "+++" ); CPPUNIT_ASSERT ( str.overwrite("+++", -5) == "+++" );
CPPUNIT_ASSERT ( str.getLength() == 3 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
// Wide string // Wide string
str = "abcdefghijklm"; str = "abcdefghijklm";
@ -1763,12 +1928,40 @@ void FStringTest::removeTest()
{ {
finalcut::FString str = "ABCDE"; finalcut::FString str = "ABCDE";
CPPUNIT_ASSERT ( str.remove(2, 2) == "ABE" ); CPPUNIT_ASSERT ( str.remove(2, 2) == "ABE" );
CPPUNIT_ASSERT ( str.getLength() == 3 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
// Remove last character
CPPUNIT_ASSERT ( str.remove(2, 1) == "AB" ); CPPUNIT_ASSERT ( str.remove(2, 1) == "AB" );
CPPUNIT_ASSERT ( str.getLength() == 2 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
// Remove after the last character
CPPUNIT_ASSERT ( str.remove(2, 1) == "AB" ); CPPUNIT_ASSERT ( str.remove(2, 1) == "AB" );
CPPUNIT_ASSERT ( str.getLength() == 2 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
// Remove after the last character
CPPUNIT_ASSERT ( str.remove(2, 5) == "AB" ); CPPUNIT_ASSERT ( str.remove(2, 5) == "AB" );
CPPUNIT_ASSERT ( str.getLength() == 2 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
str = "ABCDE"; str = "ABCDE";
CPPUNIT_ASSERT ( str.getLength() == 5 );
CPPUNIT_ASSERT ( str.remove(2, 99) == "AB" ); CPPUNIT_ASSERT ( str.remove(2, 99) == "AB" );
CPPUNIT_ASSERT ( str.getLength() == 2 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
// Remove after the last character
CPPUNIT_ASSERT ( str.remove(99, 1) == "AB" ); CPPUNIT_ASSERT ( str.remove(99, 1) == "AB" );
CPPUNIT_ASSERT ( str.getLength() == 2 );
CPPUNIT_ASSERT ( *(str.c_str() + str.getLength()) == '\0' );
CPPUNIT_ASSERT ( *(str.wc_str() + str.getLength()) == L'\0' );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1822,85 +2015,127 @@ void FStringTest::includesTest()
void FStringTest::controlCodesTest() void FStringTest::controlCodesTest()
{ {
finalcut::FString bs_str = "t\b\bTesT\bt"; finalcut::FString bs_str = "t\b\bTesT\bt";
CPPUNIT_ASSERT ( bs_str.getLength() == 9 );
CPPUNIT_ASSERT ( bs_str.removeBackspaces() == "Test" ); CPPUNIT_ASSERT ( bs_str.removeBackspaces() == "Test" );
CPPUNIT_ASSERT ( bs_str.removeBackspaces().getLength() == 4 );
CPPUNIT_ASSERT ( *(bs_str.removeBackspaces().c_str()
+ bs_str.removeBackspaces().getLength()) == '\0' );
CPPUNIT_ASSERT ( *(bs_str.removeBackspaces().wc_str()
+ bs_str.removeBackspaces().getLength()) == L'\0' );
bs_str = "ABC\b\b\b\b"; bs_str = "ABC\b\b\b\b";
CPPUNIT_ASSERT ( bs_str.removeBackspaces() == "" ); CPPUNIT_ASSERT ( bs_str.removeBackspaces() == "" );
CPPUNIT_ASSERT ( bs_str.removeBackspaces().isEmpty() ); CPPUNIT_ASSERT ( bs_str.removeBackspaces().isEmpty() );
CPPUNIT_ASSERT ( bs_str.removeBackspaces().getLength() == 0 );
finalcut::FString del_str = "apple \177\177\177pietree"; finalcut::FString del_str = "apple \177\177\177pietree";
CPPUNIT_ASSERT ( del_str.getLength() == 16 );
CPPUNIT_ASSERT ( del_str.removeDel() == "apple tree" ); CPPUNIT_ASSERT ( del_str.removeDel() == "apple tree" );
CPPUNIT_ASSERT ( del_str.removeDel().getLength() == 10 );
del_str = "\177\177\177\177ABC"; del_str = "\177\177\177\177ABC";
CPPUNIT_ASSERT ( del_str.getLength() == 7 );
CPPUNIT_ASSERT ( del_str.removeDel() == "" ); CPPUNIT_ASSERT ( del_str.removeDel() == "" );
CPPUNIT_ASSERT ( del_str.removeDel().isEmpty() ); CPPUNIT_ASSERT ( del_str.removeDel().isEmpty() );
CPPUNIT_ASSERT ( del_str.removeDel().getLength() == 0 );
finalcut::FString tab_str = "one line"; finalcut::FString tab_str = "one line";
CPPUNIT_ASSERT ( tab_str.getLength() == 8 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "one line" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "one line" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 8 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "one line" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "one line" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "one line" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "one line" );
tab_str = "one\ttwo"; tab_str = "one\ttwo";
CPPUNIT_ASSERT ( tab_str.getLength() == 7 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "one two" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "one two" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 11 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "one two" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "one two" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "one two" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "one two" );
tab_str = "one\t\btwo"; tab_str = "one\t\btwo";
CPPUNIT_ASSERT ( tab_str.getLength() == 8 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "one \btwo" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "one \btwo" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 12 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "one \btwo" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "one \btwo" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "one \btwo" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "one \btwo" );
tab_str = "1\t2\t2"; tab_str = "1\t2\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 5 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "1 2 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "1 2 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "1 2 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "1 2 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "1 2 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "1 2 2" );
tab_str = "12\t22\t2"; tab_str = "12\t22\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 7 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "12 22 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "12 22 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "12 22 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "12 22 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "12 22 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "12 22 2" );
tab_str = "123\t222\t2"; tab_str = "123\t222\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 9 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "123 222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "123 222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "123 222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "123 222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "123 222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "123 222 2" );
tab_str = "1234\t2222\t2"; tab_str = "1234\t2222\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 11 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "1234 2222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "1234 2222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "1234 2222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "1234 2222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "1234 2222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "1234 2222 2" );
tab_str = "12345\t22222\t2"; tab_str = "12345\t22222\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 13 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "12345 22222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "12345 22222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "12345 22222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "12345 22222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "12345 22222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "12345 22222 2" );
tab_str = "123456\t222222\t2"; tab_str = "123456\t222222\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 15 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "123456 222222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "123456 222222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "123456 222222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "123456 222222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "123456 222222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "123456 222222 2" );
tab_str = "1234567\t2222222\t2"; tab_str = "1234567\t2222222\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "1234567 2222222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "1234567 2222222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "1234567 2222222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "1234567 2222222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "1234567 2222222 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "1234567 2222222 2" );
tab_str = "12345678\t22222222\t2"; tab_str = "12345678\t22222222\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 19 );
CPPUNIT_ASSERT ( tab_str.expandTabs() CPPUNIT_ASSERT ( tab_str.expandTabs()
== "12345678 22222222 2" ); == "12345678 22222222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 33 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) CPPUNIT_ASSERT ( tab_str.expandTabs(4)
== "12345678 22222222 2" ); == "12345678 22222222 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) CPPUNIT_ASSERT ( tab_str.expandTabs(2)
== "12345678 22222222 2" ); == "12345678 22222222 2" );
tab_str = "12345678\t2"; tab_str = "12345678\t2";
CPPUNIT_ASSERT ( tab_str.getLength() == 10 );
CPPUNIT_ASSERT ( tab_str.expandTabs() == "12345678 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs() == "12345678 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs().getLength() == 17 );
CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "12345678 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(4) == "12345678 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "12345678 2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(2) == "12345678 2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(0) == "12345678\t2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(0) == "12345678\t2" );
CPPUNIT_ASSERT ( tab_str.expandTabs(-1) == "12345678\t2" ); CPPUNIT_ASSERT ( tab_str.expandTabs(-1) == "12345678\t2" );
finalcut::FString cc(0x20);
// C0 control codes (0x01 - 0x1f) - without null (0x00)
finalcut::FString c0(0x1f);
for (int i = 0; i < 0x1f; i++) for (int i = 0; i < 0x1f; i++)
cc[i] = i + 1; c0[i] = i + 1;
CPPUNIT_ASSERT ( cc.replaceControlCodes() CPPUNIT_ASSERT ( c0.getLength() == 31 );
CPPUNIT_ASSERT ( c0.replaceControlCodes()
== "␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟" ); == "␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟" );
CPPUNIT_ASSERT ( c0.replaceControlCodes().getLength() == 31 );
c0 = "t\b\bTes\177Tt";
CPPUNIT_ASSERT ( c0.replaceControlCodes() == "t␈␈Tes␡Tt" );
// C1 control codes (0x80 - 0x9f)
// Used as print characters in some character sets
finalcut::FString c1(0x20);
for (int i = 0; i <= 0x1f; i++) for (int i = 0; i <= 0x1f; i++)
cc[i] = i + 0x80; c1[i] = i + 0x80;
CPPUNIT_ASSERT ( cc.replaceControlCodes() == finalcut::FString(32, L' ') ); CPPUNIT_ASSERT ( c1.replaceControlCodes() == finalcut::FString(32, L' ') );
cc = "t\b\bTes\177Tt";
CPPUNIT_ASSERT ( cc.replaceControlCodes() == "t␈␈Tes␡Tt" );
} }
// Put the test suite in the registry // Put the test suite in the registry

View File

@ -54,7 +54,7 @@ namespace test
typedef struct typedef struct
{ {
char* string; const char* string;
char tname[3]; char tname[3];
} }
tcap_map; tcap_map;
@ -237,48 +237,48 @@ void FTermcapQuirksTest::generalTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 );
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette ); CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "3%p1%dm") ); , CSI "3%p1%dm") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string
, C_STR(CSI "4%p1%dm") ); , CSI "4%p1%dm") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(OSC "P%p1%x" , OSC "P%p1%x"
"%p2%{255}%*%{1000}%/%02x" "%p2%{255}%*%{1000}%/%02x"
"%p3%{255}%*%{1000}%/%02x" "%p3%{255}%*%{1000}%/%02x"
"%p4%{255}%*%{1000}%/%02x") ); "%p4%{255}%*%{1000}%/%02x" );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_ca_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_ca_mode].string
, C_STR(ESC "7" CSI "?47h" ) ); , ESC "7" CSI "?47h" ) ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_ca_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_ca_mode].string
, C_STR(CSI "?47l" ESC "8" CSI "m") ); , CSI "?47l" ESC "8" CSI "m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_address].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_address].string
, C_STR(CSI "%i%p1%d;%p2%dH") ); , CSI "%i%p1%d;%p2%dH") ;
// Non standard ECMA-48 (ANSI X3.64) terminal // Non standard ECMA-48 (ANSI X3.64) terminal
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dbl_underline_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dbl_underline_mode].string
, 0 ); , 0 );
caps[finalcut::fc::t_exit_underline_mode].string = C_STR(CSI "24m"); caps[finalcut::fc::t_exit_underline_mode].string = CSI "24m";
quirks.terminalFixup(); quirks.terminalFixup();
// Standard ECMA-48 (ANSI X3.64) terminal // Standard ECMA-48 (ANSI X3.64) terminal
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dbl_underline_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dbl_underline_mode].string
, C_STR(CSI "21m") ); , CSI "21m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dbl_underline_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dbl_underline_mode].string
, C_STR(CSI "24m") ); , CSI "24m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_bold_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_bold_mode].string
, C_STR(CSI "22m") ); , CSI "22m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dim_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dim_mode].string
, C_STR(CSI "22m") ); , CSI "22m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_underline_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_underline_mode].string
, C_STR(CSI "24m") ); , CSI "24m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_blink_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_blink_mode].string
, C_STR(CSI "25m") ); , CSI "25m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_reverse_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_reverse_mode].string
, C_STR(CSI "27m") ); , CSI "27m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_secure_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_secure_mode].string
, C_STR(CSI "28m") ); , CSI "28m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_crossed_out_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_crossed_out_mode].string
, C_STR(CSI "9m") ); , CSI "9m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_crossed_out_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_crossed_out_mode].string
, C_STR(CSI "29m") ); , CSI "29m") ;
CPPUNIT_ASSERT_CSTRING ( printSequence(caps[finalcut::fc::t_enter_ca_mode].string).c_str() CPPUNIT_ASSERT_CSTRING ( printSequence(caps[finalcut::fc::t_enter_ca_mode].string).c_str()
, C_STR("Esc 7 Esc [ ? 4 7 h ") ); , "Esc 7 Esc [ ? 4 7 h ") ;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -300,14 +300,14 @@ void FTermcapQuirksTest::xtermTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette ); CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(OSC "4;%p1%d;rgb:" , OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
"%p3%{255}%*%{1000}%/%2.2X/" "%p3%{255}%*%{1000}%/%2.2X/"
"%p4%{255}%*%{1000}%/%2.2X" ESC "\\") ); "%p4%{255}%*%{1000}%/%2.2X" ESC "\\");
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_invisible].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_invisible].string
, C_STR(CSI "?25l") ); , CSI "?25l") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_normal].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_normal].string
, C_STR(CSI "?12l" CSI "?25h") ); , CSI "?12l" CSI "?25h") ;
detect.setXTerminal (false); detect.setXTerminal (false);
} }
@ -333,20 +333,20 @@ void FTermcapQuirksTest::freebsdTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 18 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 18 );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_acs_chars].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_acs_chars].string
, C_STR("-\036.\0370\333" , "-\036.\0370\333"
"a\260f\370g\361" "a\260f\370g\361"
"h\261j\331k\277" "h\261j\331k\277"
"l\332m\300n\305" "l\332m\300n\305"
"q\304t\303u\264" "q\304t\303u\264"
"v\301w\302x\263" "v\301w\302x\263"
"y\363z\362~\371") ); "y\363z\362~\371" );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_attributes].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_attributes].string
, C_STR(CSI "0" , CSI "0"
"%?%p1%p6%|%t;1%;" "%?%p1%p6%|%t;1%;"
"%?%p2%t;4%;" "%?%p2%t;4%;"
"%?%p1%p3%|%t;7%;" "%?%p1%p3%|%t;7%;"
"%?%p4%t;5%;m" "%?%p4%t;5%;m"
"%?%p9%t\016%e\017%;") ); "%?%p9%t\016%e\017%;" );
detect.setFreeBSDTerm (false); detect.setFreeBSDTerm (false);
} }
#endif #endif
@ -370,9 +370,9 @@ void FTermcapQuirksTest::cygwinTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::background_color_erase == true );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_invisible].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_invisible].string
, C_STR(CSI "?25l") ); , CSI "?25l") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_visible].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_cursor_visible].string
, C_STR(CSI "?25h") ); , CSI "?25h") ;
detect.setCygwinTerminal (false); detect.setCygwinTerminal (false);
} }
@ -396,9 +396,9 @@ void FTermcapQuirksTest::linuxTest()
// 8 colors // 8 colors
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "3%p1%dm") ); , CSI "3%p1%dm") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string
, C_STR(CSI "4%p1%dm") ); , CSI "4%p1%dm") ;
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 18 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 18 );
// 16 colors // 16 colors
@ -406,29 +406,29 @@ void FTermcapQuirksTest::linuxTest()
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;22%;m") ); , CSI "3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;22%;m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string
, C_STR(CSI "4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m") ); , CSI "4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m") ;
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 30 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 30 );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_attributes].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_attributes].string
, C_STR(CSI "0" , CSI "0"
"%?%p6%t;1%;" "%?%p6%t;1%;"
"%?%p1%p3%|%t;7%;" "%?%p1%p3%|%t;7%;"
"%?%p4%t;5%;m" "%?%p4%t;5%;m"
"%?%p9%t\016%e\017%;") ); "%?%p9%t\016%e\017%;" );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_alt_charset_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_alt_charset_mode].string
, C_STR("\016") ); , "\016") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_alt_charset_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_alt_charset_mode].string
, C_STR("\017") ); , "\017") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_attribute_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_attribute_mode].string
, C_STR(CSI "0m\017") ); , CSI "0m\017") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_bold_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_bold_mode].string
, C_STR(CSI "22m") ); , CSI "22m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_blink_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_blink_mode].string
, C_STR(CSI "25m") ); , CSI "25m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_reverse_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_reverse_mode].string
, C_STR(CSI "27m") ); , CSI "27m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_secure_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_secure_mode].string
, 0 ); , 0 );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_protected_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_protected_mode].string
@ -436,7 +436,7 @@ void FTermcapQuirksTest::linuxTest()
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_crossed_out_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_crossed_out_mode].string
, 0 ); , 0 );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_pair].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_pair].string
, C_STR(CSI "39;49;25m") ); , CSI "39;49;25m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dim_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dim_mode].string
, 0 ); , 0 );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dim_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dim_mode].string
@ -473,17 +473,17 @@ void FTermcapQuirksTest::rxvtTest()
data.setTermType ("rxvt-16color"); data.setTermType ("rxvt-16color");
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_alt_charset_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_alt_charset_mode].string
, C_STR(ESC "(0") ); , ESC "(0") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_alt_charset_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_alt_charset_mode].string
, C_STR(ESC "(B") ); , ESC "(B") ;
// urxvt // urxvt
detect.setUrxvtTerminal (true); detect.setUrxvtTerminal (true);
quirks.terminalFixup(); quirks.terminalFixup();
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "%?%p1%{8}%<%t%p1%{30}%+%e%p1%'R'%+%;%dm") ); , CSI "%?%p1%{8}%<%t%p1%{30}%+%e%p1%'R'%+%;%dm") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string
, C_STR(CSI "%?%p1%{8}%<%t%p1%'('%+%e%p1%{92}%+%;%dm") ); , CSI "%?%p1%{8}%<%t%p1%'('%+%e%p1%{92}%+%;%dm") ;
detect.setUrxvtTerminal (false); detect.setUrxvtTerminal (false);
detect.setRxvtTerminal (false); detect.setRxvtTerminal (false);
@ -508,7 +508,7 @@ void FTermcapQuirksTest::vteTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_underline_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_underline_mode].string
, C_STR(CSI "24m") ); , CSI "24m") ;
detect.setGnomeTerminal (false); detect.setGnomeTerminal (false);
} }
@ -538,67 +538,67 @@ void FTermcapQuirksTest::puttyTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 ); CPPUNIT_ASSERT ( finalcut::FTermcap::attr_without_color == 0 );
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette ); CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(OSC "P%p1%x" , OSC "P%p1%x"
"%p2%{255}%*%{1000}%/%02x" "%p2%{255}%*%{1000}%/%02x"
"%p3%{255}%*%{1000}%/%02x" "%p3%{255}%*%{1000}%/%02x"
"%p4%{255}%*%{1000}%/%02x") ); "%p4%{255}%*%{1000}%/%02x" );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "%?%p1%{8}%<" , CSI "%?%p1%{8}%<"
"%t3%p1%d" "%t3%p1%d"
"%e%p1%{16}%<" "%e%p1%{16}%<"
"%t9%p1%{8}%-%d" "%t9%p1%{8}%-%d"
"%e38;5;%p1%d%;m") ); "%e38;5;%p1%d%;m" );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string
, C_STR(CSI "%?%p1%{8}%<" , CSI "%?%p1%{8}%<"
"%t4%p1%d" "%t4%p1%d"
"%e%p1%{16}%<" "%e%p1%{16}%<"
"%t10%p1%{8}%-%d" "%t10%p1%{8}%-%d"
"%e48;5;%p1%d%;m") ); "%e48;5;%p1%d%;m" );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_attributes].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_attributes].string
, C_STR(CSI "0" , CSI "0"
"%?%p1%p6%|%t;1%;" "%?%p1%p6%|%t;1%;"
"%?%p5%t;2%;" "%?%p5%t;2%;"
"%?%p2%t;4%;" "%?%p2%t;4%;"
"%?%p1%p3%|%t;7%;" "%?%p1%p3%|%t;7%;"
"%?%p4%t;5%;m" "%?%p4%t;5%;m"
"%?%p9%t\016%e\017%;") ); "%?%p9%t\016%e\017%;" );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dim_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_dim_mode].string
, C_STR(CSI "2m") ); , CSI "2m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dim_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_dim_mode].string
, C_STR(CSI "22m") ); , CSI "22m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_clr_bol].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_clr_bol].string
, C_STR(CSI "1K") ); , CSI "1K") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_pair].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_pair].string
, C_STR(CSI "39;49m") ); , CSI "39;49m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_colors].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_colors].string
, C_STR(OSC "R") ); , OSC "R") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_column_address].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_column_address].string
, C_STR(CSI "%i%p1%dG") ); , CSI "%i%p1%dG") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_row_address].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_row_address].string
, C_STR(CSI "%i%p1%dd") ); , CSI "%i%p1%dd") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enable_acs].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enable_acs].string
, C_STR(ESC "(B" ESC ")0") ); , ESC "(B" ESC ")0") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_am_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_am_mode].string
, C_STR(CSI "?7h") ); , CSI "?7h") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_am_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_am_mode].string
, C_STR(CSI "?7l") ); , CSI "?7l") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_pc_charset_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_enter_pc_charset_mode].string
, C_STR(CSI "11m") ); , CSI "11m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_pc_charset_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_pc_charset_mode].string
, C_STR(CSI "10m") ); , CSI "10m") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_key_mouse].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_key_mouse].string
, C_STR(CSI "M") ); , CSI "M") ;
detect.setPuttyTerminal (false); detect.setPuttyTerminal (false);
} }
@ -622,13 +622,13 @@ void FTermcapQuirksTest::teratermTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_foreground].string
, C_STR(CSI "38;5;%p1%dm") ); , CSI "38;5;%p1%dm") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_set_a_background].string
, C_STR(CSI "48;5;%p1%dm") ); , CSI "48;5;%p1%dm") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_attribute_mode].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_exit_attribute_mode].string
, C_STR(CSI "0m" SI) ); , CSI "0m" SI) ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_pair].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_orig_pair].string
, C_STR(CSI "39;49m") ); , CSI "39;49m") ;
detect.setTeraTerm (false); detect.setTeraTerm (false);
} }
@ -652,100 +652,100 @@ void FTermcapQuirksTest::sunTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true ); CPPUNIT_ASSERT ( finalcut::FTermcap::eat_nl_glitch == true );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_up_cursor].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_up_cursor].string
, C_STR(CSI "%p1%dA") ); , CSI "%p1%dA") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_down_cursor].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_down_cursor].string
, C_STR(CSI "%p1%dB") ); , CSI "%p1%dB") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_right_cursor].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_right_cursor].string
, C_STR(CSI "%p1%dC") ); , CSI "%p1%dC") ;
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_left_cursor].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_parm_left_cursor].string
, C_STR(CSI "%p1%dD") ); , CSI "%p1%dD") ;
for (std::size_t i = 0; finalcut::fc::fkey[i].tname[0] != 0; i++) for (std::size_t i = 0; finalcut::fc::fkey[i].tname[0] != 0; i++)
{ {
if ( std::strncmp(finalcut::fc::fkey[i].tname, "K2", 2) == 0 ) // center of keypad if ( std::strncmp(finalcut::fc::fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "218z") ); , CSI "218z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kb", 2) == 0 ) // backspace key if ( std::strncmp(finalcut::fc::fkey[i].tname, "kb", 2) == 0 ) // backspace key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR("\b") ); , "\b") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kD", 2) == 0 if ( std::strncmp(finalcut::fc::fkey[i].tname, "kD", 2) == 0
&& std::strlen(finalcut::fc::fkey[i].tname) == 2 ) // delete-character key && std::strlen(finalcut::fc::fkey[i].tname) == 2 ) // delete-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR("\177") ); , "\177") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "@7", 2) == 0 ) // end key if ( std::strncmp(finalcut::fc::fkey[i].tname, "@7", 2) == 0 ) // end key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "220z") ); , CSI "220z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "k;", 2) == 0 ) // F10 function key if ( std::strncmp(finalcut::fc::fkey[i].tname, "k;", 2) == 0 ) // F10 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "233z") ); , CSI "233z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "F1", 2) == 0 ) // F11 function key if ( std::strncmp(finalcut::fc::fkey[i].tname, "F1", 2) == 0 ) // F11 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "234z") ); , CSI "234z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "F2", 2) == 0 ) // F12 function key if ( std::strncmp(finalcut::fc::fkey[i].tname, "F2", 2) == 0 ) // F12 function key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "235z") ); , CSI "235z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kh", 2) == 0 ) // home key if ( std::strncmp(finalcut::fc::fkey[i].tname, "kh", 2) == 0 ) // home key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "214z") ); , CSI "214z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kI", 2) == 0 ) // insert-character key if ( std::strncmp(finalcut::fc::fkey[i].tname, "kI", 2) == 0 ) // insert-character key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "247z") ); , CSI "247z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kN", 2) == 0 ) // next-page key if ( std::strncmp(finalcut::fc::fkey[i].tname, "kN", 2) == 0 ) // next-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "222z") ); , CSI "222z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "%7", 2) == 0 ) // options key if ( std::strncmp(finalcut::fc::fkey[i].tname, "%7", 2) == 0 ) // options key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "194z") ); , CSI "194z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kP", 2) == 0 ) // prev-page key if ( std::strncmp(finalcut::fc::fkey[i].tname, "kP", 2) == 0 ) // prev-page key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "216z") ); , CSI "216z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "&5", 2) == 0 ) // resume key if ( std::strncmp(finalcut::fc::fkey[i].tname, "&5", 2) == 0 ) // resume key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "193z") ); , CSI "193z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "&8", 2) == 0 ) // undo key if ( std::strncmp(finalcut::fc::fkey[i].tname, "&8", 2) == 0 ) // undo key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "195z") ); , CSI "195z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "K2", 2) == 0 ) // center of keypad if ( std::strncmp(finalcut::fc::fkey[i].tname, "K2", 2) == 0 ) // center of keypad
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "218z") ); , CSI "218z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "kDx", 3) == 0 ) // keypad delete if ( std::strncmp(finalcut::fc::fkey[i].tname, "kDx", 3) == 0 ) // keypad delete
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "249z") ); , CSI "249z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "@8x", 3) == 0 ) // enter/send key if ( std::strncmp(finalcut::fc::fkey[i].tname, "@8x", 3) == 0 ) // enter/send key
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "250z") ); , CSI "250z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP1", 3) == 0 ) // keypad slash if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP1", 3) == 0 ) // keypad slash
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "212z") ); , CSI "212z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP2", 3) == 0 ) // keypad asterisk if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP2", 3) == 0 ) // keypad asterisk
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "213z") ); , CSI "213z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP3", 3) == 0 ) // keypad minus sign if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP3", 3) == 0 ) // keypad minus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "254z") ); , CSI "254z") ;
if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP4", 3) == 0 ) // keypad plus sign if ( std::strncmp(finalcut::fc::fkey[i].tname, "KP4", 3) == 0 ) // keypad plus sign
CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string CPPUNIT_ASSERT_CSTRING ( finalcut::fc::fkey[i].string
, C_STR(CSI "253z") ); , CSI "253z") ;
} }
detect.setSunTerminal (false); detect.setSunTerminal (false);
@ -770,10 +770,10 @@ void FTermcapQuirksTest::screenTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette ); CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(ESC "P" OSC "4;%p1%d;rgb:" , ESC "P" OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
"%p3%{255}%*%{1000}%/%2.2X/" "%p3%{255}%*%{1000}%/%2.2X/"
"%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\") ); "%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\" );
detect.setTmuxTerm (true); detect.setTmuxTerm (true);
caps[finalcut::fc::t_initialize_color].string = 0; caps[finalcut::fc::t_initialize_color].string = 0;
@ -782,10 +782,10 @@ void FTermcapQuirksTest::screenTest()
CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette ); CPPUNIT_ASSERT ( finalcut::FTermcap::can_change_color_palette );
CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string CPPUNIT_ASSERT_CSTRING ( caps[finalcut::fc::t_initialize_color].string
, C_STR(ESC "Ptmux;" ESC OSC "4;%p1%d;rgb:" , ESC "Ptmux;" ESC OSC "4;%p1%d;rgb:"
"%p2%{255}%*%{1000}%/%2.2X/" "%p2%{255}%*%{1000}%/%2.2X/"
"%p3%{255}%*%{1000}%/%2.2X/" "%p3%{255}%*%{1000}%/%2.2X/"
"%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\") ); "%p4%{255}%*%{1000}%/%2.2X" BEL ESC "\\" );
detect.setTmuxTerm (false); detect.setTmuxTerm (false);
detect.setScreenTerm (false); detect.setScreenTerm (false);
} }

View File

@ -93,8 +93,8 @@ void FTermDataTest::defaultDataTest()
CPPUNIT_ASSERT ( data.getTermGeometry() == finalcut::FRect() ); CPPUNIT_ASSERT ( data.getTermGeometry() == finalcut::FRect() );
CPPUNIT_ASSERT ( data.getTTYFileDescriptor() == -1 ); CPPUNIT_ASSERT ( data.getTTYFileDescriptor() == -1 );
CPPUNIT_ASSERT ( data.getBaudrate() == 0 ); CPPUNIT_ASSERT ( data.getBaudrate() == 0 );
CPPUNIT_ASSERT_CSTRING ( data.getTermType(), C_STR("") ); CPPUNIT_ASSERT_CSTRING ( data.getTermType(), "") ;
CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), C_STR("") ); CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), "") ;
CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() );
CPPUNIT_ASSERT ( data.getXtermTitle() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getXtermTitle() == finalcut::FString() );
CPPUNIT_ASSERT ( data.getExitMessage() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getExitMessage() == finalcut::FString() );
@ -177,13 +177,13 @@ void FTermDataTest::dataTest()
CPPUNIT_ASSERT ( data.getBaudrate() != 9600 ); CPPUNIT_ASSERT ( data.getBaudrate() != 9600 );
CPPUNIT_ASSERT ( data.getBaudrate() == 38400 ); CPPUNIT_ASSERT ( data.getBaudrate() == 38400 );
CPPUNIT_ASSERT_CSTRING ( data.getTermType(), C_STR("") ); CPPUNIT_ASSERT_CSTRING ( data.getTermType(), "") ;
data.setTermType("linux"); data.setTermType("linux");
CPPUNIT_ASSERT_CSTRING ( data.getTermType(), C_STR("linux") ); CPPUNIT_ASSERT_CSTRING ( data.getTermType(), "linux") ;
CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), C_STR("") ); CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), "") ;
data.setTermFileName("/dev/pts/2"); data.setTermFileName("/dev/pts/2");
CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), C_STR("/dev/pts/2") ); CPPUNIT_ASSERT_CSTRING ( data.getTermFileName(), "/dev/pts/2") ;
CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() ); CPPUNIT_ASSERT ( data.getXtermFont() == finalcut::FString() );
data.setXtermFont("terminus-20"); data.setXtermFont("terminus-20");

View File

@ -140,7 +140,7 @@ void FTermDetectionTest::ansiTest()
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
setenv ("TERM", "ansi", 1); setenv ("TERM", "ansi", 1);
data.setTermType(C_STR("ansi")); data.setTermType("ansi");
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -180,14 +180,14 @@ void FTermDetectionTest::ansiTest()
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() ); CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() ); CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("ansi") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "ansi") ;
// Test fallback to vt100 without TERM environment variable // Test fallback to vt100 without TERM environment variable
unsetenv("TERM"); unsetenv("TERM");
detect.setAnsiTerminal(false); detect.setAnsiTerminal(false);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() ); CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -208,7 +208,7 @@ void FTermDetectionTest::xtermTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm")); data.setTermType("xterm");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -269,7 +269,7 @@ void FTermDetectionTest::rxvtTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("rxvt-cygwin-native")); data.setTermType("rxvt-cygwin-native");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -310,7 +310,7 @@ void FTermDetectionTest::rxvtTest()
CPPUNIT_ASSERT ( detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() ); CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() ); CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("rxvt-cygwin-native") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "rxvt-cygwin-native") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -331,7 +331,7 @@ void FTermDetectionTest::urxvtTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("rxvt-unicode-256color")); data.setTermType("rxvt-unicode-256color");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -392,7 +392,7 @@ void FTermDetectionTest::mltermTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("mlterm")); data.setTermType("mlterm");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -434,13 +434,13 @@ void FTermDetectionTest::mltermTest()
CPPUNIT_ASSERT ( detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() ); CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() ); CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("mlterm-256color") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "mlterm-256color") ;
setenv ("TERM", "mlterm", 1); setenv ("TERM", "mlterm", 1);
unsetenv("COLORFGBG"); unsetenv("COLORFGBG");
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("xterm-256color") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "xterm-256color") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -461,7 +461,7 @@ void FTermDetectionTest::puttyTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm")); data.setTermType("xterm");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -523,7 +523,7 @@ void FTermDetectionTest::kdeKonsoleTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm-256color")); data.setTermType("xterm-256color");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -584,7 +584,7 @@ void FTermDetectionTest::gnomeTerminalTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm-256color")); data.setTermType("xterm-256color");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -646,7 +646,7 @@ void FTermDetectionTest::newerVteTerminalTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm-256color")); data.setTermType("xterm-256color");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -708,7 +708,7 @@ void FTermDetectionTest::ktermTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("kterm")); data.setTermType("kterm");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -756,7 +756,7 @@ void FTermDetectionTest::ktermTest()
detect.setKtermTerminal(false); detect.setKtermTerminal(false);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() ); CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -777,7 +777,7 @@ void FTermDetectionTest::teraTermTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm")); data.setTermType("xterm");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -839,7 +839,7 @@ void FTermDetectionTest::cygwinTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("cygwin")); data.setTermType("cygwin");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -901,7 +901,7 @@ void FTermDetectionTest::minttyTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm-256color")); data.setTermType("xterm-256color");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -963,7 +963,7 @@ void FTermDetectionTest::linuxTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("linux")); data.setTermType("linux");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1011,7 +1011,7 @@ void FTermDetectionTest::linuxTest()
detect.setLinuxTerm(false); detect.setLinuxTerm(false);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() ); CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -1032,7 +1032,7 @@ void FTermDetectionTest::freebsdTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("xterm")); data.setTermType("xterm");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1083,7 +1083,7 @@ void FTermDetectionTest::freebsdTest()
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() ); CPPUNIT_ASSERT ( ! detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() ); CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -1104,7 +1104,7 @@ void FTermDetectionTest::netbsdTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("wsvt25")); data.setTermType("wsvt25");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1153,7 +1153,7 @@ void FTermDetectionTest::netbsdTest()
detect.setNetBSDTerm(false); detect.setNetBSDTerm(false);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() ); CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -1174,7 +1174,7 @@ void FTermDetectionTest::openbsdTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("vt220")); data.setTermType("vt220");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1223,7 +1223,7 @@ void FTermDetectionTest::openbsdTest()
detect.setOpenBSDTerm(false); detect.setOpenBSDTerm(false);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() ); CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -1244,7 +1244,7 @@ void FTermDetectionTest::sunTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("sun-color")); data.setTermType("sun-color");
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1291,7 +1291,7 @@ void FTermDetectionTest::sunTest()
detect.setSunTerminal(false); detect.setSunTerminal(false);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( ! detect.isSunTerminal() ); CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -1312,7 +1312,7 @@ void FTermDetectionTest::screenTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("screen")); data.setTermType("screen");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1354,12 +1354,12 @@ void FTermDetectionTest::screenTest()
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() ); CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() ); CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "screen") ;
setenv ("XTERM_VERSION", "XTerm(312)", 1); setenv ("XTERM_VERSION", "XTerm(312)", 1);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen-256color") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "screen-256color") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -1380,7 +1380,7 @@ void FTermDetectionTest::tmuxTest()
{ {
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
data.setTermType(C_STR("screen")); data.setTermType("screen");
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1423,12 +1423,12 @@ void FTermDetectionTest::tmuxTest()
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() ); CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() ); CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "screen") ;
setenv ("VTE_VERSION", "3801", 1); setenv ("VTE_VERSION", "3801", 1);
detect.detect(); detect.detect();
CPPUNIT_ASSERT ( detect.canDisplay256Colors() ); CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen-256color") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "screen-256color") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();
@ -1484,7 +1484,7 @@ void FTermDetectionTest::ttytypeTest()
finalcut::FTermDetection detect; finalcut::FTermDetection detect;
detect.setTerminalDetection(true); detect.setTerminalDetection(true);
detect.setTtyTypeFileName(C_STR("new-root-dir/etc/ttytype")); detect.setTtyTypeFileName("new-root-dir/etc/ttytype");
pid_t pid = forkConEmu(); pid_t pid = forkConEmu();
@ -1503,19 +1503,19 @@ void FTermDetectionTest::ttytypeTest()
finalcut::FTermData& data = *finalcut::FTerm::getFTermData(); finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
// Test /dev/tty3 with linux // Test /dev/tty3 with linux
data.setTermFileName(C_STR("/dev/tty3")); data.setTermFileName("/dev/tty3");
detect.detect(); detect.detect();
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("linux") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "linux") ;
// Test /dev/ttyp0 with vt100 // Test /dev/ttyp0 with vt100
data.setTermFileName(C_STR("/dev/ttyp0")); data.setTermFileName("/dev/ttyp0");
detect.detect(); detect.detect();
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
// Test non-existent /dev/tty8 with fallback to vt100 // Test non-existent /dev/tty8 with fallback to vt100
data.setTermFileName(C_STR("/dev/tty8")); data.setTermFileName("/dev/tty8");
detect.detect(); detect.detect();
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") ); CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100") ;
printConEmuDebug(); printConEmuDebug();
closeConEmuStdStreams(); closeConEmuStdStreams();

View File

@ -523,7 +523,7 @@ void ftermopenbsdTest::openbsdConsoleTest()
CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 25 ); CPPUNIT_ASSERT ( data->getTermGeometry().getHeight() == 25 );
CPPUNIT_ASSERT ( ! data->hasShadowCharacter() ); CPPUNIT_ASSERT ( ! data->hasShadowCharacter() );
CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() ); CPPUNIT_ASSERT ( ! data->hasHalfBlockCharacter() );
CPPUNIT_ASSERT_CSTRING ( term_detection->getTermType(), C_STR("pccon") ); CPPUNIT_ASSERT_CSTRING ( term_detection->getTermType(), "pccon" );
openbsd.finish(); openbsd.finish();