Insert a little more sanity

This commit is contained in:
Timothy Warren 2019-11-08 12:04:26 -05:00
parent 252eddc093
commit e2e4f421e0
2 changed files with 2 additions and 23 deletions

View File

@ -277,7 +277,6 @@ class Editor {
// Truncate the previous row
$row->chars = $newChars;
$row->update();
// 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);

View File

@ -256,28 +256,8 @@ class Row {
public function update(): void
{
$idx = 0;
// 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];
}
}
$replacement = str_repeat(' ', KILO_TAB_STOP);
$this->render = str_replace("\t", $replacement, $this->chars);
$this->updateSyntax();
}