Fix line splitting on enter
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2021-04-09 11:26:02 -04:00
parent b63c3e49d8
commit 35ec8f27ad
2 changed files with 3 additions and 11 deletions

View File

@ -3,6 +3,7 @@
namespace Aviat\Kilo;
use Aviat\Kilo\Enum\KeyCode;
use Aviat\Kilo\Enum\KeyType;
use Aviat\Kilo\Tokens\PHP8;
use Aviat\Kilo\Type\Point;
@ -101,18 +102,13 @@ class Document {
return;
}
$this->dirty = true;
if ($c === KeyCode::ENTER || $c === KeyCode::CARRIAGE_RETURN)
if ($c === KeyType::ENTER || $c === KeyCode::CARRIAGE_RETURN)
{
$this->insertNewline($at);
return;
}
if ($at->y === $this->numRows)
{
$this->insertRow($this->numRows, '');
}
$this->dirty = true;
$this->rows[$at->y]->insert($at->x, $c);
}

View File

@ -657,10 +657,6 @@ class Editor {
// Do nothing
break;
case KeyType::ENTER:
$this->insertChar("\n");
break;
default:
$this->insertChar($c);
break;