38 lines
529 B
PHP
Executable File
38 lines
529 B
PHP
Executable File
#!/usr/bin/php
|
|
<?php declare(strict_types=1);
|
|
|
|
namespace Kilo;
|
|
|
|
require_once __DIR__ . '/src/constants.php';
|
|
require_once __DIR__ . '/src/functions.php';
|
|
require_once __DIR__ . '/src/Editor.php';
|
|
|
|
function main(int $argc, array $argv): int
|
|
{
|
|
global $ffi;
|
|
|
|
enableRawMode();
|
|
|
|
// ob_start();
|
|
$editor = Editor::new($ffi);
|
|
|
|
if ($argc >= 2)
|
|
{
|
|
$editor->open($argv[1]);
|
|
}
|
|
|
|
|
|
// Input Loop
|
|
while (true)
|
|
{
|
|
$editor->refreshScreen();
|
|
$editor->processKeypress();
|
|
// ob_flush();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
//! Init
|
|
main($argc, $argv);
|