From 84d1628cb7734134b1ba80545b38985025942b79 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 16 Jul 2017 11:31:25 -0500 Subject: [PATCH] ANSI: make it so x position can't be negative --- phpseclib/File/ANSI.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpseclib/File/ANSI.php b/phpseclib/File/ANSI.php index 989537be..eb6b8383 100644 --- a/phpseclib/File/ANSI.php +++ b/phpseclib/File/ANSI.php @@ -332,6 +332,9 @@ class File_ANSI case preg_match('#\x1B\[(\d+)D#', $this->ansi, $match): // Move cursor left n lines $this->old_x = $this->x; $this->x-= $match[1]; + if ($this->x < 0) { + $this->x = 0; + } break; case preg_match('#\x1B\[(\d+);(\d+)r#', $this->ansi, $match): // Set top and bottom lines of a window break;