Mac fixes
Some checks failed
Gitea - Tutorials/php-kilo/master There was a failure building this commit

This commit is contained in:
Timothy Warren 2019-12-02 09:44:11 -05:00
parent 30440e577a
commit f5aafb465a
3 changed files with 6 additions and 5 deletions

5
kilo
View File

@ -1,4 +1,4 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php declare(strict_types=1);
namespace Aviat\Kilo;
@ -6,13 +6,12 @@ namespace Aviat\Kilo;
require_once __DIR__ . '/vendor/autoload.php';
// Log notices/errors/warnings to file
set_error_handler(static function (int $no, $str, $file, $line, $context) {
set_error_handler(static function (int $no, $str, $file, $line) {
$msg = print_r([
'errno' => $no,
'message' => $str,
'file' => $file,
'line' => $line,
// 'context' => $context,
], TRUE);
file_put_contents('kilo.log', $msg, FILE_APPEND);

View File

@ -736,7 +736,6 @@ class Editor {
$this->refreshScreen();
$c = $this->readKey();
$cord = ord($c);
if ($c === Key::ESCAPE)
{
@ -837,7 +836,7 @@ class Editor {
$c = $this->readKey();
if ($c === "\0")
if ($c === "\0" || $c === '')
{
return '';
}

View File

@ -147,6 +147,9 @@ class Row {
T_OBJECT_CAST => Highlight::KEYWORD2,
T_STRING_CAST => Highlight::KEYWORD2,
T_UNSET_CAST => Highlight::KEYWORD2,
// Invalid syntax
T_BAD_CHARACTER => Highlight::INVALID,
];
private array $phpCharacterHighlightMap = [