Change exit hotkey to ^X from ^C to avoid accidents
This commit is contained in:
parent
3211e55e05
commit
bf6756773e
@ -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',
|
||||
'^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',
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user