mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
Terminal: add explicit handling of sgr0 + sgr seq
sgr0 is currently implemented as a wrapper of sgr(0) which seems to work fine. For now we accept but ignore certain sgr sequences like for example [0;10;1m which is generated by lynx even when using TERM=linux (I am not sure yet if that's actually valid at all).
This commit is contained in:
parent
0d0ebd5a7f
commit
838d867680
@ -181,6 +181,11 @@ namespace Terminal {
|
||||
*/
|
||||
virtual void sgr(int) = 0;
|
||||
|
||||
/**
|
||||
* Turn of all attributes
|
||||
*/
|
||||
virtual void sgr0() = 0;
|
||||
|
||||
/**
|
||||
* Save current cursor position
|
||||
*/
|
||||
|
@ -343,12 +343,49 @@ namespace Terminal {
|
||||
_screen.setaf(p2 - 30);
|
||||
return true;
|
||||
}
|
||||
if ((p1 == 0 && p2 == 10)) {
|
||||
/* turn of all attributes */
|
||||
_screen.sgr0();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case 'R': return (_screen.u6(p1, p2), true);
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool _handle_esc_seq_7()
|
||||
{
|
||||
/*
|
||||
* All six-element escape sequences have the form
|
||||
* \E[<NUMBER1>;<NUMBER2>;<NUMBER3><COMMAND>
|
||||
*/
|
||||
|
||||
if ((_escape_stack[0].value != '[')
|
||||
|| (_escape_stack[1].type != Escape_stack::Entry::NUMBER)
|
||||
|| (_escape_stack[2].value != ';')
|
||||
|| (_escape_stack[3].type != Escape_stack::Entry::NUMBER)
|
||||
|| (_escape_stack[4].value != ';')
|
||||
|| (_escape_stack[5].type != Escape_stack::Entry::NUMBER))
|
||||
return false;
|
||||
|
||||
int const command = _escape_stack[6].value;
|
||||
|
||||
switch (command) {
|
||||
case 'm':
|
||||
|
||||
/*
|
||||
* Currently returning true w/o actually handling the
|
||||
* sequence
|
||||
*/
|
||||
PDBG("Sequence '[X;Y;Zm' is not implemented");
|
||||
return true;
|
||||
default: return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Decoder(Character_screen &screen)
|
||||
@ -425,7 +462,8 @@ namespace Terminal {
|
||||
|| ((_escape_stack.num_elem() == 2) && _handle_esc_seq_2())
|
||||
|| ((_escape_stack.num_elem() == 3) && _handle_esc_seq_3())
|
||||
|| ((_escape_stack.num_elem() == 4) && _handle_esc_seq_4())
|
||||
|| ((_escape_stack.num_elem() == 5) && _handle_esc_seq_5()))
|
||||
|| ((_escape_stack.num_elem() == 5) && _handle_esc_seq_5())
|
||||
|| ((_escape_stack.num_elem() == 7) && _handle_esc_seq_7()))
|
||||
_enter_state_idle();
|
||||
};
|
||||
};
|
||||
|
@ -619,6 +619,11 @@ class Char_cell_array_character_screen : public Terminal::Character_screen
|
||||
_color_index = DEFAULT_COLOR_INDEX;
|
||||
}
|
||||
|
||||
void sgr0()
|
||||
{
|
||||
sgr(0);
|
||||
}
|
||||
|
||||
void sc()
|
||||
{
|
||||
PDBG("not implemented");
|
||||
|
@ -185,6 +185,10 @@ class Static_character_screen : public Terminal::Character_screen
|
||||
{
|
||||
}
|
||||
|
||||
virtual void sgr0()
|
||||
{
|
||||
}
|
||||
|
||||
void sc()
|
||||
{
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user