Convert FOptiMove from char[] to std::string
This commit is contained in:
parent
795ebcdea8
commit
f06ccc6495
|
@ -16,12 +16,12 @@ Describe clearly and precisely what the problem is.
|
||||||
Example: I have an issue when [...]
|
Example: I have an issue when [...]
|
||||||
|
|
||||||
|
|
||||||
**Describe your desired solution**
|
**Your desired solution**
|
||||||
|
|
||||||
Describe clearly and concisely what you want to reach.
|
Describe clearly and concisely what you want to reach.
|
||||||
|
|
||||||
|
|
||||||
**Describe alternatives you have considered**
|
**Alternatives you have considered**
|
||||||
|
|
||||||
Describe clearly and concisely the other solutions you considered.
|
Describe clearly and concisely the other solutions you considered.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2021-05-22 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Convert FOptiMove from char[] to std::string
|
||||||
|
|
||||||
2021-05-13 Markus Gans <guru.mail@muenster.de>
|
2021-05-13 Markus Gans <guru.mail@muenster.de>
|
||||||
* Prevent duplicate widget in the close widget list
|
* Prevent duplicate widget in the close widget list
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ FOptiMove::FOptiMove (int baud)
|
||||||
{
|
{
|
||||||
assert ( baud >= 0 );
|
assert ( baud >= 0 );
|
||||||
|
|
||||||
|
move_buf.reserve(BUF_SIZE);
|
||||||
calculateCharDuration();
|
calculateCharDuration();
|
||||||
|
|
||||||
// ANSI set cursor address preset for undefined terminals
|
// ANSI set cursor address preset for undefined terminals
|
||||||
|
@ -481,7 +482,7 @@ void FOptiMove::check_boundaries ( int& xold, int& yold
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|
std::string FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|
||||||
{
|
{
|
||||||
int method{0};
|
int method{0};
|
||||||
int move_time{LONG_DURATION};
|
int move_time{LONG_DURATION};
|
||||||
|
@ -494,7 +495,7 @@ const char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|
||||||
|| yold < 0
|
|| yold < 0
|
||||||
|| isWideMove (xold, yold, xnew, ynew) ) )
|
|| isWideMove (xold, yold, xnew, ynew) ) )
|
||||||
{
|
{
|
||||||
return ( move_time < LONG_DURATION ) ? move_buf : nullptr;
|
return ( move_time < LONG_DURATION ) ? move_buf : std::string{};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method 1: local movement
|
// Method 1: local movement
|
||||||
|
@ -523,7 +524,7 @@ const char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|
||||||
if ( move_time < LONG_DURATION )
|
if ( move_time < LONG_DURATION )
|
||||||
return move_buf;
|
return move_buf;
|
||||||
else
|
else
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -605,28 +606,21 @@ int FOptiMove::capDurationToLength (int duration) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FOptiMove::repeatedAppend ( const Capability& o
|
int FOptiMove::repeatedAppend ( const Capability& o
|
||||||
, int count
|
, int count
|
||||||
, char* dst ) const
|
, std::string& dst ) const
|
||||||
{
|
{
|
||||||
const std::size_t src_len = std::strlen(o.cap);
|
const std::size_t src_len = std::strlen(o.cap);
|
||||||
const std::size_t dst_len = ( dst != nullptr ) ? std::strlen(dst) : 0;
|
const std::size_t dst_len = dst.length();
|
||||||
int total{0};
|
int total{0};
|
||||||
|
|
||||||
if ( (dst_len + uInt(count) * src_len) < BUF_SIZE - 1 )
|
if ( (dst_len + uInt(count) * src_len) < BUF_SIZE - 1 )
|
||||||
{
|
{
|
||||||
total += count * o.duration;
|
total += count * o.duration;
|
||||||
|
int cnt = count;
|
||||||
|
|
||||||
if ( dst )
|
while ( cnt > 0 )
|
||||||
{
|
{
|
||||||
dst += dst_len;
|
cnt--;
|
||||||
std::size_t free = BUF_SIZE - dst_len - 2;
|
dst.append(o.cap);
|
||||||
int cnt = count;
|
|
||||||
|
|
||||||
while ( cnt-- > 0 )
|
|
||||||
{
|
|
||||||
std::strncpy (dst, o.cap, free);
|
|
||||||
dst += src_len;
|
|
||||||
free -= src_len;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -636,15 +630,15 @@ int FOptiMove::repeatedAppend ( const Capability& o
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FOptiMove::relativeMove ( char move[]
|
int FOptiMove::relativeMove ( std::string& move
|
||||||
, int from_x, int from_y
|
, int from_x, int from_y
|
||||||
, int to_x, int to_y ) const
|
, int to_x, int to_y ) const
|
||||||
{
|
{
|
||||||
int vtime{0};
|
int vtime{0};
|
||||||
int htime{0};
|
int htime{0};
|
||||||
|
|
||||||
if ( move )
|
if ( ! move.empty() )
|
||||||
move[0] = '\0';
|
move.clear();
|
||||||
|
|
||||||
if ( to_y != from_y ) // vertical move
|
if ( to_y != from_y ) // vertical move
|
||||||
{
|
{
|
||||||
|
@ -656,41 +650,30 @@ int FOptiMove::relativeMove ( char move[]
|
||||||
|
|
||||||
if ( to_x != from_x ) // horizontal move
|
if ( to_x != from_x ) // horizontal move
|
||||||
{
|
{
|
||||||
char hmove[BUF_SIZE]{};
|
std::string hmove{};
|
||||||
htime = horizontalMove (hmove, from_x, to_x);
|
htime = horizontalMove (hmove, from_x, to_x);
|
||||||
|
|
||||||
if ( htime >= LONG_DURATION )
|
if ( htime >= LONG_DURATION )
|
||||||
return LONG_DURATION;
|
return LONG_DURATION;
|
||||||
|
|
||||||
if ( move )
|
if ( ! move.empty() )
|
||||||
{
|
move.append(hmove);
|
||||||
if ( *move )
|
else
|
||||||
std::strncat (move, hmove, BUF_SIZE - std::strlen(move));
|
move = hmove;
|
||||||
else
|
|
||||||
std::strncpy (move, hmove, BUF_SIZE);
|
|
||||||
|
|
||||||
move[BUF_SIZE - 1] = '\0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return vtime + htime;
|
return vtime + htime;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FOptiMove::verticalMove (char move[], int from_y, int to_y) const
|
inline int FOptiMove::verticalMove (std::string& move, int from_y, int to_y) const
|
||||||
{
|
{
|
||||||
int vtime{LONG_DURATION};
|
int vtime{LONG_DURATION};
|
||||||
|
|
||||||
if ( F_row_address.cap )
|
if ( F_row_address.cap )
|
||||||
{
|
{
|
||||||
if ( move )
|
// Move to fixed row position
|
||||||
{
|
move = FTermcap::encodeParameter(F_row_address.cap, to_y);
|
||||||
std::strncpy ( move
|
|
||||||
, FTermcap::encodeParameter(F_row_address.cap, to_y).data()
|
|
||||||
, BUF_SIZE );
|
|
||||||
move[BUF_SIZE - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
vtime = F_row_address.duration;
|
vtime = F_row_address.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,74 +686,58 @@ inline int FOptiMove::verticalMove (char move[], int from_y, int to_y) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FOptiMove::downMove ( char move[], int& vtime
|
inline void FOptiMove::downMove ( std::string& move, int& vtime
|
||||||
, int from_y, int to_y ) const
|
, int from_y, int to_y ) const
|
||||||
{
|
{
|
||||||
const int num = to_y - from_y;
|
const int num = to_y - from_y;
|
||||||
|
|
||||||
if ( F_parm_down_cursor.cap && F_parm_down_cursor.duration < vtime )
|
if ( F_parm_down_cursor.cap && F_parm_down_cursor.duration < vtime )
|
||||||
{
|
{
|
||||||
if ( move )
|
move = FTermcap::encodeParameter(F_parm_down_cursor.cap, num);
|
||||||
{
|
|
||||||
std::strncpy ( move
|
|
||||||
, FTermcap::encodeParameter(F_parm_down_cursor.cap, num).data()
|
|
||||||
, BUF_SIZE );
|
|
||||||
move[BUF_SIZE - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
vtime = F_parm_down_cursor.duration;
|
vtime = F_parm_down_cursor.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( F_cursor_down.cap && (num * F_cursor_down.duration < vtime) )
|
if ( F_cursor_down.cap && (num * F_cursor_down.duration < vtime) )
|
||||||
{
|
{
|
||||||
if ( move )
|
if ( ! move.empty() )
|
||||||
move[0] = '\0';
|
move.clear();
|
||||||
|
|
||||||
vtime = repeatedAppend (F_cursor_down, num, move);
|
vtime = repeatedAppend (F_cursor_down, num, move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FOptiMove::upMove ( char move[], int& vtime
|
inline void FOptiMove::upMove ( std::string& move, int& vtime
|
||||||
, int from_y, int to_y ) const
|
, int from_y, int to_y ) const
|
||||||
{
|
{
|
||||||
const int num = from_y - to_y;
|
const int num = from_y - to_y;
|
||||||
|
|
||||||
if ( F_parm_up_cursor.cap && F_parm_up_cursor.duration < vtime )
|
if ( F_parm_up_cursor.cap && F_parm_up_cursor.duration < vtime )
|
||||||
{
|
{
|
||||||
if ( move )
|
move = FTermcap::encodeParameter(F_parm_up_cursor.cap, num);
|
||||||
{
|
|
||||||
std::strncpy ( move
|
|
||||||
, FTermcap::encodeParameter(F_parm_up_cursor.cap, num).data()
|
|
||||||
, BUF_SIZE );
|
|
||||||
move[BUF_SIZE - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
vtime = F_parm_up_cursor.duration;
|
vtime = F_parm_up_cursor.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( F_cursor_up.cap && (num * F_cursor_up.duration < vtime) )
|
if ( F_cursor_up.cap && (num * F_cursor_up.duration < vtime) )
|
||||||
{
|
{
|
||||||
if ( move )
|
if ( ! move.empty() )
|
||||||
move[0] = '\0';
|
move.clear();
|
||||||
|
|
||||||
vtime = repeatedAppend (F_cursor_up, num, move);
|
vtime = repeatedAppend (F_cursor_up, num, move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x) const
|
inline int FOptiMove::horizontalMove (std::string& hmove, int from_x, int to_x) const
|
||||||
{
|
{
|
||||||
int htime{LONG_DURATION};
|
int htime{LONG_DURATION};
|
||||||
|
|
||||||
if ( F_column_address.cap )
|
if ( F_column_address.cap )
|
||||||
{
|
{
|
||||||
// Move to fixed column position1
|
// Move to fixed column position
|
||||||
std::strncat ( hmove
|
hmove = FTermcap::encodeParameter(F_column_address.cap, to_x);
|
||||||
, FTermcap::encodeParameter(F_column_address.cap, to_x).data()
|
|
||||||
, BUF_SIZE - std::strlen(hmove) - 1 );
|
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
|
||||||
htime = F_column_address.duration;
|
htime = F_column_address.duration;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( to_x > from_x )
|
if ( to_x > from_x )
|
||||||
|
@ -782,25 +749,21 @@ inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FOptiMove::rightMove ( char hmove[], int& htime
|
inline void FOptiMove::rightMove ( std::string& hmove, int& htime
|
||||||
, int from_x, int to_x ) const
|
, int from_x, int to_x ) const
|
||||||
{
|
{
|
||||||
int num = to_x - from_x;
|
int num = to_x - from_x;
|
||||||
|
|
||||||
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
|
hmove = FTermcap::encodeParameter(F_parm_right_cursor.cap, num);
|
||||||
, FTermcap::encodeParameter(F_parm_right_cursor.cap, num).data()
|
|
||||||
, BUF_SIZE - 1);
|
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
|
||||||
htime = F_parm_right_cursor.duration;
|
htime = F_parm_right_cursor.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( F_cursor_right.cap )
|
if ( F_cursor_right.cap )
|
||||||
{
|
{
|
||||||
std::array<char, BUF_SIZE> str{};
|
std::string str{};
|
||||||
int htime_r{0};
|
int htime_r{0};
|
||||||
str[0] = '\0';
|
|
||||||
|
|
||||||
// try to use tab
|
// try to use tab
|
||||||
if ( tabstop > 0 && F_tab.cap )
|
if ( tabstop > 0 && F_tab.cap )
|
||||||
|
@ -814,7 +777,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
|
||||||
if ( tab_pos > to_x )
|
if ( tab_pos > to_x )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
htime_r += repeatedAppend (F_tab, 1, str.data());
|
htime_r += repeatedAppend (F_tab, 1, str);
|
||||||
|
|
||||||
if ( htime_r >= LONG_DURATION )
|
if ( htime_r >= LONG_DURATION )
|
||||||
break;
|
break;
|
||||||
|
@ -825,37 +788,32 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
|
||||||
num = to_x - pos;
|
num = to_x - pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
htime_r += repeatedAppend (F_cursor_right, num, str.data());
|
htime_r += repeatedAppend (F_cursor_right, num, str);
|
||||||
|
|
||||||
if ( htime_r < htime )
|
if ( htime_r < htime )
|
||||||
{
|
{
|
||||||
std::strncpy (hmove, str.data(), BUF_SIZE);
|
hmove = str;
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
|
||||||
htime = htime_r;
|
htime = htime_r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FOptiMove::leftMove ( char hmove[], int& htime
|
inline void FOptiMove::leftMove ( std::string& hmove, int& htime
|
||||||
, int from_x, int to_x ) const
|
, int from_x, int to_x ) const
|
||||||
{
|
{
|
||||||
int num = from_x - to_x;
|
int num = from_x - to_x;
|
||||||
|
|
||||||
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
|
hmove = FTermcap::encodeParameter(F_parm_left_cursor.cap, num);
|
||||||
, FTermcap::encodeParameter(F_parm_left_cursor.cap, num).data()
|
|
||||||
, BUF_SIZE - 1);
|
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
|
||||||
htime = F_parm_left_cursor.duration;
|
htime = F_parm_left_cursor.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( F_cursor_left.cap )
|
if ( F_cursor_left.cap )
|
||||||
{
|
{
|
||||||
std::array<char, BUF_SIZE> str{};
|
std::string str{};
|
||||||
int htime_l{0};
|
int htime_l{0};
|
||||||
str[0] = '\0';
|
|
||||||
|
|
||||||
// try to use backward tab
|
// try to use backward tab
|
||||||
if ( tabstop > 0 && F_back_tab.cap )
|
if ( tabstop > 0 && F_back_tab.cap )
|
||||||
|
@ -869,7 +827,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
if ( tab_pos < to_x )
|
if ( tab_pos < to_x )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
htime_l += repeatedAppend (F_back_tab, 1, str.data());
|
htime_l += repeatedAppend (F_back_tab, 1, str);
|
||||||
|
|
||||||
if ( htime_l >= LONG_DURATION )
|
if ( htime_l >= LONG_DURATION )
|
||||||
break;
|
break;
|
||||||
|
@ -880,12 +838,12 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
|
||||||
num = pos - to_x;
|
num = pos - to_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
htime_l += repeatedAppend (F_cursor_left, num, str.data());
|
htime_l += repeatedAppend (F_cursor_left, num, str);
|
||||||
|
|
||||||
if ( htime_l < htime )
|
if ( htime_l < htime )
|
||||||
{
|
{
|
||||||
std::strncpy (hmove, str.data(), BUF_SIZE);
|
|
||||||
hmove[BUF_SIZE - 1] = '\0';
|
hmove = str;
|
||||||
htime = htime_l;
|
htime = htime_l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -914,9 +872,7 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
|
||||||
|
|
||||||
if ( ! move_xy.empty() )
|
if ( ! move_xy.empty() )
|
||||||
{
|
{
|
||||||
std::strncpy ( static_cast<char*>(move_buf)
|
move_buf = move_xy;
|
||||||
, move_xy.data(), BUF_SIZE - 1 );
|
|
||||||
move_buf[BUF_SIZE - 1] = '\0';
|
|
||||||
move_time = F_cursor_address.duration;
|
move_time = F_cursor_address.duration;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -933,8 +889,8 @@ inline bool FOptiMove::isMethod1Faster ( int& move_time
|
||||||
|
|
||||||
if ( xold >= 0 && yold >= 0 )
|
if ( xold >= 0 && yold >= 0 )
|
||||||
{
|
{
|
||||||
std::array<char, BUF_SIZE> null_result{};
|
std::string null_result{};
|
||||||
const int new_time = relativeMove (null_result.data(), xold, yold, xnew, ynew);
|
const int new_time = relativeMove (null_result, xold, yold, xnew, ynew);
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION && new_time < move_time )
|
if ( new_time < LONG_DURATION && new_time < move_time )
|
||||||
{
|
{
|
||||||
|
@ -955,8 +911,8 @@ inline bool FOptiMove::isMethod2Faster ( int& move_time
|
||||||
|
|
||||||
if ( yold >= 0 && F_carriage_return.cap )
|
if ( yold >= 0 && F_carriage_return.cap )
|
||||||
{
|
{
|
||||||
std::array<char, BUF_SIZE> null_result{};
|
std::string null_result{};
|
||||||
const int new_time = relativeMove (null_result.data(), 0, yold, xnew, ynew);
|
const int new_time = relativeMove (null_result, 0, yold, xnew, ynew);
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
if ( new_time < LONG_DURATION
|
||||||
&& F_carriage_return.duration + new_time < move_time )
|
&& F_carriage_return.duration + new_time < move_time )
|
||||||
|
@ -977,8 +933,8 @@ inline bool FOptiMove::isMethod3Faster ( int& move_time
|
||||||
|
|
||||||
if ( F_cursor_home.cap )
|
if ( F_cursor_home.cap )
|
||||||
{
|
{
|
||||||
std::array<char, BUF_SIZE> null_result{};
|
std::string null_result{};
|
||||||
const int new_time = relativeMove (null_result.data(), 0, 0, xnew, ynew);
|
const int new_time = relativeMove (null_result, 0, 0, xnew, ynew);
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
if ( new_time < LONG_DURATION
|
||||||
&& F_cursor_home.duration + new_time < move_time )
|
&& F_cursor_home.duration + new_time < move_time )
|
||||||
|
@ -998,10 +954,9 @@ inline bool FOptiMove::isMethod4Faster ( int& move_time
|
||||||
// Test method 4: home-down + local movement
|
// Test method 4: home-down + local movement
|
||||||
if ( F_cursor_to_ll.cap )
|
if ( F_cursor_to_ll.cap )
|
||||||
{
|
{
|
||||||
std::array<char, BUF_SIZE> null_result{};
|
std::string null_result{};
|
||||||
const int new_time = relativeMove ( null_result.data()
|
int down = int(screen_height) - 1;
|
||||||
, 0, int(screen_height) - 1
|
const int new_time = relativeMove (null_result, 0, down, xnew, ynew);
|
||||||
, xnew, ynew );
|
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
if ( new_time < LONG_DURATION
|
||||||
&& F_cursor_to_ll.duration + new_time < move_time )
|
&& F_cursor_to_ll.duration + new_time < move_time )
|
||||||
|
@ -1025,10 +980,10 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
|
||||||
&& yold > 0
|
&& yold > 0
|
||||||
&& F_cursor_left.cap )
|
&& F_cursor_left.cap )
|
||||||
{
|
{
|
||||||
std::array<char, BUF_SIZE> null_result{};
|
std::string null_result{};
|
||||||
const int new_time = relativeMove ( null_result.data()
|
int x = int(screen_width) - 1;
|
||||||
, int(screen_width) - 1, yold - 1
|
int y = yold - 1;
|
||||||
, xnew, ynew );
|
const int new_time = relativeMove (null_result, x, y, xnew, ynew);
|
||||||
|
|
||||||
if ( new_time < LONG_DURATION
|
if ( new_time < LONG_DURATION
|
||||||
&& F_carriage_return.cap
|
&& F_carriage_return.cap
|
||||||
|
@ -1037,7 +992,6 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
|
||||||
{
|
{
|
||||||
move_time = F_carriage_return.duration
|
move_time = F_carriage_return.duration
|
||||||
+ F_cursor_left.duration + new_time;
|
+ F_cursor_left.duration + new_time;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1050,52 +1004,55 @@ void FOptiMove::moveByMethod ( int method
|
||||||
, int xold, int yold
|
, int xold, int yold
|
||||||
, int xnew, int ynew )
|
, int xnew, int ynew )
|
||||||
{
|
{
|
||||||
char* move_ptr = move_buf;
|
|
||||||
|
|
||||||
switch ( method )
|
switch ( method )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
relativeMove (move_ptr, xold, yold, xnew, ynew);
|
relativeMove (move_buf, xold, yold, xnew, ynew);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if ( F_carriage_return.cap )
|
if ( F_carriage_return.cap )
|
||||||
{
|
{
|
||||||
std::strncpy (move_ptr, F_carriage_return.cap, BUF_SIZE - 1);
|
move_buf = F_carriage_return.cap;
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
std::string s{};
|
||||||
move_ptr += F_carriage_return.length;
|
relativeMove (s, 0, yold, xnew, ynew);
|
||||||
relativeMove (move_ptr, 0, yold, xnew, ynew);
|
move_buf.append(s);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
std::strncpy (move_ptr, F_cursor_home.cap, BUF_SIZE - 1);
|
move_buf = F_cursor_home.cap;
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
{
|
||||||
move_ptr += F_cursor_home.length;
|
std::string s{};
|
||||||
relativeMove (move_ptr, 0, 0, xnew, ynew);
|
relativeMove (s, 0, 0, xnew, ynew);
|
||||||
|
move_buf.append(s);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
std::strncpy (move_ptr, F_cursor_to_ll.cap, BUF_SIZE - 1);
|
move_buf = F_cursor_to_ll.cap;
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
{
|
||||||
move_ptr += F_cursor_to_ll.length;
|
std::string s{};
|
||||||
relativeMove (move_ptr, 0, int(screen_height) - 1, xnew, ynew);
|
int down = int(screen_height) - 1;
|
||||||
|
relativeMove (s, 0, down, xnew, ynew);
|
||||||
|
move_buf.append(s);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
move_buf[0] = '\0';
|
|
||||||
|
|
||||||
if ( xold >= 0 )
|
if ( xold >= 0 )
|
||||||
std::strncat ( move_ptr
|
move_buf = F_carriage_return.cap;
|
||||||
, F_carriage_return.cap
|
else
|
||||||
, BUF_SIZE - std::strlen(move_ptr) - 1 );
|
move_buf.clear();
|
||||||
|
|
||||||
std::strncat ( move_ptr
|
move_buf.append(F_cursor_left.cap);
|
||||||
, F_cursor_left.cap
|
{
|
||||||
, BUF_SIZE - std::strlen(move_ptr) - 1);
|
std::string s{};
|
||||||
move_ptr[BUF_SIZE - 1] ='\0';
|
int x = int(screen_width) - 1;
|
||||||
move_ptr += std::strlen(move_buf);
|
int y = yold - 1;
|
||||||
relativeMove (move_ptr, int(screen_width) - 1, yold - 1, xnew, ynew);
|
relativeMove (s, x, y, xnew, ynew);
|
||||||
|
move_buf.append(s);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -178,7 +178,7 @@ class FListBox : public FWidget
|
||||||
FListBox (Iterator, Iterator, InsertConverter, FWidget* = nullptr);
|
FListBox (Iterator, Iterator, InsertConverter, FWidget* = nullptr);
|
||||||
template <typename Container
|
template <typename Container
|
||||||
, typename LazyConverter>
|
, typename LazyConverter>
|
||||||
FListBox (Container, LazyConverter, FWidget* = nullptr);
|
FListBox (Container, LazyConverter&&, FWidget* = nullptr);
|
||||||
|
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
FListBox (const FListBox&) = delete;
|
FListBox (const FListBox&) = delete;
|
||||||
|
@ -235,10 +235,10 @@ class FListBox : public FWidget
|
||||||
template <typename Container
|
template <typename Container
|
||||||
, typename LazyConverter>
|
, typename LazyConverter>
|
||||||
void insert ( const Container&
|
void insert ( const Container&
|
||||||
, const LazyConverter& );
|
, LazyConverter&& );
|
||||||
template <typename Container
|
template <typename Container
|
||||||
, typename LazyConverter>
|
, typename LazyConverter>
|
||||||
void insert (Container*, const LazyConverter&);
|
void insert (Container*, LazyConverter&&);
|
||||||
void insert (const FListBoxItem&);
|
void insert (const FListBoxItem&);
|
||||||
template <typename T
|
template <typename T
|
||||||
, typename DT = std::nullptr_t>
|
, typename DT = std::nullptr_t>
|
||||||
|
@ -417,12 +417,12 @@ inline FListBox::FListBox ( Iterator first
|
||||||
template <typename Container
|
template <typename Container
|
||||||
, typename LazyConverter>
|
, typename LazyConverter>
|
||||||
inline FListBox::FListBox ( Container container
|
inline FListBox::FListBox ( Container container
|
||||||
, LazyConverter convert
|
, LazyConverter&& convert
|
||||||
, FWidget* parent )
|
, FWidget* parent )
|
||||||
: FWidget{parent}
|
: FWidget{parent}
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
insert (container, convert);
|
insert (container, std::forward<LazyConverter>(convert));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -550,11 +550,11 @@ inline void FListBox::insert ( Iterator first
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
template <typename Container
|
template <typename Container
|
||||||
, typename LazyConverter>
|
, typename LazyConverter>
|
||||||
void FListBox::insert (const Container& container, const LazyConverter& converter)
|
void FListBox::insert (const Container& container, LazyConverter&& converter)
|
||||||
{
|
{
|
||||||
conv_type = ConvertType::Lazy;
|
conv_type = ConvertType::Lazy;
|
||||||
source_container = makeFData(container);
|
source_container = makeFData(container);
|
||||||
lazy_inserter = converter;
|
lazy_inserter = std::move(converter);
|
||||||
const std::size_t size = container.size();
|
const std::size_t size = container.size();
|
||||||
|
|
||||||
if ( size > 0 )
|
if ( size > 0 )
|
||||||
|
@ -566,9 +566,9 @@ void FListBox::insert (const Container& container, const LazyConverter& converte
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
template <typename Container
|
template <typename Container
|
||||||
, typename LazyConverter>
|
, typename LazyConverter>
|
||||||
void FListBox::insert (Container* container, const LazyConverter& converter)
|
void FListBox::insert (Container* container, LazyConverter&& converter)
|
||||||
{
|
{
|
||||||
insert (*container, converter);
|
insert (*container, std::forward<LazyConverter>(converter));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "final/fstring.h"
|
#include "final/fstring.h"
|
||||||
|
|
||||||
|
@ -143,7 +144,7 @@ class FOptiMove final
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
void check_boundaries (int&, int&, int&, int&) const;
|
void check_boundaries (int&, int&, int&, int&) const;
|
||||||
const char* moveCursor (int, int, int, int);
|
std::string moveCursor (int, int, int, int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Capability
|
struct Capability
|
||||||
|
@ -154,7 +155,7 @@ class FOptiMove final
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constant
|
// Constant
|
||||||
static constexpr std::size_t BUF_SIZE{512};
|
static constexpr std::string::size_type BUF_SIZE{512u};
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static constexpr int LONG_DURATION{INT_MAX};
|
static constexpr int LONG_DURATION{INT_MAX};
|
||||||
|
@ -166,14 +167,14 @@ class FOptiMove final
|
||||||
void calculateCharDuration();
|
void calculateCharDuration();
|
||||||
int capDuration (const char[], int) const;
|
int capDuration (const char[], int) const;
|
||||||
int capDurationToLength (int) const;
|
int capDurationToLength (int) const;
|
||||||
int repeatedAppend (const Capability&, int, char*) const;
|
int repeatedAppend (const Capability&, int, std::string&) const;
|
||||||
int relativeMove (char[], int, int, int, int) const;
|
int relativeMove (std::string&, int, int, int, int) const;
|
||||||
int verticalMove (char[], int, int) const;
|
int verticalMove (std::string&, int, int) const;
|
||||||
void downMove (char[], int&, int, int) const;
|
void downMove (std::string&, int&, int, int) const;
|
||||||
void upMove (char[], int&, int, int) const;
|
void upMove (std::string&, int&, int, int) const;
|
||||||
int horizontalMove (char[], int, int) const;
|
int horizontalMove (std::string&, int, int) const;
|
||||||
void rightMove (char[], int&, int, int) const;
|
void rightMove (std::string&, int&, int, int) const;
|
||||||
void leftMove (char[], int&, int, int) const;
|
void leftMove (std::string&, int&, int, int) const;
|
||||||
|
|
||||||
bool isWideMove (int, int, int, int) const;
|
bool isWideMove (int, int, int, int) const;
|
||||||
bool isMethod0Faster (int&, int, int);
|
bool isMethod0Faster (int&, int, int);
|
||||||
|
@ -211,7 +212,7 @@ class FOptiMove final
|
||||||
int char_duration{1};
|
int char_duration{1};
|
||||||
int baudrate{9600};
|
int baudrate{9600};
|
||||||
int tabstop{0};
|
int tabstop{0};
|
||||||
char move_buf[BUF_SIZE]{'\0'};
|
std::string move_buf{};
|
||||||
bool automatic_left_margin{false};
|
bool automatic_left_margin{false};
|
||||||
bool eat_nl_glitch{false};
|
bool eat_nl_glitch{false};
|
||||||
|
|
||||||
|
|
|
@ -36,20 +36,17 @@
|
||||||
#include <final/final.h>
|
#include <final/final.h>
|
||||||
|
|
||||||
|
|
||||||
#define CPPUNIT_ASSERT_CSTRING(expected, actual) \
|
#define CPPUNIT_ASSERT_STRING(expected, actual) \
|
||||||
check_c_string (expected, actual, CPPUNIT_SOURCELINE())
|
check_string (expected, actual, CPPUNIT_SOURCELINE())
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void check_c_string ( const char* s1
|
void check_string ( const std::string& s1
|
||||||
, const char* s2
|
, const std::string& s2
|
||||||
, CppUnit::SourceLine sourceLine )
|
, CppUnit::SourceLine sourceLine )
|
||||||
{
|
{
|
||||||
if ( s1 == 0 && s2 == 0 ) // Strings are equal
|
if ( s1 == s2 ) // Strings are equal
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( s1 && s2 && std::strcmp (s1, s2) == 0 ) // Strings are equal
|
|
||||||
return;
|
|
||||||
|
|
||||||
::CppUnit::Asserter::fail ("Strings are not equal", sourceLine);
|
::CppUnit::Asserter::fail ("Strings are not equal", sourceLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,8 +118,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), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 1, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 9, 9), CSI "10;10H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 9, 9), CSI "10;10H");
|
||||||
|
|
||||||
// Delete all presets
|
// Delete all presets
|
||||||
om.set_tabular (0);
|
om.set_tabular (0);
|
||||||
|
@ -142,7 +139,7 @@ void FOptiMoveTest::noArgumentTest()
|
||||||
om.set_parm_right_cursor (0);
|
om.set_parm_right_cursor (0);
|
||||||
om.set_parm_left_cursor (0);
|
om.set_parm_left_cursor (0);
|
||||||
|
|
||||||
CPPUNIT_ASSERT (om.moveCursor (1, 1, 5, 5) == nullptr);
|
CPPUNIT_ASSERT (om.moveCursor (1, 1, 5, 5).empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -164,9 +161,9 @@ void FOptiMoveTest::homeTest()
|
||||||
om.set_parm_left_cursor (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), CSI "H");
|
CPPUNIT_ASSERT_STRING (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), CSI "X");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 10, 0, 23), CSI "X");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -191,8 +188,8 @@ void FOptiMoveTest::fromLeftToRightTest()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (CSI "%p1%dD");
|
om.set_parm_left_cursor (CSI "%p1%dD");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 1), "\r\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 1), "\r\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), "\r\b" ESC "D");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), "\r\b" ESC "D");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -218,39 +215,39 @@ void FOptiMoveTest::ansiTest()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (CSI "%p1%dD");
|
om.set_parm_left_cursor (CSI "%p1%dD");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), CSI "D");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), CSI "D");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), CSI "10G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), CSI "10G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), CSI "B");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), CSI "B");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
|
CPPUNIT_ASSERT_STRING (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), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), CSI "25d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 53, 40), CSI "25d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -274,39 +271,39 @@ void FOptiMoveTest::vt100Test()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (CSI "%p1%dD");
|
om.set_parm_left_cursor (CSI "%p1%dD");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H$<5>");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H$<5>");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C$<2>");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C$<2>");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "2C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "2C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A$<2>");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A$<2>");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "2A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "2A");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "76C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "76C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H$<5>");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H$<5>");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "7D");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "7D");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H$<5>");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H$<5>");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H$<5>");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H$<5>");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H$<5>");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H$<5>");
|
CPPUNIT_ASSERT_STRING (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), CSI "26C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "26C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 53, 40), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "2A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "2A");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -333,39 +330,39 @@ void FOptiMoveTest::xtermTest()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (CSI "%p1%dD");
|
om.set_parm_left_cursor (CSI "%p1%dD");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
|
CPPUNIT_ASSERT_STRING (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), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -391,39 +388,39 @@ void FOptiMoveTest::rxvtTest()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (CSI "%p1%dD");
|
om.set_parm_left_cursor (CSI "%p1%dD");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
|
CPPUNIT_ASSERT_STRING (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), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -450,39 +447,39 @@ void FOptiMoveTest::linuxTest()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (CSI "%p1%dD");
|
om.set_parm_left_cursor (CSI "%p1%dD");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
|
CPPUNIT_ASSERT_STRING (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), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -508,41 +505,41 @@ void FOptiMoveTest::cygwinTest()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (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_STRING ( printSequence(om.moveCursor (1, 2, 3, 4)).c_str()
|
||||||
, "Esc [ 5 ; 4 H " );
|
, "Esc [ 5 ; 4 H " );
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), CSI "B");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), CSI "B");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
|
CPPUNIT_ASSERT_STRING (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), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), CSI "B");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), CSI "B");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -570,39 +567,39 @@ void FOptiMoveTest::puttyTest()
|
||||||
om.set_parm_right_cursor (CSI "%p1%dC");
|
om.set_parm_right_cursor (CSI "%p1%dC");
|
||||||
om.set_parm_left_cursor (CSI "%p1%dD");
|
om.set_parm_left_cursor (CSI "%p1%dD");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" ESC "D");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r" ESC "D");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), ESC "D");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), ESC "D");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), ESC "M");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), ESC "M");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), ESC "D" ESC "D");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), ESC "D" ESC "D");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), ESC "M" ESC "M");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), ESC "M" ESC "M");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
|
CPPUNIT_ASSERT_STRING (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), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), ESC "D");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), ESC "D");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), ESC "M" ESC "M");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), ESC "M" ESC "M");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -641,39 +638,39 @@ void FOptiMoveTest::teratermTest()
|
||||||
|
|
||||||
om.setTermEnvironment(optimove_env);
|
om.setTermEnvironment(optimove_env);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;80H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
|
CPPUNIT_ASSERT_STRING (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), CSI "11;24H");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
|
CPPUNIT_ASSERT_STRING (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), CSI "80G");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -699,39 +696,39 @@ void FOptiMoveTest::wyse50Test()
|
||||||
// << 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), ESC "=%%");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), ESC "=%%");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), "\036");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), "\036");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), "\f");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), "\f");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), "\f\f");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), "\f\f");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), ESC "= (");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), ESC "= (");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), "\v");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), "\v");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), "\v\v");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), "\v\v");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), "\r\b\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), "\r\b\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), ESC "=4k");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), ESC "=4k");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), ESC "= @");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), ESC "= @");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
|
CPPUNIT_ASSERT_STRING (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), ESC "=*o");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), ESC "=*o");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), ESC "=*R");
|
CPPUNIT_ASSERT_STRING (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), ESC "=*7");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), ESC "=*7");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), ESC "=*,");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), ESC "=*,");
|
||||||
|
|
||||||
// xnew is outside screen
|
// xnew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), "\r\b\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), "\r\b\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
|
||||||
|
|
||||||
// ynew is outside screen
|
// ynew is outside screen
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
|
||||||
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), "\v\v");
|
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), "\v\v");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue