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); <?php declare(strict_types=1);
namespace Aviat\Kilo; namespace Aviat\Kilo;
@ -6,13 +6,12 @@ namespace Aviat\Kilo;
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
// Log notices/errors/warnings to file // 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([ $msg = print_r([
'errno' => $no, 'errno' => $no,
'message' => $str, 'message' => $str,
'file' => $file, 'file' => $file,
'line' => $line, 'line' => $line,
// 'context' => $context,
], TRUE); ], TRUE);
file_put_contents('kilo.log', $msg, FILE_APPEND); file_put_contents('kilo.log', $msg, FILE_APPEND);

View File

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

View File

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