From 4eefb44ee1b0351ef41f7442c562f884f7b6cfa7 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sat, 26 Jan 2019 22:27:44 +0100 Subject: [PATCH] termptyesc: handle DECSWBV + tests --- src/bin/termptyesc.c | 30 ++++++++++++++++++++++++++++++ tests/decswbv.sh | 22 ++++++++++++++++++++++ tests/tests.results | 1 + 3 files changed, 53 insertions(+) create mode 100755 tests/decswbv.sh diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index e65502fc..b80c11c1 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -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); diff --git a/tests/decswbv.sh b/tests/decswbv.sh new file mode 100755 index 00000000..a5b46ec0 --- /dev/null +++ b/tests/decswbv.sh @@ -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' diff --git a/tests/tests.results b/tests/tests.results index 0ea57ec5..37e680ed 100644 --- a/tests/tests.results +++ b/tests/tests.results @@ -75,3 +75,4 @@ rep.sh b91ebb46fb5ebd95aa2cb87ad12bb4ba da.sh 3083fbec33befe5299ca3726a19fcff2 uts.sh 1c72fe49e7f98aac137d436ac4906bc8 vpa.sh c712e5c3c5e31a362e4257200d92d9a6 +decswbv.sh f7dde335d44f8691041d40c3efd24ffb