46 lines
875 B
PHP
Executable File
46 lines
875 B
PHP
Executable File
#!/usr/bin/php
|
|
<?php declare(strict_types=1);
|
|
|
|
namespace Kilo;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// ! App Constants
|
|
// -----------------------------------------------------------------------------
|
|
define('KILO_VERSION', '0.0.1');
|
|
define('KILO_TAB_STOP', 4);
|
|
define('KILO_QUIT_TIMES', 3);
|
|
|
|
require_once __DIR__ . '/src/C.php';
|
|
require_once __DIR__ . '/src/functions.php';
|
|
require_once __DIR__ . '/src/Editor.php';
|
|
|
|
function main(int $argc, array $argv): int
|
|
{
|
|
enable_raw_mode();
|
|
|
|
$editor = Editor::new();
|
|
|
|
if ($argc >= 2)
|
|
{
|
|
$editor->open($argv[1]);
|
|
}
|
|
|
|
$editor->setStatusMessage('HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find');
|
|
|
|
// Input Loop
|
|
while (true)
|
|
{
|
|
$editor->refreshScreen();
|
|
$char = $editor->processKeypress();
|
|
if ($char === NULL)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
//! Init
|
|
main($argc, $argv);
|