diff --git a/src/Editor/Editor.php b/src/Editor/Editor.php index 45b06bf..a709fa7 100644 --- a/src/Editor/Editor.php +++ b/src/Editor/Editor.php @@ -207,8 +207,7 @@ class Editor $this->modified = true; break; - case 'Q': - case "\x03": // ctrl-w + case "\x18": // ctrl-x $this->running = false; break; @@ -418,7 +417,7 @@ class Editor [$w,$h] = $this->term->getSize(); $text = << 'Help', - 'e' => 'Edit', - 'E' => 'Edit key', - 'I' => 'Insert…', - //'i' => 'Ins value', 'D' => 'Delete', - //'C' => 'Copy', - //'P' => 'Paste', - '^N' => 'New', + ]; + $node = $this->list->getNodeForIndex($this->currentRow); + if ($node instanceof ValueNode) { + $keys = [ ...$keys, + 'e' => 'Edit', + ]; + } + if ($node instanceof ObjectNode || $node instanceof ArrayNode) { + $keys = [ ...$keys, + 'I' => 'Insert…', + ]; + } + if ($this->modified) { + $keys = [ ...$keys, + '^N' => 'New', + '^W' => 'Write', + ]; + } + $keys = [ ...$keys, '^R' => 'Read', - '^W' => 'Write', - '^C' => 'Exit', + '^X' => 'Exit', ]; }