diff --git a/src/Document.php b/src/Document.php index 2d5fbc6..e03d221 100644 --- a/src/Document.php +++ b/src/Document.php @@ -119,7 +119,7 @@ class Document { $this->dirty = true; } - public function delete(Point $at): void + public function delete(Point $at, int $gutter = 0): void { if ($at->y > $this->numRows) { @@ -128,7 +128,7 @@ class Document { $row =& $this->rows[$at->y]; - if ($at->x === $this->rows[$at->y]->size && $at->y + 1 < $this->numRows) + if (($at->x - $gutter) === $this->rows[$at->y]->size && $at->y + 1 < $this->numRows) { $this->rows[$at->y]->append($this->rows[$at->y + 1]->chars); $this->deleteRow($at->y + 1); diff --git a/src/Editor.php b/src/Editor.php index da07928..4e5821a 100644 --- a/src/Editor.php +++ b/src/Editor.php @@ -779,13 +779,13 @@ class Editor { { if ($ch === KeyType::Delete) { - $this->document->delete($this->cursor); + $this->document->delete($this->cursor, $this->numberGutter); } - if ($ch === KeyType::Backspace && ($this->cursor->x > 0 || $this->cursor->y > 0)) + if ($ch === KeyType::Backspace && (($this->cursor->x >= $this->numberGutter) || $this->cursor->y > 0)) { $this->moveCursor(KeyType::ArrowLeft); - $this->document->delete($this->cursor); + $this->document->delete($this->cursor, $this->numberGutter); } }