@fbincon/claude-code-statusline 3.16.1 → 3.16.2
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/README.md +37 -37
- package/candidate.json +263 -211
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +155 -31
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +22 -15
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/change-review.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/color-manager.ts +7 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/diagnosis-view.ts +52 -18
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +20 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-manager.ts +6 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-viewer.ts +24 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/de.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/en.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/es.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/fr.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/id.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ja.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ko.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/pt-BR.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ru.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-CN.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-HK.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-TW.ts +17 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +27 -26
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +20 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +11 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/task-controls.ts +47 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +3 -3
- package/node_modules/@fbincon/statusline-core/dist/src/editor/change-review.d.ts +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/change-review.js +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/change-review.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js +7 -4
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.d.ts +5 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js +64 -18
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +17 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js +6 -5
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js +29 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +204 -48
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/de.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/es.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/fr.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/id.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/pt-BR.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ru.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +17 -4
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +17 -4
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.d.ts +11 -4
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js +138 -60
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +4 -5
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +14 -4
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +17 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +2 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +45 -26
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import type { Diagnose } from '../diagnostics/service.js';
|
|
|
4
4
|
import * as contracts from '@fbincon/statusline-core/contracts/ui';
|
|
5
5
|
import type { Draft } from '@fbincon/statusline-core/contracts/ui';
|
|
6
6
|
import { ConfigurationService, type EffectiveConfig } from '../config/service.js';
|
|
7
|
-
export declare const BACKEND_VERSION = "3.16.
|
|
7
|
+
export declare const BACKEND_VERSION = "3.16.2";
|
|
8
8
|
export declare const OPERATIONS: readonly ["review_reuse", "package_execute_start", "package_execute_detach", "package_execute_status", "package_cleanup_review", "package_cleanup_apply", "source_inspect", "source_bindings_review", "source_bindings_cleanup", "source_draft", "package_status", "package_review_start", "package_review_status", "package_review_cancel", "sources_read", "sources_apply", "source_review", "source_context", "source_refresh", "source_status", "source_release", "source_cancel", "source_diagnose", "describe", "read", "preview", "apply", "import", "export", "preset", "read_ui_preferences", "set_ui_language", "review_import", "explain", "diagnose", "diagnose_file", "profiles_read", "profiles_apply", "profile_import", "profile_export", "task_details"];
|
|
9
9
|
export type Preview = (draft: Draft, width: number, trace?: RenderTrace, scenario?: PreviewScenario) => contracts.PreviewResult;
|
|
10
10
|
export declare function capabilities(version: readonly number[] | null): contracts.Capabilities;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { taskControls, taskNotice } from '../ui/task-controls.ts';
|
|
1
2
|
import { openChanges, performChanges, changePreview } from '../lib/editor/change-review.ts';
|
|
2
3
|
import { performReuse } from '../lib/editor/reuse-manager.ts';
|
|
3
4
|
import { performPackage, closePackage } from '../lib/editor/package-manager.ts';
|
|
@@ -5,7 +6,7 @@ import { diagnosisRequest } from '../lib/editor/diagnosis-view.ts';
|
|
|
5
6
|
import { colorDraft } from '../lib/editor/color-manager.ts';
|
|
6
7
|
import { previewWidth } from '../lib/editor/preview-settings.ts';
|
|
7
8
|
import { performSourceAction, closeSources, closeSourceDraft } from '../lib/editor/source-manager.ts';
|
|
8
|
-
import { taskViewer, taskViewerView, taskViewerKey, receiveTask, type TaskViewer } from '../lib/editor/task-viewer.ts';
|
|
9
|
+
import { taskViewer, taskViewerView, taskViewerKey, replaceTaskField, receiveTask, type TaskViewer } from '../lib/editor/task-viewer.ts';
|
|
9
10
|
import { receivePreset } from '../lib/editor/quick-setup.ts';
|
|
10
11
|
import { performProfileAction } from '../lib/editor/profile-manager.ts';
|
|
11
12
|
import type {
|
|
@@ -34,7 +35,7 @@ import { MIN_COLUMNS, MIN_ROWS, contentColumns, clip } from '../ui/layout.ts';
|
|
|
34
35
|
import { recoveryButton, styles } from '../ui/theme.ts';
|
|
35
36
|
import { clientProps } from '../lib/session.ts';
|
|
36
37
|
import type { View } from '../lib/session.ts';
|
|
37
|
-
import { withinBudget, frameElements } from '../ui/frame.ts';
|
|
38
|
+
import { withinBudget, frameElements, frameTree, CapacityError } from '../ui/frame.ts';
|
|
38
39
|
import { parseBatch } from '../lib/client/messages.ts';
|
|
39
40
|
import { handleKey } from '../lib/client/keys.ts';
|
|
40
41
|
import { DEFAULT_PREVIEW_BACKGROUND, PREVIEW_BACKGROUND_KEY, previewBackground } from '../lib/preview-preferences.ts';
|
|
@@ -119,6 +120,7 @@ interface Session {
|
|
|
119
120
|
generation: number;
|
|
120
121
|
columns: number;
|
|
121
122
|
rows: number;
|
|
123
|
+
pane: { columns: number; rows: number };
|
|
122
124
|
displayColumns: number;
|
|
123
125
|
displayRows: number;
|
|
124
126
|
saveOutcome: 'none' | 'pending' | 'saved' | 'unknown' | 'refused';
|
|
@@ -504,10 +506,10 @@ async function openEditor(
|
|
|
504
506
|
/** Task host calls stay in this statically inspected entry; presentation is shared in core. */
|
|
505
507
|
const TASK_COMMAND = 'statusline-task', TASK_PANE = 'statusline-task-details';
|
|
506
508
|
export interface TaskPaneState extends TaskViewer {
|
|
507
|
-
owned: boolean; epoch: number; ack: number; frameGeneration: number; chain: Promise<void>;
|
|
509
|
+
owned: boolean; epoch: number; ack: number; frameGeneration: number; form: number; fromClient: boolean; focusDenied: boolean; chain: Promise<void>;
|
|
508
510
|
}
|
|
509
511
|
export function taskPaneState(): TaskPaneState {
|
|
510
|
-
return {...taskViewer(),input:null,owned:false,epoch:0,ack:0,frameGeneration:0,chain:Promise.resolve()};
|
|
512
|
+
return {...taskViewer(),input:null,owned:false,epoch:0,ack:0,frameGeneration:0,form:0,fromClient:false,focusDenied:false,chain:Promise.resolve()};
|
|
511
513
|
}
|
|
512
514
|
|
|
513
515
|
async function taskLanguage($: EngineInterface, options: PluginOptions, state: TaskPaneState, epoch: number): Promise<boolean> {
|
|
@@ -561,6 +563,50 @@ async function refreshTaskDetails($: EngineInterface, options: PluginOptions, st
|
|
|
561
563
|
}
|
|
562
564
|
}
|
|
563
565
|
|
|
566
|
+
type TaskField = NonNullable<TaskViewer['input']>;
|
|
567
|
+
const fieldInfo = {
|
|
568
|
+
session: { label: 'catalog.categories.session', buffer: 'sessionInput' },
|
|
569
|
+
prompt: { label: 'catalog.categories.task', buffer: 'promptInput' },
|
|
570
|
+
search: { label: 'ui.hints.search', buffer: 'searchInput' },
|
|
571
|
+
} as const;
|
|
572
|
+
const taskAliases = new Map([['g', '/'], ['n', 'down'], ['p', 'up'], ['z', 'enter']]);
|
|
573
|
+
function fieldKey(field: TaskField) { return 'task-field-' + field; }
|
|
574
|
+
async function focusTaskField($: EngineInterface, state: TaskPaneState, key: string) {
|
|
575
|
+
const epoch = state.epoch, form = state.form;
|
|
576
|
+
// The host can wait for the next drawing from an action, never from the
|
|
577
|
+
// drawing hook itself. It may also keep focus in the person's composer.
|
|
578
|
+
let denied: boolean;
|
|
579
|
+
try { denied = !!(await $.ui.focus({requestId: TASK_PANE, key})).deny; }
|
|
580
|
+
catch { denied = true; }
|
|
581
|
+
if (epoch !== state.epoch || form !== state.form || state.closed) return;
|
|
582
|
+
state.focusDenied = denied;
|
|
583
|
+
if (state.focusDenied) $.ui.invalidate('ui.render');
|
|
584
|
+
}
|
|
585
|
+
async function handleTaskKey($: EngineInterface, options: PluginOptions, state: TaskPaneState, event: Parameters<typeof taskViewerKey>[1], fromClient=false) {
|
|
586
|
+
if (state.closed) return;
|
|
587
|
+
const previous = state.input;
|
|
588
|
+
const name = !previous && !event.ctrl && !event.meta && !event.text
|
|
589
|
+
? taskAliases.get(event.key.toLowerCase()) ?? event.key : event.key;
|
|
590
|
+
const action = taskViewerKey(state, {...event, key: name});
|
|
591
|
+
if (action === 'close') { await $.ui.close({id:TASK_PANE}); return; }
|
|
592
|
+
const generation = state.generation;
|
|
593
|
+
const changed = state.input !== previous;
|
|
594
|
+
if (changed) {
|
|
595
|
+
state.form++;
|
|
596
|
+
state.fromClient = !!state.input && fromClient;
|
|
597
|
+
state.focusDenied = false;
|
|
598
|
+
}
|
|
599
|
+
$.ui.invalidate('ui.render');
|
|
600
|
+
// Client focus and the pane's keyboard ring are separate. Reopen the same
|
|
601
|
+
// pane to request the ring for a field, respecting refusals over chat text.
|
|
602
|
+
if (changed && state.fromClient) {
|
|
603
|
+
await $.ui.open({id:TASK_PANE,title:t('task.title',state.language),focus:true,closeOnEscape:true,rows:24,columns:88});
|
|
604
|
+
if (generation !== state.generation || state.closed) return;
|
|
605
|
+
}
|
|
606
|
+
if (changed) await focusTaskField($, state, state.input ? fieldKey(state.input) : 'task-search');
|
|
607
|
+
if (action === 'read' && generation === state.generation) await refreshTaskDetails($,options,state);
|
|
608
|
+
}
|
|
609
|
+
|
|
564
610
|
export function registerTaskDetails(on: On, options: PluginOptions, state: TaskPaneState): void {
|
|
565
611
|
const tr=(key:string)=>t(key,state.language);
|
|
566
612
|
on('command.run',{command:'statusline-task'},async($,e,next)=>{
|
|
@@ -574,6 +620,16 @@ export function registerTaskDetails(on: On, options: PluginOptions, state: TaskP
|
|
|
574
620
|
on('ui.close',{id:'statusline-task-details'},async($,e,next)=>{
|
|
575
621
|
state.generation++;state.epoch++;state.closed=true;state.busy=false;state.report=null;return next(e);
|
|
576
622
|
});
|
|
623
|
+
on('ui.focus',{component:'Pane',requestId:'statusline-task-details'},async($,e,next)=>{
|
|
624
|
+
const epoch=state.epoch, form=state.form;
|
|
625
|
+
const result=await next(e);
|
|
626
|
+
if (!result.deny && state.input && state.focusDenied && epoch===state.epoch && form===state.form &&
|
|
627
|
+
e.element?.startsWith('task-field-')) {
|
|
628
|
+
state.focusDenied=false;
|
|
629
|
+
$.ui.invalidate('ui.render');
|
|
630
|
+
}
|
|
631
|
+
return result;
|
|
632
|
+
});
|
|
577
633
|
on('ui.message',{component:'Pane'},async($,e,next)=>{
|
|
578
634
|
if(e.requestId!==TASK_PANE||e.element!=='task-client-'+state.epoch||e.module!=='ui/client/surface.ts'||e.surface!=='terminal'||!state.owned||state.closed)return next(e);
|
|
579
635
|
const batch=parseBatch(e.data);
|
|
@@ -584,9 +640,10 @@ export function registerTaskDetails(on: On, options: PluginOptions, state: TaskP
|
|
|
584
640
|
if(message.seq<=state.ack)continue;
|
|
585
641
|
if(message.seq!==state.ack+1){state.error=localizedText('task.fallback');break;}
|
|
586
642
|
state.ack=message.seq;
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
if(
|
|
643
|
+
// Once an actual host text field opens it exclusively owns new input;
|
|
644
|
+
// a late batch from the unmounted reading region cannot edit the field.
|
|
645
|
+
if (!state.input) await handleTaskKey($,options,state,message.event,true);
|
|
646
|
+
if (state.closed) break;
|
|
590
647
|
}
|
|
591
648
|
$.ui.invalidate('ui.render');return {};
|
|
592
649
|
});
|
|
@@ -595,28 +652,89 @@ export function registerTaskDetails(on: On, options: PluginOptions, state: TaskP
|
|
|
595
652
|
on('ui.render',{component:'Pane',requestId:'statusline-task-details'},async($,e,next)=>{
|
|
596
653
|
if(!state.owned)return next(e);
|
|
597
654
|
if(e.surface!=='terminal')return $.ui.resolve(e).Text({...styles.text,children:[tr('task.fallback')]});
|
|
598
|
-
const {Box,Text,Button,Client}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
655
|
+
const ui=$.ui.resolve(e), {Box,Text,Button,Input,Client}=ui;
|
|
656
|
+
const widthLimit=Math.max(1,Math.min(10000,e.props.bodyColumns)), heightLimit=Math.max(1,Math.min(10000,e.props.scroll.bodyRows));
|
|
657
|
+
const activeEpoch=state.epoch, activeForm=state.form;
|
|
658
|
+
const active=()=>!state.closed && activeEpoch===state.epoch && activeForm===state.form;
|
|
659
|
+
const textLine=(value:string,width:number)=>Text({...styles.text,wrap:'truncate',children:[taskNotice(value,width)]});
|
|
660
|
+
const needsFocus=!e.props.isFocused||state.focusDenied;
|
|
661
|
+
let width=widthLimit,height=heightLimit;
|
|
662
|
+
const title=(reduced=false)=>Text({...styles.accent,bold:true,wrap:'truncate',children:[clip(
|
|
663
|
+
(reduced?t('native.capacity.reduced',state.language,{columns:width,rows:height})+' · ':'')+
|
|
664
|
+
tr('task.title')+' · '+(state.busy?tr('profiles.loading'):tr('task.readonly')),width)]});
|
|
665
|
+
const notice = state.error ? renderMessage(state.error,state.language) :
|
|
666
|
+
state.warning ? renderMessage(state.warning,state.language) : '';
|
|
667
|
+
const fallback = () => {
|
|
668
|
+
const edit = !!state.input;
|
|
669
|
+
const pane = Box({flexDirection:'column',children:[
|
|
670
|
+
textLine(notice || tr('task.fallback'),width),
|
|
671
|
+
Button({...recoveryButton,key:edit?'task-cancel':'task-identity',hotkey:edit?'c':'s',
|
|
672
|
+
label:tr(edit?'profiles.cancel':'task.controls.identity'),onPress:()=>handleTaskKey($,options,state,edit?{key:'g',ctrl:true}:{key:'s'})}),
|
|
673
|
+
Button({...recoveryButton,key:'task-close',label:tr('task.close'),hotkey:'q',onPress:()=>$.ui.close({id:TASK_PANE})}),
|
|
615
674
|
]});
|
|
616
|
-
if(withinBudget(pane))
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
675
|
+
if (!withinBudget(pane)) throw new CapacityError();
|
|
676
|
+
return pane;
|
|
677
|
+
};
|
|
678
|
+
if (state.input) {
|
|
679
|
+
const fields: TaskField[] = state.input === 'search' ? ['search'] : ['session','prompt'];
|
|
680
|
+
const inputs=fields.map(field=>{
|
|
681
|
+
const replace=(value:string)=>{
|
|
682
|
+
if(!active() || !state.input)return false;
|
|
683
|
+
const wasDenied=state.focusDenied, previousError=state.error;
|
|
684
|
+
state.focusDenied=false;
|
|
685
|
+
const ok=replaceTaskField(state,field,value);
|
|
686
|
+
if(previousError!==state.error || wasDenied)$.ui.invalidate('ui.render');
|
|
687
|
+
return ok;
|
|
688
|
+
};
|
|
689
|
+
return Input({key:fieldKey(field),label:tr(fieldInfo[field].label),value:state[fieldInfo[field].buffer].value,
|
|
690
|
+
...(field===state.input?{autoFocus:true}:{}),submitLabel:tr('ui.hints.accept'),onInput:(value)=>{replace(value);},
|
|
691
|
+
onSubmit:async(value)=>{if(replace(value))await handleTaskKey($,options,state,{key:'return'});}});
|
|
692
|
+
});
|
|
693
|
+
const cancel=Button({...recoveryButton,key:'task-cancel',label:tr('profiles.cancel'),onPress:()=>active()&&handleTaskKey($,options,state,{key:'g',ctrl:true})});
|
|
694
|
+
const note=needsFocus?tr('task.controls.focus_field'):tr('task.controls.field_help');
|
|
695
|
+
let instructions = textLine(note,width);
|
|
696
|
+
if (state.fromClient) {
|
|
697
|
+
// Keep the clicked instance across the transfer. If the host declines
|
|
698
|
+
// focus, ordinary keys stay in that region until the person chooses
|
|
699
|
+
// the actual field. The native Input alone owns text and paste.
|
|
700
|
+
const {elements,frame}=frameElements();
|
|
701
|
+
elements.Text({...styles.muted,wrap:'truncate',children:[clip(note,width)]});
|
|
702
|
+
const props={epoch:state.epoch,ack:state.ack,generation:++state.frameGeneration,columns:width,rows:1,
|
|
703
|
+
displayColumns:width,displayRows:1,language:state.language,busy:true,frame};
|
|
704
|
+
if (!withinBudget(props) || !withinBudget(frameTree(frame))) return fallback();
|
|
705
|
+
instructions=Client({key:'task-client-'+state.epoch,module:'../ui/client/surface.ts',width,height:1,props});
|
|
706
|
+
}
|
|
707
|
+
const pane = Box({width,flexDirection:'column',children:[title(),instructions,...inputs,cancel,
|
|
708
|
+
...(notice?[textLine(notice,width)]:[])]});
|
|
709
|
+
return withinBudget(pane) ? pane : fallback();
|
|
710
|
+
}
|
|
711
|
+
for(;;) {
|
|
712
|
+
if(width<28||height<4)return fallback();
|
|
713
|
+
const reportRows=height-3;
|
|
714
|
+
const lines=taskViewerView(state,width,reportRows);
|
|
715
|
+
try {
|
|
716
|
+
const {elements,frame}=frameElements();
|
|
717
|
+
elements.Box({width,flexDirection:'column',children:lines.map(row=>elements.Text({
|
|
718
|
+
...styles.text,bold:row.selected,wrap:'truncate',children:[
|
|
719
|
+
row.key==='error'||row.key==='warning'?taskNotice(row.text,width):row.text,
|
|
720
|
+
],
|
|
721
|
+
}))});
|
|
722
|
+
const reduced=width<widthLimit||height<heightLimit;
|
|
723
|
+
const buttons=taskControls(ui,state.language,width,(name)=>{if(active()&&!state.input)return handleTaskKey($,options,state,{key:name});});
|
|
724
|
+
const props={epoch:state.epoch,ack:state.ack,generation:++state.frameGeneration,
|
|
725
|
+
columns:width,rows:reportRows,displayColumns:width,displayRows:reportRows,language:state.language,busy:false,frame};
|
|
726
|
+
if(!withinBudget(props)||!withinBudget(frameTree(frame)))throw new CapacityError();
|
|
727
|
+
const heading=needsFocus?tr('task.title')+' · '+tr('task.controls.focus'):reportRows===1?notice:'';
|
|
728
|
+
const pane=Box({width,height,flexDirection:'column',children:[
|
|
729
|
+
heading?textLine(heading,width):title(reduced),
|
|
730
|
+
Client({key:'task-client-'+state.epoch,module:'../ui/client/surface.ts',width,height:reportRows,props}),
|
|
731
|
+
...buttons,
|
|
732
|
+
]});
|
|
733
|
+
if(withinBudget(pane))return pane;
|
|
734
|
+
} catch(error) { if(!(error instanceof CapacityError))throw error; }
|
|
735
|
+
if(height>4)height=Math.max(4,Math.floor(height*.75));
|
|
736
|
+
else if(width>28)width=Math.max(28,Math.floor(width*.75));
|
|
737
|
+
else return fallback();
|
|
620
738
|
}
|
|
621
739
|
});
|
|
622
740
|
}
|
|
@@ -636,6 +754,7 @@ export const register: Register = (on, options) => {
|
|
|
636
754
|
generation: 0,
|
|
637
755
|
columns: 72,
|
|
638
756
|
rows: 24,
|
|
757
|
+
pane: { columns: 72, rows: 24 },
|
|
639
758
|
displayColumns: 72,
|
|
640
759
|
displayRows: 24,
|
|
641
760
|
saveOutcome: 'none',
|
|
@@ -740,9 +859,13 @@ export const register: Register = (on, options) => {
|
|
|
740
859
|
const run = state.inputChain.then(async () => {
|
|
741
860
|
if (batch.epoch !== state.epoch || !state.placed) return {};
|
|
742
861
|
const currentEpoch = state.epoch;
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
862
|
+
// Some hosts report the terminal viewport on a Client key event. Page
|
|
863
|
+
// navigation must use the region the enclosing pane actually assigned.
|
|
864
|
+
const columns = Math.min(batch.columns, state.pane.columns);
|
|
865
|
+
const rows = Math.min(batch.rows, state.pane.rows);
|
|
866
|
+
if (state.columns !== columns || state.rows !== rows) {
|
|
867
|
+
state.columns = columns;
|
|
868
|
+
state.rows = rows;
|
|
746
869
|
props(state);
|
|
747
870
|
}
|
|
748
871
|
for (const message of batch.events) {
|
|
@@ -876,6 +999,7 @@ export const register: Register = (on, options) => {
|
|
|
876
999
|
const { Box, Text, Button, Client } = $.ui.resolve(e);
|
|
877
1000
|
const width = Math.max(2, Math.min(10000, e.props.bodyColumns));
|
|
878
1001
|
const height = Math.max(0, Math.min(10000, e.props.scroll.bodyRows));
|
|
1002
|
+
state.pane = { columns: width, rows: height };
|
|
879
1003
|
state.columns = width;
|
|
880
1004
|
state.rows = height;
|
|
881
1005
|
const editor = state.view.editor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { openChanges, changesKey } from '../editor/change-review.ts';
|
|
1
|
+
import { openChanges, changesKey, stepDraftHistory } from '../editor/change-review.ts';
|
|
2
2
|
import { openReuse, reuseKey } from '../editor/reuse-manager.ts';
|
|
3
3
|
import { packageManager, packageKey, packageView } from '../editor/package-manager.ts';
|
|
4
4
|
import { openDiagnosis, diagnosisKey } from '../editor/diagnosis-view.ts';
|
|
@@ -48,29 +48,33 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
48
48
|
if (event.overflow) { setMessage(view, 'message', localizedText('input.overflow')); return null; }
|
|
49
49
|
if(e.changeReview)return changesKey(e,event,view.language??'en',contentColumns(columns,rows),editorLayout(view,columns,rows).bodyRows);
|
|
50
50
|
if(e.reuse)return reuseKey(e,event,view.language??'en',contentColumns(columns,rows),editorLayout(view,columns,rows).bodyRows);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const draftControl = event.ctrl && !event.meta && !event.text && !view.input && e.inDraftView && !e.packageLocked;
|
|
52
|
+
if (draftControl && shortcut === 't') { openChanges(e); return null; }
|
|
53
|
+
// Legacy terminals encode Ctrl+/ and Ctrl+_ alike. Keep forwarded Ctrl+Z as well.
|
|
54
|
+
if (draftControl && ['/', '_', 'z', 'r'].includes(shortcut)) {
|
|
55
|
+
setMessage(view, 'message', stepDraftHistory(e, shortcut === 'r'));
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
54
58
|
if(e.packages){packageView(e.packages,view.language??'en',contentColumns(columns,rows),editorLayout(view,columns,rows).bodyRows);return packageKey(e.packages,event);}
|
|
55
59
|
if(e.packageLocked){setMessage(view,'message',localizedText('package.ui.editor_locked'));return key==='escape'||event.ctrl&&key.toLowerCase()==='g'?'close':null;}
|
|
56
|
-
if(e.diagnosis)return diagnosisKey(e,event);
|
|
60
|
+
if (e.diagnosis) return diagnosisKey(e, event, view.language ?? 'en', contentColumns(columns, rows), editorLayout(view, columns, rows).bodyRows - 1);
|
|
57
61
|
if(e.colors)return colorsKey(e,event,view.language ?? 'en');
|
|
58
|
-
if(
|
|
62
|
+
if (draftControl && shortcut === 'l') { openDiagnosis(e); return null; }
|
|
59
63
|
if (e.alignmentManager) return alignmentsKey(e,event);
|
|
60
64
|
if (e.groupManager) return groupsKey(e, event);
|
|
61
|
-
if (
|
|
65
|
+
if (draftControl && shortcut === 'b' && !view.uncertain) { openGroups(e); return null; }
|
|
62
66
|
if (e.sources) return sourcesKey(e,event);
|
|
63
|
-
if (
|
|
67
|
+
if (draftControl && shortcut === 'y') { openSources(e); return 'sources'; }
|
|
64
68
|
if (e.profiles) return profilesKey(e, { ...event, key: key === 'return' ? 'enter' : key });
|
|
65
|
-
if (
|
|
69
|
+
if (draftControl && shortcut === 'o' && !e.detail && !view.uncertain) {
|
|
66
70
|
if (e.acceptNumeric()) { openProfiles(e); return 'profiles'; }
|
|
67
71
|
return null;
|
|
68
72
|
}
|
|
69
73
|
if (event.text && (!view.input || view.input.kind === 'category')) return null;
|
|
70
|
-
if(event.ctrl&&['v','w','n'].includes(
|
|
74
|
+
if(event.ctrl&&!event.meta&&!event.text&&!view.input&&(e.inDraftView||e.quick||e.review)&&['v','w','n'].includes(shortcut)){if(key.toLowerCase()==='v'){e.previewScenario=cyclePreview(SCENARIO_IDS,e.previewScenario,1);e.previewOffset=0;}else if(key.toLowerCase()==='w')e.previewWidth=cyclePreview(PREVIEW_WIDTHS,e.previewWidth as typeof PREVIEW_WIDTHS[number],1);else {const scope=e.quick?.previewScope??e.review?.previewScope??(e.page==='subagents'?'subagent':'main');e.previewOffset=(e.previewOffset+1)%Math.max(1,view.preview?.[scope==='main'?'main':'subagents'].length??0);}return null;}
|
|
71
75
|
if(e.explanation) { if(!explanationKey(e.explanation,event.ctrl && key.toLowerCase()==='g'?'cancel':event.ctrl||event.meta?'':key,Math.max(1,rows-10))) e.explanation=null; return null; }
|
|
72
76
|
if (e.quick) return controlQuick(e,event.ctrl && key.toLowerCase()==='g' ? 'cancel' : event.ctrl || event.meta ? '' : key);
|
|
73
|
-
if (
|
|
77
|
+
if (draftControl && shortcut === 'p' && !e.detail && !view.uncertain) {
|
|
74
78
|
if(e.acceptNumeric()) e.quick=openQuick(e.draft); return null;
|
|
75
79
|
}
|
|
76
80
|
if (event.ctrl && key.toLowerCase() === 'g') { const reviewing = !!e.review; cancelInput(view); return reviewing ? 'reviewPreview' : null; }
|
|
@@ -90,7 +94,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
90
94
|
if (e.guidanceScroll !== null && e.detail) {
|
|
91
95
|
const layout = editorLayout(view, columns, rows);
|
|
92
96
|
const width = Math.max(2, columns - (layout.framed ? 2 : 0));
|
|
93
|
-
const item = e.
|
|
97
|
+
const item = e.detailItem!;
|
|
94
98
|
const capacity = Math.max(1, layout.bodyRows - 1), maximum = Math.max(0, guidanceLines(item, view.language ?? 'en', width).length - capacity);
|
|
95
99
|
if (key === 'up') e.guidanceScroll--;
|
|
96
100
|
else if (key === 'down') e.guidanceScroll++;
|
|
@@ -170,12 +174,15 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
170
174
|
return null;
|
|
171
175
|
}
|
|
172
176
|
if(e.adding&&!event.ctrl&&!event.meta&&shortcut==='q'){e.closePicker(scope);return null;}
|
|
173
|
-
if(e.adding&&event.ctrl&&key.toLowerCase()==='y'){e.detail={scope,id:e.selected[scope]};e.guidanceScroll=0;return null;}
|
|
174
177
|
if(e.adding&&['tab','1','2','3','4'].includes(key))return null;
|
|
175
178
|
}
|
|
176
|
-
if (event.ctrl &&
|
|
179
|
+
if (event.ctrl && !event.meta && shortcut === 'e' && (e.page === 'main' || e.page === 'subagents')) {
|
|
177
180
|
const scope = e.page === 'main' ? 'main' : 'subagent';
|
|
178
|
-
if (e.selected[scope]) {
|
|
181
|
+
if (e.selected[scope]) {
|
|
182
|
+
e.detail = { scope, id: e.selected[scope] };
|
|
183
|
+
if (e.adding) e.guidanceScroll = 0;
|
|
184
|
+
else e.setting = 'item:label';
|
|
185
|
+
}
|
|
179
186
|
return null;
|
|
180
187
|
}
|
|
181
188
|
if (event.ctrl && key.toLowerCase() === 'f' && !e.detail && (e.page === 'main' || e.page === 'subagents')) {
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/change-review.ts
CHANGED
|
@@ -26,6 +26,11 @@ export function openChanges(e: Editor, structure = false): void {
|
|
|
26
26
|
}
|
|
27
27
|
function active(m: ChangeReview): ReviewState { return m.comparison === 1 ? m.external ?? m.review : m.comparison === 2 ? m.replacement ?? m.review : m.review; }
|
|
28
28
|
export function changePreview(e: Editor): Draft { return e.changeReview ? active(e.changeReview).result.draft : e.draft; }
|
|
29
|
+
export function stepDraftHistory(e: Editor, redo: boolean): LocalizedText {
|
|
30
|
+
return e.undo(redo)
|
|
31
|
+
? text('history.counts', { undo: e.history.undo.length, redo: e.history.redo.length })
|
|
32
|
+
: e.compositionError;
|
|
33
|
+
}
|
|
29
34
|
export function changesKey(e: Editor, event: TextKey, language: Language, width: number, height: number): 'changes' | null {
|
|
30
35
|
const m = e.changeReview!, key = event.key === 'enter' ? 'return' : event.key;
|
|
31
36
|
if (event.overflow) return null;
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/color-manager.ts
CHANGED
|
@@ -74,17 +74,20 @@ export function colorDraft(e: Editor): Draft {
|
|
|
74
74
|
}
|
|
75
75
|
export function colorsKey(e: Editor, event: TextKey, language: Language): null {
|
|
76
76
|
const m = e.colors!, key = event.key;
|
|
77
|
-
|
|
77
|
+
const commandKey = !event.text && !event.paste && !event.meta;
|
|
78
|
+
const cancel = commandKey && (key === 'escape' || event.ctrl && key.toLowerCase() === 'g');
|
|
79
|
+
const navigation = commandKey && !event.ctrl && ['up', 'down', 'home', 'end', 'pageup', 'pagedown'].includes(key);
|
|
80
|
+
if ((e.saveState !== 'idle' || m.generation !== e.mutationGeneration) && !cancel && !navigation) {
|
|
78
81
|
e.canMutateDraft(m.generation);
|
|
79
82
|
return null;
|
|
80
83
|
}
|
|
81
84
|
if (m.input) {
|
|
82
|
-
if (
|
|
85
|
+
if (cancel) {
|
|
83
86
|
m.input = null;
|
|
84
87
|
m.error = false;
|
|
85
88
|
return null;
|
|
86
89
|
}
|
|
87
|
-
if (
|
|
90
|
+
if (commandKey && !event.ctrl && key === 'return') {
|
|
88
91
|
try {
|
|
89
92
|
if (m.kind === 'gradient' && m.editing === null)
|
|
90
93
|
m.candidate = parseGradient(m.input.value);
|
|
@@ -115,7 +118,7 @@ export function colorsKey(e: Editor, event: TextKey, language: Language): null {
|
|
|
115
118
|
}
|
|
116
119
|
if (event.text || event.paste || event.meta || event.overflow)
|
|
117
120
|
return null;
|
|
118
|
-
if (
|
|
121
|
+
if (cancel) {
|
|
119
122
|
e.colors = null;
|
|
120
123
|
return null;
|
|
121
124
|
}
|
|
@@ -5,6 +5,7 @@ import { copyDraft } from './draft.ts';
|
|
|
5
5
|
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
6
6
|
import { t, type Language } from '../i18n/index.ts';
|
|
7
7
|
import { wrapText } from '../../ui/text.ts';
|
|
8
|
+
import { clip, displayWidth } from '../unicode.ts';
|
|
8
9
|
import { targetLabel } from './profile-manager.ts';
|
|
9
10
|
export interface DiagnosisView {
|
|
10
11
|
path: string;
|
|
@@ -22,14 +23,15 @@ export interface DiagnosisView {
|
|
|
22
23
|
}
|
|
23
24
|
export function openDiagnosis(e: Editor): void { e.diagnosis = { path: '', scope: e.detail?.scope ?? (e.page === 'subagents' ? 'subagent' : 'main'), observedAt: '', includeLocal: false, cursor: 0, input: null, result: null, error: '', scroll: 0, busy: false, report: false, generation: 0 }; }
|
|
24
25
|
export function diagnosisRequest(e: Editor, width: number) { const v = e.diagnosis!; return { draft: copyDraft(e.draft), path: v.path, scope: v.scope, width, observed_at: v.observedAt || null, include_local: v.includeLocal }; }
|
|
25
|
-
export function diagnosisKey(e: Editor, event: TextKey): 'diagnoseFile' | null {
|
|
26
|
-
const v = e.diagnosis!, key = event.key
|
|
26
|
+
export function diagnosisKey(e: Editor, event: TextKey, language: Language = 'en', width = 80, capacity = 8): 'diagnoseFile' | null {
|
|
27
|
+
const v = e.diagnosis!, key = event.key;
|
|
28
|
+
const cancel = !event.text && !event.paste && !event.meta && (key === 'escape' || event.ctrl && key.toLowerCase() === 'g');
|
|
27
29
|
if (v.input) {
|
|
28
30
|
if (cancel) {
|
|
29
31
|
v.input = null;
|
|
30
32
|
return null;
|
|
31
33
|
}
|
|
32
|
-
if (key === 'return' && !event.text && !event.paste) {
|
|
34
|
+
if (key === 'return' && !event.text && !event.paste && !event.ctrl && !event.meta) {
|
|
33
35
|
v.generation++;
|
|
34
36
|
if (v.cursor === 0)
|
|
35
37
|
v.path = v.input.value;
|
|
@@ -53,15 +55,19 @@ export function diagnosisKey(e: Editor, event: TextKey): 'diagnoseFile' | null {
|
|
|
53
55
|
e.diagnosis = null;
|
|
54
56
|
return null;
|
|
55
57
|
}
|
|
56
|
-
if (v.report) {
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
v.scroll = 0;
|
|
63
|
-
|
|
64
|
-
v.scroll =
|
|
58
|
+
if (v.report && v.result) {
|
|
59
|
+
if (event.ctrl || !['up', 'down', 'pageup', 'pagedown', 'home', 'end'].includes(key)) return null;
|
|
60
|
+
const count = Math.max(1, capacity);
|
|
61
|
+
const end = Math.max(0, reportLines(e, language, width).length - count);
|
|
62
|
+
const start = Math.min(v.scroll, end);
|
|
63
|
+
switch (key) {
|
|
64
|
+
case 'home': v.scroll = 0; break;
|
|
65
|
+
case 'end': v.scroll = end; break;
|
|
66
|
+
case 'up': v.scroll = Math.max(0, start - 1); break;
|
|
67
|
+
case 'down': v.scroll = Math.min(end, start + 1); break;
|
|
68
|
+
case 'pageup': v.scroll = Math.max(0, start - count); break;
|
|
69
|
+
case 'pagedown': v.scroll = Math.min(end, start + count); break;
|
|
70
|
+
}
|
|
65
71
|
return null;
|
|
66
72
|
}
|
|
67
73
|
if (event.ctrl)
|
|
@@ -96,12 +102,8 @@ export function diagnosisKey(e: Editor, event: TextKey): 'diagnoseFile' | null {
|
|
|
96
102
|
}
|
|
97
103
|
return null;
|
|
98
104
|
}
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
if (!v.report || !r)
|
|
102
|
-
return wrapText([t('diagnosis.target', language, { target: targetLabel(e, language) }),
|
|
103
|
-
...[t('diagnosis.path', language) + ': ' + v.path, t('diagnosis.scope', language) + ': ' + v.scope, t('diagnosis.time', language) + ': ' + (v.observedAt || tr('unknown')), t('diagnosis.local', language) + ': ' + t('values.' + (v.includeLocal ? 'on' : 'off'), language), t(v.busy ? 'diagnosis.busy' : 'diagnosis.run', language), t('diagnosis.previous', language), t('colors.cancel', language)].map((line, i) => (i === v.cursor ? '› ' : ' ') + line),
|
|
104
|
-
...(v.input ? [inputView(v.input, width)] : []), v.error, t('diagnosis.help', language)], width);
|
|
105
|
+
function reportLines(e: Editor, language: Language, width: number): string[] {
|
|
106
|
+
const r = e.diagnosis!.result!, tr = (key: string, params: Record<string, unknown> = {}) => t('diagnose.' + key, language, params);
|
|
105
107
|
const lines = [t('diagnosis.title', language), t('diagnosis.target', language, { target: targetLabel(e, language) }), tr('source', { value: r.source }), tr('times', { input: r.observed_at ?? tr('unknown'), now: r.diagnosed_at }), t(r.include_local ? 'diagnosis.with_local' : 'diagnosis.input_only', language), tr('identity', { session: r.session_id ?? tr('unknown'), prompt: r.prompt_id ?? tr('unknown') }), tr('output', { width: r.width }), ...r.output.map(row => row.spans.map(s => s.text).join(''))];
|
|
106
108
|
for (const item of r.instances) {
|
|
107
109
|
lines.push('', e.instanceLabel(r.scope, item.id, language) + ' (' + item.id + ')');
|
|
@@ -121,3 +123,35 @@ export function diagnosisLines(e: Editor, language: Language, width: number): st
|
|
|
121
123
|
lines.push('', tr('limits'));
|
|
122
124
|
return wrapText(lines, width);
|
|
123
125
|
}
|
|
126
|
+
|
|
127
|
+
export function diagnosisPage(e: Editor, language: Language, width: number, capacity: number) {
|
|
128
|
+
const v = e.diagnosis!;
|
|
129
|
+
const count = Math.max(1, capacity);
|
|
130
|
+
if (v.report && v.result) {
|
|
131
|
+
const lines = reportLines(e, language, width);
|
|
132
|
+
const start = Math.min(v.scroll, Math.max(0, lines.length - count));
|
|
133
|
+
return { lines: lines.slice(start, start + count), summary: `${start + 1}–${Math.min(start + count, lines.length)}/${lines.length}` };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const fields = [
|
|
137
|
+
[t('diagnosis.path', language), v.path],
|
|
138
|
+
[t('diagnosis.scope', language), v.scope],
|
|
139
|
+
[t('diagnosis.time', language), v.observedAt || t('diagnose.unknown', language)],
|
|
140
|
+
[t('diagnosis.local', language), t(v.includeLocal ? 'values.on' : 'values.off', language)],
|
|
141
|
+
[t(v.busy ? 'diagnosis.busy' : 'diagnosis.run', language)],
|
|
142
|
+
[t('diagnosis.previous', language)],
|
|
143
|
+
[t('colors.cancel', language)],
|
|
144
|
+
] as const;
|
|
145
|
+
const lines = [clip(t('diagnosis.target', language, { target: targetLabel(e, language) }), width)];
|
|
146
|
+
for (const [index, [label, value]] of fields.entries()) {
|
|
147
|
+
if (index === v.cursor && v.input) {
|
|
148
|
+
const prefix = '› ' + clip(label, Math.floor(width / 2)) + ' ';
|
|
149
|
+
lines.push(prefix + inputView({ ...v.input }, width - displayWidth(prefix)));
|
|
150
|
+
} else {
|
|
151
|
+
const content = value === undefined ? label : label + ': ' + value;
|
|
152
|
+
lines.push(clip((index === v.cursor ? '› ' : ' ') + content, width));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const start = Math.max(0, v.cursor + 2 - count);
|
|
156
|
+
return { lines: lines.slice(start, start + count), summary: v.error || t('diagnosis.help', language) };
|
|
157
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts
CHANGED
|
@@ -177,7 +177,11 @@ export class Editor {
|
|
|
177
177
|
undo(redo = false): boolean {
|
|
178
178
|
if (!this.canMutateDraft() || this.numericBefore) return false;
|
|
179
179
|
const source = redo ? this.history.redo : this.history.undo, target = redo ? this.history.undo : this.history.redo;
|
|
180
|
-
const entry = source.pop();
|
|
180
|
+
const entry = source.pop();
|
|
181
|
+
if (!entry) {
|
|
182
|
+
this.compositionError = text(redo ? 'history.no_redo' : 'history.no_undo');
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
181
185
|
target.push(snapshot(this.draft, entry.label)); boundHistory(this.history);
|
|
182
186
|
this.restoreDraft(entry.draft); this.mutationGeneration++;
|
|
183
187
|
this.groupManager = null; this.colors = null; this.structureProposal = null; this.changeReview = null;
|
|
@@ -203,6 +207,21 @@ export class Editor {
|
|
|
203
207
|
this.baseline = { ...current, draft: copyDraft(current.draft) }; this.mutationGeneration++; return true;
|
|
204
208
|
}
|
|
205
209
|
|
|
210
|
+
/** A manager, picker or read-only page owns its input until the user leaves it. */
|
|
211
|
+
get inDraftView(): boolean {
|
|
212
|
+
return !this.adding && this.guidanceScroll === null &&
|
|
213
|
+
!(this.changeReview || this.reuse || this.packages || this.taskViewer || this.diagnosis ||
|
|
214
|
+
this.colors || this.alignmentManager || this.groupManager || this.sources || this.profiles ||
|
|
215
|
+
this.explanation || this.quick || this.review);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
get detailItem(): CatalogItem | undefined {
|
|
219
|
+
if (!this.detail) return undefined;
|
|
220
|
+
const { scope, id } = this.detail;
|
|
221
|
+
// Catalog type IDs and configured instance IDs are independent namespaces.
|
|
222
|
+
return this.adding ? this.catalog(scope).find(item => item.id === id) : this.definition(scope, id);
|
|
223
|
+
}
|
|
224
|
+
|
|
206
225
|
get modified(): boolean {
|
|
207
226
|
return (
|
|
208
227
|
!sameDraft(this.draft, this.baseline.draft) ||
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts
CHANGED
|
@@ -34,7 +34,7 @@ export class SetupState {
|
|
|
34
34
|
if(key==='preview-next'){this.previewOffset++;return null;}
|
|
35
35
|
if (key === 'interrupt') return 'interrupt';
|
|
36
36
|
if (key === 'escape' || key === 'cancel') return 'cancel';
|
|
37
|
-
if (key === 'l') { this.language = LANGUAGES[(LANGUAGES.indexOf(this.language) + 1) % LANGUAGES.length]!; return 'language'; }
|
|
37
|
+
if (key.toLowerCase() === 'l') { this.language = LANGUAGES[(LANGUAGES.indexOf(this.language) + 1) % LANGUAGES.length]!; return 'language'; }
|
|
38
38
|
if (this.phase === 'quick') {
|
|
39
39
|
if (key === 'backspace' && this.quick!.step === 'scenario') { this.phase = 'choice'; this.selected = 1; return null; }
|
|
40
40
|
const result = quickKey(this.quick!, key);
|
|
@@ -75,8 +75,9 @@ export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
|
|
|
75
75
|
const m = editor.sources;
|
|
76
76
|
if (!m)
|
|
77
77
|
return null;
|
|
78
|
-
const key = event.key === 'return' ? 'enter' : event.key
|
|
79
|
-
|
|
78
|
+
const key = event.key === 'return' ? 'enter' : event.key;
|
|
79
|
+
const commandKey = !event.text && !event.paste && !event.meta, plain = commandKey && !event.ctrl;
|
|
80
|
+
if (commandKey && (key === 'escape' || event.ctrl && key.toLowerCase() === 'g')) {
|
|
80
81
|
if (m.page === 'list')
|
|
81
82
|
m.effect = 'close';
|
|
82
83
|
else {
|
|
@@ -88,9 +89,9 @@ export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
|
|
|
88
89
|
return m.effect ? 'sources' : null;
|
|
89
90
|
}
|
|
90
91
|
if (m.page === 'form') {
|
|
91
|
-
if (
|
|
92
|
+
if (plain && ['tab', 'up', 'down'].includes(key))
|
|
92
93
|
m.cursor = Math.max(0, Math.min(m.fields.length - 1, m.cursor + (key === 'up' ? -1 : 1)));
|
|
93
|
-
else if (
|
|
94
|
+
else if ((plain && key === 'enter') || (commandKey && event.ctrl && key.toLowerCase() === 's')) {
|
|
94
95
|
if (key === 'enter' && m.cursor < m.fields.length - 1)
|
|
95
96
|
m.cursor++;
|
|
96
97
|
else
|
|
@@ -119,7 +120,7 @@ export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
|
|
|
119
120
|
if (m.page === 'auto-review' && ['left', 'right'].includes(key)) { m.automaticInterval = Math.max(60, Math.min(86400, m.automaticInterval + (key === 'left' ? -60 : 60))); return null; }
|
|
120
121
|
if (key === 'up' || key === 'down')
|
|
121
122
|
m.cursor = Math.max(0, Math.min(count(editor) - 1, m.cursor + (key === 'up' ? -1 : 1)));
|
|
122
|
-
if (key === 'r' && m.page === 'list')
|
|
123
|
+
if (key.toLowerCase() === 'r' && m.page === 'list')
|
|
123
124
|
m.effect = 'load';
|
|
124
125
|
if (key === 'enter') {
|
|
125
126
|
if (m.page === 'list') {
|