Continue refactoring of non-PHP syntax highlighting
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
644f27bb37
commit
30b4c3818a
@ -772,10 +772,11 @@ class Editor {
|
||||
{
|
||||
$this->document->delete($this->cursor);
|
||||
}
|
||||
else if ($ch === KeyType::BACKSPACE && ($this->cursor->x > 0 || $this->cursor->y > 0))
|
||||
|
||||
if ($ch === KeyType::BACKSPACE && ($this->cursor->x > 0 || $this->cursor->y > 0))
|
||||
{
|
||||
$this->document->delete($this->cursor);
|
||||
$this->moveCursor(KeyType::ARROW_LEFT);
|
||||
$this->document->delete($this->cursor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -783,10 +784,16 @@ class Editor {
|
||||
{
|
||||
if ($this->document->isDirty() && $this->quitTimes > 0)
|
||||
{
|
||||
if ($this->quitTimes === KILO_QUIT_TIMES)
|
||||
{
|
||||
Terminal::ding();
|
||||
}
|
||||
|
||||
$this->setStatusMessage(
|
||||
'WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.',
|
||||
$this->quitTimes
|
||||
);
|
||||
|
||||
$this->quitTimes--;
|
||||
return;
|
||||
}
|
||||
|
14
src/Row.php
14
src/Row.php
@ -219,12 +219,14 @@ class Row {
|
||||
return;
|
||||
}
|
||||
|
||||
$keywords1 = $this->parent->fileType->syntax->keywords1;
|
||||
$keywords2 = $this->parent->fileType->syntax->keywords2;
|
||||
$syntax = $this->parent->fileType->syntax;
|
||||
|
||||
$scs = $this->parent->fileType->syntax->singleLineCommentStart;
|
||||
$mcs = $this->parent->fileType->syntax->multiLineCommentStart;
|
||||
$mce = $this->parent->fileType->syntax->multiLineCommentEnd;
|
||||
$keywords1 = $syntax->keywords1;
|
||||
$keywords2 = $syntax->keywords2;
|
||||
|
||||
$scs = $syntax->singleLineCommentStart;
|
||||
$mcs = $syntax->multiLineCommentStart;
|
||||
$mce = $syntax->multiLineCommentEnd;
|
||||
|
||||
$scsLen = strlen($scs);
|
||||
$mcsLen = strlen($mcs);
|
||||
@ -281,7 +283,7 @@ class Row {
|
||||
$this->highlightString($i);
|
||||
|
||||
// Numbers, including decimal points
|
||||
if ($this->parent->fileType->syntax->flags & Syntax::HIGHLIGHT_NUMBERS)
|
||||
if ($syntax->flags & Syntax::HIGHLIGHT_NUMBERS)
|
||||
{
|
||||
if (
|
||||
($char === '.' && $prevHl === Highlight::NUMBER) ||
|
||||
|
@ -115,6 +115,14 @@ class Terminal {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Ring the terminal bell
|
||||
*/
|
||||
public static function ding(): void
|
||||
{
|
||||
self::write(RawKeyCode::BELL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to the stdout stream
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user