Insert a little more sanity
This commit is contained in:
parent
252eddc093
commit
e2e4f421e0
@ -277,7 +277,6 @@ class Editor {
|
|||||||
|
|
||||||
// Truncate the previous row
|
// Truncate the previous row
|
||||||
$row->chars = $newChars;
|
$row->chars = $newChars;
|
||||||
$row->update();
|
|
||||||
|
|
||||||
// Add a new row, with the contents from the cursor to the end of the line
|
// Add a new row, with the contents from the cursor to the end of the line
|
||||||
$this->insertRow($this->cursorY + 1, substr($chars, $this->cursorX), FALSE);
|
$this->insertRow($this->cursorY + 1, substr($chars, $this->cursorX), FALSE);
|
||||||
|
24
src/Row.php
24
src/Row.php
@ -256,28 +256,8 @@ class Row {
|
|||||||
|
|
||||||
public function update(): void
|
public function update(): void
|
||||||
{
|
{
|
||||||
$idx = 0;
|
$replacement = str_repeat(' ', KILO_TAB_STOP);
|
||||||
|
$this->render = str_replace("\t", $replacement, $this->chars);
|
||||||
// Make sure the render buffer is empty before updating
|
|
||||||
// otherwise, you will have persistent output where you
|
|
||||||
// don't want it.
|
|
||||||
$this->render = '';
|
|
||||||
|
|
||||||
for ($i = 0; $i < $this->size; $i++)
|
|
||||||
{
|
|
||||||
if ($this->chars[$i] === "\t")
|
|
||||||
{
|
|
||||||
$this->render[$idx++] = ' ';
|
|
||||||
while ($idx % KILO_TAB_STOP !== 0)
|
|
||||||
{
|
|
||||||
$this->render[$idx++] = ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->render[$idx++] = $this->chars[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->updateSyntax();
|
$this->updateSyntax();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user