From e2d36972798ac7cccc4094accaa2e34a2c1b797a Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 21 Oct 2019 20:48:32 -0400 Subject: [PATCH] Start chapter 5 --- src/Editor.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Editor.php b/src/Editor.php index e3849d7..8b28b46 100644 --- a/src/Editor.php +++ b/src/Editor.php @@ -250,6 +250,17 @@ class Editor { $this->updateRow($this->rows[$at]); } + protected function rowInsertChar(Row $row, int $at, string $c) + { + if ($at < 0 || $at > $row->size) + { + $at = $row->size; + } + + $row->chars[$at] = $c; + $this->updateRow($row); + } + // ------------------------------------------------------------------------ // ! File I/O // ------------------------------------------------------------------------