Add alternate array index style, with setting
This commit is contained in:
parent
0e1354bd47
commit
73ac4dd3f6
@ -806,7 +806,7 @@ class Editor
|
||||
'quotedKeys' => (Settings::$editorQuotedKeys?$mark:$clear)."Quoted keys",
|
||||
'tailLine' => (Settings::$tailLine?$mark:$clear)."Show tail line",
|
||||
'indentationGuides' => (Settings::$indentationGuides?$mark:$clear)."Show indentation guides",
|
||||
//'done' => " Done"
|
||||
'highlightIndices' => (Settings::$highlightIndices?$mark:$clear)."Highlight array indices",
|
||||
];
|
||||
$sel = (new Menu($this->term, $items, "Settings"))
|
||||
->display(0, 0, 40, 0, $sel);
|
||||
@ -827,6 +827,9 @@ class Editor
|
||||
case 'indentationGuides':
|
||||
Settings::$indentationGuides = !Settings::$indentationGuides;
|
||||
break;
|
||||
case 'highlightIndices':
|
||||
Settings::$highlightIndices = !Settings::$highlightIndices;
|
||||
break;
|
||||
}
|
||||
} while ($sel);
|
||||
$this->redrawEditor();
|
||||
|
@ -195,7 +195,11 @@ class TreeList implements Countable, IteratorAggregate
|
||||
}." ";
|
||||
}
|
||||
echo (is_int($entry->key)
|
||||
?"\e[36;2m\u{e0b6}\e[7m#{$entry->key}\e[27m\u{e0b4}\e[22;37m "
|
||||
|
||||
?(Settings::$highlightIndices
|
||||
?"\e[36;2m\u{e0b6}\e[7m#{$entry->key}\e[27m\u{e0b4}\e[22;37m "
|
||||
:"\e[36;2m#{$entry->key}\e[22;37m "
|
||||
)
|
||||
:(Settings::$editorQuotedKeys
|
||||
? "\e[36m\"{$entry->key}\":\e[37m "
|
||||
: "\e[36m{$entry->key}:\e[37m "
|
||||
|
@ -16,6 +16,8 @@ class Settings
|
||||
|
||||
public static bool $tailLine = true;
|
||||
|
||||
public static bool $highlightIndices = true;
|
||||
|
||||
public static function load(string $filename): void
|
||||
{
|
||||
if (file_exists($filename) && is_readable($filename)) {
|
||||
@ -25,6 +27,7 @@ class Settings
|
||||
self::$indentationGuides = $data->indentationGuides ?? true;
|
||||
self::$collapseBefore = $data->collapseBefore ?? true;
|
||||
self::$tailLine = $data->tailLine ?? true;
|
||||
self::$highlightIndices = $data->highlightIndices ?? true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +40,7 @@ class Settings
|
||||
'collapseBefore' => self::$collapseBefore,
|
||||
'highlightRow' => self::$highlightRow,
|
||||
'tailLine' => self::$tailLine,
|
||||
'highlightIndices' => self::$highlightIndices,
|
||||
], JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)."\n";
|
||||
@file_put_contents($filename, $data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user