Changing renditions no longer clears wrap state
This commit is contained in:
@@ -22,7 +22,6 @@ std::string Emulator::read_octets_to_host( void )
|
||||
|
||||
void Emulator::execute( const Parser::Execute *act )
|
||||
{
|
||||
fb.ds.next_print_will_wrap = false;
|
||||
dispatch.dispatch( CONTROL, act, &fb );
|
||||
}
|
||||
|
||||
@@ -111,19 +110,16 @@ void Emulator::print( const Parser::Print *act )
|
||||
|
||||
void Emulator::CSI_dispatch( const Parser::CSI_Dispatch *act )
|
||||
{
|
||||
fb.ds.next_print_will_wrap = false;
|
||||
dispatch.dispatch( CSI, act, &fb );
|
||||
}
|
||||
|
||||
void Emulator::OSC_end( const Parser::OSC_End *act )
|
||||
{
|
||||
fb.ds.next_print_will_wrap = false;
|
||||
dispatch.OSC_dispatch( act, &fb );
|
||||
}
|
||||
|
||||
void Emulator::Esc_dispatch( const Parser::Esc_Dispatch *act )
|
||||
{
|
||||
fb.ds.next_print_will_wrap = false;
|
||||
/* handle 7-bit ESC-encoding of C1 control characters */
|
||||
if ( (dispatch.get_dispatch_chars().size() == 0)
|
||||
&& (0x40 <= act->ch)
|
||||
|
||||
+10
-3
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "terminaldispatcher.hpp"
|
||||
#include "parseraction.hpp"
|
||||
#include "terminalframebuffer.hpp"
|
||||
|
||||
using namespace Terminal;
|
||||
|
||||
@@ -135,8 +136,9 @@ static void register_function( Function_Type type,
|
||||
}
|
||||
|
||||
Function::Function( Function_Type type, std::string dispatch_chars,
|
||||
void (*s_function)( Framebuffer *, Dispatcher * ) )
|
||||
: function( s_function )
|
||||
void (*s_function)( Framebuffer *, Dispatcher * ),
|
||||
bool s_clears_wrap_state )
|
||||
: function( s_function ), clears_wrap_state( s_clears_wrap_state )
|
||||
{
|
||||
register_function( type, dispatch_chars, *this );
|
||||
}
|
||||
@@ -163,14 +165,19 @@ void Dispatcher::dispatch( Function_Type type, const Parser::Action *act, Frameb
|
||||
if ( type == CONTROL ) {
|
||||
assert( act->ch <= 255 );
|
||||
char ctrlstr[ 2 ] = { (char)act->ch, 0 };
|
||||
key = std::string( ctrlstr );
|
||||
key = std::string( ctrlstr, 1 );
|
||||
}
|
||||
|
||||
dispatch_map_t::const_iterator i = map->find( key );
|
||||
if ( i == map->end() ) {
|
||||
/* unknown function */
|
||||
fb->ds.next_print_will_wrap = false;
|
||||
return;
|
||||
} else {
|
||||
act->handled = true;
|
||||
if ( i->second.clears_wrap_state ) {
|
||||
fb->ds.next_print_will_wrap = false;
|
||||
}
|
||||
return i->second.function( fb, this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,12 @@ namespace Terminal {
|
||||
|
||||
class Function {
|
||||
public:
|
||||
Function() : function( NULL ) {}
|
||||
Function() : function( NULL ), clears_wrap_state( true ) {}
|
||||
Function( Function_Type type, std::string dispatch_chars,
|
||||
void (*s_function)( Framebuffer *, Dispatcher * ) );
|
||||
void (*s_function)( Framebuffer *, Dispatcher * ),
|
||||
bool s_clears_wrap_state = true );
|
||||
void (*function)( Framebuffer *, Dispatcher * );
|
||||
bool clears_wrap_state;
|
||||
};
|
||||
|
||||
typedef std::map<std::string, Function> dispatch_map_t;
|
||||
|
||||
@@ -318,7 +318,7 @@ void CSI_SGR( Framebuffer *fb, Dispatcher *dispatch )
|
||||
}
|
||||
}
|
||||
|
||||
static Function func_CSI_SGR( CSI, "m", CSI_SGR );
|
||||
static Function func_CSI_SGR( CSI, "m", CSI_SGR, false ); /* changing renditions doesn't clear wrap flag */
|
||||
|
||||
/* save and restore cursor */
|
||||
void Esc_DECSC( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||
|
||||
Reference in New Issue
Block a user