Minor tweaks
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
This commit is contained in:
parent
e6f7095a45
commit
113cc1a0a1
@ -78,7 +78,9 @@ class ANSI {
|
||||
*/
|
||||
public static function moveCursor(int $line, int $column): string
|
||||
{
|
||||
return self::seq('%d;%dH', $line, $column);
|
||||
// The terminal has a 1-based coordinate system,
|
||||
// add one to each to allow 0-based coordinate system input
|
||||
return self::seq('%d;%dH', $line + 1, $column + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -688,8 +688,8 @@ class Editor {
|
||||
|
||||
// Specify the current cursor position
|
||||
$this->outputBuffer .= ANSI::moveCursor(
|
||||
($this->cursorY - $this->rowOffset) + 1,
|
||||
($this->renderX - $this->colOffset) + 1
|
||||
$this->cursorY - $this->rowOffset,
|
||||
$this->renderX - $this->colOffset
|
||||
);
|
||||
|
||||
$this->outputBuffer .= ANSI::SHOW_CURSOR;
|
||||
|
@ -33,6 +33,9 @@ class Terminal {
|
||||
return [25, 80];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the screen and reset the cursor position
|
||||
*/
|
||||
public static function clear(): void
|
||||
{
|
||||
self::write(ANSI::CLEAR_SCREEN . ANSI::RESET_CURSOR);
|
||||
|
Loading…
Reference in New Issue
Block a user