termptyesc: handle DECSWBV + tests

This commit is contained in:
Boris Faure 2019-01-26 22:27:44 +01:00
parent 14e501c15a
commit 4eefb44ee1
3 changed files with 53 additions and 0 deletions

View File

@ -2981,6 +2981,32 @@ _handle_esc_csi_vpa(Termpty *ty, Eina_Unicode **ptr)
ty->cursor_state.cy = arg - 1;
}
static void
_handle_esc_csi_decswbv(Termpty *ty, Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
int arg = _csi_arg_get(ty, &b);
if (arg == -CSI_ARG_ERROR)
return;
DBG("DECSWBV - Set Warning Bell Volume: %d", arg);
switch (arg)
{
case 1:
DBG("Bell is off");
break;
case 2:
EINA_FALLTHROUGH;
case 3:
EINA_FALLTHROUGH;
case 4:
DBG("Bell volume is low");
break;
default:
DBG("Bell volume is high");
}
}
static int
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
{
@ -3182,6 +3208,10 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
case 't':
if (*(cc-1) == '$')
_handle_esc_csi_decrara(ty, &b, be-1);
else if (*(cc-1) == ' ')
{
_handle_esc_csi_decswbv(ty, &b);
}
else
{
arg = _csi_arg_get(ty, &b);

22
tests/decswbv.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
# fill space with E
printf '\033#8'
# set color
printf '\033[46;31;3m'
# Set Bell volume to Off
printf '\033[1 t\007'
# Set Bell volume to Low
printf '\033[2 t\007'
printf '\033[3 t\007'
printf '\033[4 t\007'
# Set Bell volume to High
printf '\033[5 t\007'
printf '\033[6 t\007'
printf '\033[7 t\007'
printf '\033[8 t\007'
printf '\033[0 t\007'
printf '\033[43 t\007'
printf '\033[ t\007'

View File

@ -75,3 +75,4 @@ rep.sh b91ebb46fb5ebd95aa2cb87ad12bb4ba
da.sh 3083fbec33befe5299ca3726a19fcff2
uts.sh 1c72fe49e7f98aac137d436ac4906bc8
vpa.sh c712e5c3c5e31a362e4257200d92d9a6
decswbv.sh f7dde335d44f8691041d40c3efd24ffb