Change exit hotkey to ^X from ^C to avoid accidents

This commit is contained in:
Chris 2024-10-02 02:00:31 +02:00
parent 3211e55e05
commit bf6756773e

View File

@ -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 = <<<EOT
JSONEdit Alpha - Copyright (C) 2024, NoccyLabs
## JSONEdit Alpha - Copyright (C) 2024, NoccyLabs
Licensed under GNU GPL v3.0 or later.
@ -661,17 +660,28 @@ class Editor
if (!$keys) {
$keys = [
'h' => 'Help',
'e' => 'Edit',
'E' => 'Edit key',
'I' => 'Insert…',
//'i' => 'Ins value',
'D' => 'Delete',
//'C' => 'Copy',
//'P' => 'Paste',
];
$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',
'^R' => 'Read',
'^W' => 'Write',
'^C' => 'Exit',
];
}
$keys = [ ...$keys,
'^R' => 'Read',
'^X' => 'Exit',
];
}