@brimveyn/aimux-config 0.10.6 → 0.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/actions.ts +26 -0
- package/src/defaults.ts +8 -4
- package/src/types.ts +5 -0
package/package.json
CHANGED
package/src/actions.ts
CHANGED
|
@@ -261,6 +261,32 @@ export const confirmCreateWorkspace: KeyResult = r([], [{ type: 'create-workspac
|
|
|
261
261
|
* from the commit modal on purpose: there the body is the whole point, here
|
|
262
262
|
* most prompts are one line and creating must stay the cheapest keystroke.
|
|
263
263
|
*/
|
|
264
|
+
/**
|
|
265
|
+
* Up/Down in a modal that has both a list and a field you can type paragraphs
|
|
266
|
+
* into. On that field they walk its lines; anywhere else in the modal they drive
|
|
267
|
+
* the list, which is all they used to do — typing a second line and then having
|
|
268
|
+
* no way back up to the first is the whole complaint.
|
|
269
|
+
*/
|
|
270
|
+
export function moveModalSelectionOrLine(delta: -1 | 1): ActionFn {
|
|
271
|
+
return (ctx: ModeContext) => {
|
|
272
|
+
const { modal } = ctx.state
|
|
273
|
+
const onTextField =
|
|
274
|
+
(modal.type === 'create-workspace' && modal.activeField === 'prompt') ||
|
|
275
|
+
(modal.type === 'snippet-editor' && modal.activeField === 'content')
|
|
276
|
+
if (onTextField) {
|
|
277
|
+
return r([{ to: delta === 1 ? 'line-down' : 'line-up', type: 'move-modal-cursor' }])
|
|
278
|
+
}
|
|
279
|
+
return r([{ delta, type: 'move-modal-selection' }])
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export const snippetEditorNewline: ActionFn = (ctx: ModeContext) => {
|
|
284
|
+
const { modal } = ctx.state
|
|
285
|
+
if (modal.type !== 'snippet-editor') return r([])
|
|
286
|
+
if (modal.activeField !== 'content') return r([])
|
|
287
|
+
return r([{ char: '\n', type: 'update-command-edit' }])
|
|
288
|
+
}
|
|
289
|
+
|
|
264
290
|
export const createWorkspaceNewline: ActionFn = (ctx: ModeContext) => {
|
|
265
291
|
const { modal } = ctx.state
|
|
266
292
|
if (modal.type !== 'create-workspace') return r([])
|
package/src/defaults.ts
CHANGED
|
@@ -430,10 +430,11 @@ export function getDefaultKeymapConfig(): ResolvedKeymapConfig {
|
|
|
430
430
|
.map('<Tab>', actions.switchCreateWorkspaceField, 'Next field')
|
|
431
431
|
.map('<CR>', actions.confirmCreateWorkspace, 'Create')
|
|
432
432
|
.map('<C-CR>', actions.createWorkspaceNewline, 'Newline')
|
|
433
|
+
.map('<S-CR>', actions.createWorkspaceNewline, 'Newline')
|
|
433
434
|
.map('<C-n>', actions.moveModalSelection(1), 'Next')
|
|
434
435
|
.map('<C-p>', actions.moveModalSelection(-1), 'Prev')
|
|
435
|
-
.map('<Down>', actions.
|
|
436
|
-
.map('<Up>', actions.
|
|
436
|
+
.map('<Down>', actions.moveModalSelectionOrLine(1))
|
|
437
|
+
.map('<Up>', actions.moveModalSelectionOrLine(-1))
|
|
437
438
|
.passthrough()
|
|
438
439
|
)
|
|
439
440
|
|
|
@@ -461,10 +462,12 @@ export function getDefaultKeymapConfig(): ResolvedKeymapConfig {
|
|
|
461
462
|
.map('<Esc>', actions.backToSnippetPicker, 'Cancel')
|
|
462
463
|
.map('<Tab>', actions.switchField, 'Next field')
|
|
463
464
|
.map('<CR>', actions.saveSnippetEditor, 'Save')
|
|
465
|
+
.map('<C-CR>', actions.snippetEditorNewline, 'Newline')
|
|
466
|
+
.map('<S-CR>', actions.snippetEditorNewline, 'Newline')
|
|
464
467
|
.map('<C-n>', actions.moveModalSelection(1), 'Next')
|
|
465
468
|
.map('<C-p>', actions.moveModalSelection(-1), 'Prev')
|
|
466
|
-
.map('<Down>', actions.
|
|
467
|
-
.map('<Up>', actions.
|
|
469
|
+
.map('<Down>', actions.moveModalSelectionOrLine(1))
|
|
470
|
+
.map('<Up>', actions.moveModalSelectionOrLine(-1))
|
|
468
471
|
.passthrough()
|
|
469
472
|
)
|
|
470
473
|
|
|
@@ -492,6 +495,7 @@ export function getDefaultKeymapConfig(): ResolvedKeymapConfig {
|
|
|
492
495
|
.map('<C-a>', actions.gitCommitEnterConfirm, 'Auto-commit (stage all)')
|
|
493
496
|
.map('<Tab>', actions.switchField, 'Next field')
|
|
494
497
|
.map('<CR>', actions.gitCommitReturnKey, 'Newline / confirm')
|
|
498
|
+
.map('<S-CR>', actions.gitCommitReturnKey, 'Newline / confirm')
|
|
495
499
|
.passthrough()
|
|
496
500
|
)
|
|
497
501
|
|
package/src/types.ts
CHANGED
|
@@ -638,6 +638,11 @@ export type ModalAction =
|
|
|
638
638
|
}
|
|
639
639
|
| { type: 'close-modal' }
|
|
640
640
|
| { type: 'move-modal-selection'; delta: number }
|
|
641
|
+
| {
|
|
642
|
+
type: 'move-modal-cursor'
|
|
643
|
+
delta?: number
|
|
644
|
+
to?: 'end' | 'home' | 'line-down' | 'line-up' | 'word-left' | 'word-right'
|
|
645
|
+
}
|
|
641
646
|
| { type: 'update-command-edit'; char: string }
|
|
642
647
|
| { type: 'cancel-command-edit' }
|
|
643
648
|
| { type: 'open-create-project-modal'; returnToProjectPicker: boolean }
|