@@ -39,7 +39,7 @@ object HexDebugClientConfig {
3939 when (config) {
4040 is ClientConfig .SplicingTableKeybinds ,
4141 is ClientConfig .SplicingTableKeybinds .Enlightened -> {
42- SplicingTableScreen .buttonText(field.name.camelToSnakeCase())
42+ SplicingTableScreen .buttonText(field.name.camelToSnakeCase(), null )
4343 }
4444 else -> i18n.asTranslatedComponent
4545 },
@@ -145,41 +145,47 @@ object HexDebugClientConfig {
145145 @CollapsibleObject
146146 val enlightened = Enlightened ()
147147
148+ fun getActionMap () = mapOf (
149+ SplicingTableAction .VIEW_LEFT to viewLeft,
150+ SplicingTableAction .VIEW_LEFT_PAGE to viewLeftPage,
151+ SplicingTableAction .VIEW_LEFT_FULL to viewLeftFull,
152+ SplicingTableAction .VIEW_RIGHT to viewRight,
153+ SplicingTableAction .VIEW_RIGHT_PAGE to viewRightPage,
154+ SplicingTableAction .VIEW_RIGHT_FULL to viewRightFull,
155+ SplicingTableAction .CURSOR_LEFT to cursorLeft,
156+ SplicingTableAction .CURSOR_RIGHT to cursorRight,
157+ SplicingTableAction .EXPAND_SELECTION_LEFT to expandSelectionLeft,
158+ SplicingTableAction .EXPAND_SELECTION_RIGHT to expandSelectionRight,
159+ SplicingTableAction .MOVE_SELECTION_LEFT to moveSelectionLeft,
160+ SplicingTableAction .MOVE_SELECTION_RIGHT to moveSelectionRight,
161+ SplicingTableAction .SELECT_NONE to selectNone,
162+ SplicingTableAction .SELECT_ALL to selectAll,
163+ SplicingTableAction .UNDO to undo,
164+ SplicingTableAction .REDO to redo,
165+ SplicingTableAction .NUDGE_LEFT to nudgeLeft,
166+ SplicingTableAction .NUDGE_RIGHT to nudgeRight,
167+ SplicingTableAction .DUPLICATE to duplicate,
168+ SplicingTableAction .DELETE to delete,
169+ SplicingTableAction .BACKSPACE to backspace,
170+ SplicingTableAction .CUT to cut,
171+ SplicingTableAction .COPY to copy,
172+ SplicingTableAction .PASTE_SPLAT to pasteSplat,
173+ SplicingTableAction .PASTE_VERBATIM to pasteVerbatim,
174+ )
175+
148176 fun getActionForKey (keyCode : Int , scanCode : Int ): SplicingTableAction ? {
149- for ((key, action) in arrayOf(
150- viewLeft to SplicingTableAction .VIEW_LEFT ,
151- viewLeftPage to SplicingTableAction .VIEW_LEFT_PAGE ,
152- viewLeftFull to SplicingTableAction .VIEW_LEFT_FULL ,
153- viewRight to SplicingTableAction .VIEW_RIGHT ,
154- viewRightPage to SplicingTableAction .VIEW_RIGHT_PAGE ,
155- viewRightFull to SplicingTableAction .VIEW_RIGHT_FULL ,
156- cursorLeft to SplicingTableAction .CURSOR_LEFT ,
157- cursorRight to SplicingTableAction .CURSOR_RIGHT ,
158- expandSelectionLeft to SplicingTableAction .EXPAND_SELECTION_LEFT ,
159- expandSelectionRight to SplicingTableAction .EXPAND_SELECTION_RIGHT ,
160- moveSelectionLeft to SplicingTableAction .MOVE_SELECTION_LEFT ,
161- moveSelectionRight to SplicingTableAction .MOVE_SELECTION_RIGHT ,
162- selectNone to SplicingTableAction .SELECT_NONE ,
163- selectAll to SplicingTableAction .SELECT_ALL ,
164- undo to SplicingTableAction .UNDO ,
165- redo to SplicingTableAction .REDO ,
166- nudgeLeft to SplicingTableAction .NUDGE_LEFT ,
167- nudgeRight to SplicingTableAction .NUDGE_RIGHT ,
168- duplicate to SplicingTableAction .DUPLICATE ,
169- delete to SplicingTableAction .DELETE ,
170- backspace to SplicingTableAction .BACKSPACE ,
171- cut to SplicingTableAction .CUT ,
172- copy to SplicingTableAction .COPY ,
173- pasteSplat to SplicingTableAction .PASTE_SPLAT ,
174- pasteVerbatim to SplicingTableAction .PASTE_VERBATIM ,
175- )) {
176- if (key.matchesKey(keyCode, scanCode)) {
177+ for ((action, key) in getActionMap().entries) {
178+ if (key.inner.matchesKey(keyCode, scanCode)) {
177179 return action
178180 }
179181 }
180182 return null
181183 }
182184
185+ fun getKeyForAction (action : SplicingTableAction ): ConfigModifierKey ? {
186+ return getActionMap()[action]
187+ }
188+
183189 class Enlightened {
184190 val cast = ConfigModifierKey (InputConstants .KEY_RETURN , ctrl = true )
185191 }
@@ -228,8 +234,6 @@ data class ConfigModifierKey(
228234 Modifier .of(alt, ctrl, shift),
229235 )
230236 }
231-
232- fun matchesKey (keyCode : Int , scanCode : Int ) = inner.matchesKey(keyCode, scanCode)
233237}
234238
235239// https://stackoverflow.com/a/60010299
0 commit comments