Internal rework pending editframe
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Classes\Server;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Server as AbstractServer;
|
||||
use App\Models\Mode;
|
||||
|
||||
@@ -22,6 +20,7 @@ class Ansi extends AbstractServer {
|
||||
define('UP', ESC.'[A'); // Move Cursor
|
||||
define('CR', chr(13));
|
||||
define('LF', chr(10));
|
||||
define('BS', chr(8));
|
||||
define('CLS', ESC.'[2J');
|
||||
define('HASH', '#'); // Enter
|
||||
define('STAR', '*'); // Star Entry
|
||||
@@ -47,34 +46,32 @@ class Ansi extends AbstractServer {
|
||||
define('R_WHITE', WHITE);
|
||||
//define('FLASH',chr(8));
|
||||
|
||||
// Keyboard presses
|
||||
// @todo Check where these are used vs the keys defined above?
|
||||
define('KEY_DELETE', chr(8));
|
||||
define('KEY_LEFT', chr(136));
|
||||
define('KEY_RIGHT', chr(137));
|
||||
define('KEY_DOWN', chr(138));
|
||||
define('KEY_UP', chr(139));
|
||||
|
||||
parent::__construct($o);
|
||||
}
|
||||
|
||||
function outputPosition($x,$y) {
|
||||
function moveCursor($x,$y) {
|
||||
printf(". Move cursor %s,%s\n",$x,$y);
|
||||
return ESC.'['.$y.';'.$x.'f';
|
||||
}
|
||||
|
||||
// Abstract function
|
||||
public function sendBaseline($client,$text,$reposition=FALSE) {
|
||||
$client->send(CSAVE.ESC.'[24;0f'.$text.
|
||||
($this->blp > $this->strlenv($text)
|
||||
? str_repeat(' ',$this->blp-$this->strlenv($text)).
|
||||
($reposition ? ESC.'[24;0f'.str_repeat(RIGHT,$this->strlenv($text)) : CRESTORE)
|
||||
($this->blp > $this->fo->strlenv($text)
|
||||
? str_repeat(' ',$this->blp-$this->fo->strlenv($text)).
|
||||
($reposition ? ESC.'[24;0f'.str_repeat(RIGHT,$this->fo->strlenv($text)) : CRESTORE)
|
||||
: ($reposition ? '' : CRESTORE))
|
||||
);
|
||||
|
||||
$this->blp = $this->strlenv($text);
|
||||
$this->blp = $this->fo->strlenv($text);
|
||||
$this->baseline = $text;
|
||||
}
|
||||
|
||||
// Abstract function
|
||||
public function strlenv($text):int {
|
||||
return strlen($text ? preg_replace('/'.ESC.'\[[0-9;?]+[a-zA-Z]/','',$text) : $text);
|
||||
}
|
||||
|
||||
// Abstract function
|
||||
public function testFrame()
|
||||
{
|
||||
return \App\Classes\Frame\Ansi::testFrame($this);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user