SGRoptimizer improved
This commit is contained in:
parent
164487096c
commit
b23974858e
|
@ -1,5 +1,6 @@
|
|||
2020-02-19 Markus Gans <guru.mail@muenster.de>
|
||||
* Some small code improvements
|
||||
* SGRoptimizer improved
|
||||
|
||||
2020-02-16 Markus Gans <guru.mail@muenster.de>
|
||||
* Printing a FStyle object allows you to change video attributes
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <iostream>
|
||||
#include "final/fc.h"
|
||||
#include "final/sgr_optimizer.h"
|
||||
|
||||
|
@ -86,6 +86,10 @@ void SGRoptimizer::findParameter()
|
|||
start = NOT_SET;
|
||||
}
|
||||
|
||||
// Other content
|
||||
if ( ! csi_parameter.empty() && i > csi_parameter.back().end + 2 )
|
||||
break;
|
||||
|
||||
if ( esc && seq[i] == '[' ) // Esc [
|
||||
csi = true;
|
||||
|
||||
|
|
|
@ -269,10 +269,21 @@ void FOptiAttrTest::sgrOptimizerTest()
|
|||
sgr_optimizer.optimize();
|
||||
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20;48;5;229m") );
|
||||
|
||||
|
||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" XXXX<<< CSI "48;5;229m");
|
||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" CSI "11;16H");
|
||||
sgr_optimizer.optimize();
|
||||
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20;48;5;229m") );
|
||||
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20m" CSI "11;16H") );
|
||||
|
||||
std::strcpy(buffer, CSI "1;1H" CSI "m" CSI "38;5;35m");
|
||||
sgr_optimizer.optimize();
|
||||
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "1;1H" CSI "0;38;5;35m") );
|
||||
|
||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" CSI "11;16H" CSI "48;5;229m");
|
||||
sgr_optimizer.optimize();
|
||||
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20m" CSI "11;16H" CSI "48;5;229m") );
|
||||
|
||||
std::strcpy(buffer, CSI "m" CSI "38;5;20m" "ABC" CSI "48;5;229m");
|
||||
sgr_optimizer.optimize();
|
||||
CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;5;20mABC" CSI "48;5;229m") );
|
||||
|
||||
|
||||
std::strcpy(buffer, CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m"
|
||||
|
|
Loading…
Reference in New Issue