[Lxr-commits] CVS: lxr/scripts VTescape.pm,1.2,1.3
Brought to you by:
ajlittoz
From: Andre-Littoz <ajl...@us...> - 2013-11-07 16:32:43
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9875/scripts Modified Files: VTescape.pm Log Message: scripts/VTescape.pm: implement new ANSI escape functions to easily drive a VT terminal Index: VTescape.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/VTescape.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VTescape.pm 24 Sep 2013 15:24:07 -0000 1.2 +++ VTescape.pm 7 Nov 2013 16:32:40 -0000 1.3 @@ -35,8 +35,9 @@ $VTred $VTyellow $VTgreen $VTcyan $VTblue $VTmagenta $VTblack $VTwhite VTCUU VTCUD VTCUF VTCUB VTCNL VTCPL VTCHA VTCUP - VTDL VTDSR VTED VTEL VTHVP VTICH VTIL VTRCP - VTSCP VTSD VTSSR VTSU + VTDCH VTDL VTDSR VTECH VTED VTEL VTHVP VTICH + VTIL VTRCP VTRM VTSCP VTSD VTSM VTSSR VTSU + VTprRM VTprRSM VTprSM VTprSVM ); # Some ANSI escape sequences to highlight error messages in output @@ -140,7 +141,7 @@ my $n = shift; $n = 0 if $n > 2; return $CSI - . ($n>0 ? $n : '') + . ($n ? $n : '') . 'K'; } @@ -160,6 +161,14 @@ . 'M'; } +# DCH = Delete CHaracters +sub VTDCH { + my $n = shift; + return $CSI + . ($n>1 ? $n : '') + . 'P'; +} + # SU = Scroll Up sub VTSU { my $n = shift; @@ -176,12 +185,44 @@ . 'T'; } +# ECH = Erase CHaracters +sub VTECH { + my $n = shift; + return $CSI + . ($n>1 ? $n : '') + . 'X'; +} + # HVP = Horizontal and Vertical Position (= CUP) sub VTHVP { my ($row, $col) = @_; return $CSI . $row . ';' . $col . 'f'; } +# SM = Set Mode +sub VTSM { + return '' if 0 >= scalar(@_); + return $CSI . join(';', @_) . 'h'; +} + +# prSM = private Set Mode +sub VTprSM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 'h'; +} + +# SM = Reset Mode +sub VTRM { + return '' if 0 >= scalar(@_); + return $CSI . join(';', @_) . 'l'; +} + +# prRM = private Reset Mode +sub VTprRM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 'l'; +} + # DSR = Device Status Report # Returns: (row, column) of cursor current position # @@ -220,6 +261,18 @@ return $CSI . 's'; } +# prRSM = private ReStore Mode +sub VTprRSM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 'r'; +} + +# prSVM = private SaVe Mode +sub VTprSVM { + return '' if 0 >= scalar(@_); + return $CSI . '?' . join(';', @_) . 's'; +} + # RCP = Restore Cursor Position sub VTRCP { return $CSI . 'u'; |