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;
|
namespace Aviat\Kilo;
|
||||||
|
|
||||||
use Aviat\Kilo\Enum\KeyCode;
|
use Aviat\Kilo\Enum\KeyCode;
|
||||||
|
use Aviat\Kilo\Enum\KeyType;
|
||||||
use Aviat\Kilo\Tokens\PHP8;
|
use Aviat\Kilo\Tokens\PHP8;
|
||||||
use Aviat\Kilo\Type\Point;
|
use Aviat\Kilo\Type\Point;
|
||||||
|
|
||||||
@ -101,18 +102,13 @@ class Document {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->dirty = true;
|
if ($c === KeyType::ENTER || $c === KeyCode::CARRIAGE_RETURN)
|
||||||
|
|
||||||
if ($c === KeyCode::ENTER || $c === KeyCode::CARRIAGE_RETURN)
|
|
||||||
{
|
{
|
||||||
$this->insertNewline($at);
|
$this->insertNewline($at);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($at->y === $this->numRows)
|
$this->dirty = true;
|
||||||
{
|
|
||||||
$this->insertRow($this->numRows, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->rows[$at->y]->insert($at->x, $c);
|
$this->rows[$at->y]->insert($at->x, $c);
|
||||||
}
|
}
|
||||||
|
@ -657,10 +657,6 @@ class Editor {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KeyType::ENTER:
|
|
||||||
$this->insertChar("\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$this->insertChar($c);
|
$this->insertChar($c);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user