Fix line splitting on enter
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good
This commit is contained in:
parent
b63c3e49d8
commit
35ec8f27ad
@ -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);
|
||||
}
|
||||
|
@ -657,10 +657,6 @@ class Editor {
|
||||
// Do nothing
|
||||
break;
|
||||
|
||||
case KeyType::ENTER:
|
||||
$this->insertChar("\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->insertChar($c);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user