@leosdc/exploreio 0.9.0 → 0.10.0
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 +3 -2
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/keybinds.js +7 -2
- package/dist/config/keybinds.js.map +1 -1
- package/dist/fs/explorer.js +211 -5
- package/dist/fs/explorer.js.map +1 -1
- package/dist/test/fs-operations-help-tabs.test.js +186 -0
- package/dist/test/fs-operations-help-tabs.test.js.map +1 -0
- package/dist/tui/app.js +246 -81
- package/dist/tui/app.js.map +1 -1
- package/dist/tui/helpModal.js +178 -0
- package/dist/tui/helpModal.js.map +1 -0
- package/package.json +1 -1
package/dist/tui/app.js
CHANGED
|
@@ -10,7 +10,7 @@ import { VimEngine } from '../editor/vimEngine.js';
|
|
|
10
10
|
import { buildEditorFrame } from '../editor/vimView.js';
|
|
11
11
|
import { getGitSummaryBadge, gitCheckoutBranch, gitCommit, gitCreateBranch, gitDiscardFile, gitFetch, gitPull, gitPush, gitStageAll, gitStageFile, gitStashPop, gitStashPush, gitUnstageAll, gitUnstageFile, loadCommitDetails, loadFileDiff, loadGitHubData, loadGitPanelSnapshot, } from '../git/gitService.js';
|
|
12
12
|
import { buildGitHubListItems, buildGitPanelFrame, buildQuickActions, buildStatusListItems, formatGitHeaderBadge, } from '../git/gitView.js';
|
|
13
|
-
import { createFileOrDir, createFileSafe, createFolderSafe,
|
|
13
|
+
import { copyEntriesSafe, createFileOrDir, createFileSafe, createFolderSafe, deleteEntriesSafe, duplicateEntrySafe, formatBytes, moveEntriesSafe, readDirectoryEntries, renameEntrySafe, safeReadFilePreview, safeWriteTextFile, suggestDuplicateName, } from '../fs/explorer.js';
|
|
14
14
|
import { DirectoryWatcher, resolveExistingDirectory, resolveNextSelectedIndex, } from '../fs/watcher.js';
|
|
15
15
|
import { collectAllCollapsiblePaths } from '../renderers/json.js';
|
|
16
16
|
import { renderDirectoryPreview, renderDocument, } from '../renderers/index.js';
|
|
@@ -19,6 +19,7 @@ import { BOLD, DIM, ITALIC, RESET, fitAnsi, highlightSearch, stripUnsafeAnsi, tr
|
|
|
19
19
|
import { copyTextToClipboard } from './clipboard.js';
|
|
20
20
|
import { applyModalOverlay, createInitialModalState, cycleModalExtension, renderCreateEntryModalOverlay, resolveModalTargetName, } from './createEntryModal.js';
|
|
21
21
|
import { openInFullscreenShell } from './fullscreenLauncher.js';
|
|
22
|
+
import { getDefaultHelpTabForView, getHelpTabByNumber, getNextHelpTab, renderHelpModalOverlay, } from './helpModal.js';
|
|
22
23
|
import { parseInputChunk } from './input.js';
|
|
23
24
|
import { KEYBINDS_TABS, buildKeybindsPanelFrame, getFilteredKeybindDefinitions, } from './keybindsView.js';
|
|
24
25
|
import { ScreenBuffer } from './screen.js';
|
|
@@ -55,6 +56,7 @@ export class ExploreioApp {
|
|
|
55
56
|
view = 'browser';
|
|
56
57
|
showHidden;
|
|
57
58
|
showHelp = false;
|
|
59
|
+
helpTab = 'browser';
|
|
58
60
|
// Estado do navegador 3 painéis
|
|
59
61
|
currentDir;
|
|
60
62
|
parentEntries = [];
|
|
@@ -62,6 +64,10 @@ export class ExploreioApp {
|
|
|
62
64
|
selectedIndex = 0;
|
|
63
65
|
listScroll = 0;
|
|
64
66
|
filterQuery = '';
|
|
67
|
+
// Seleção múltipla & Clipboard interno de arquivos (SPEC-009)
|
|
68
|
+
selectedPaths = new Set();
|
|
69
|
+
fsClipboard = null;
|
|
70
|
+
pendingDeletePaths = [];
|
|
65
71
|
// Preview & Leitor Fullscreen
|
|
66
72
|
previewLines = [];
|
|
67
73
|
previewBadge = '';
|
|
@@ -213,6 +219,34 @@ export class ExploreioApp {
|
|
|
213
219
|
process.exit(0);
|
|
214
220
|
}
|
|
215
221
|
if (this.showHelp) {
|
|
222
|
+
if (ev.name === 'char' && ev.char) {
|
|
223
|
+
const numberedTab = getHelpTabByNumber(ev.char);
|
|
224
|
+
if (numberedTab) {
|
|
225
|
+
this.helpTab = numberedTab;
|
|
226
|
+
this.draw();
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (ev.char === 'h') {
|
|
230
|
+
this.helpTab = getNextHelpTab(this.helpTab, -1);
|
|
231
|
+
this.draw();
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (ev.char === 'l') {
|
|
235
|
+
this.helpTab = getNextHelpTab(this.helpTab, 1);
|
|
236
|
+
this.draw();
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (ev.name === 'left' || (ev.shift && ev.name === 'tab')) {
|
|
241
|
+
this.helpTab = getNextHelpTab(this.helpTab, -1);
|
|
242
|
+
this.draw();
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
if (ev.name === 'right' || ev.name === 'tab') {
|
|
246
|
+
this.helpTab = getNextHelpTab(this.helpTab, 1);
|
|
247
|
+
this.draw();
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
216
250
|
if (this.keybinds.matches('global.openKeybinds', ev)) {
|
|
217
251
|
this.showHelp = false;
|
|
218
252
|
const ret = this.view === 'reader' || this.view === 'git' ? this.view : 'browser';
|
|
@@ -316,9 +350,10 @@ export class ExploreioApp {
|
|
|
316
350
|
const current = this.currentEntries[this.selectedIndex];
|
|
317
351
|
if (current) {
|
|
318
352
|
try {
|
|
319
|
-
await
|
|
320
|
-
this.
|
|
321
|
-
|
|
353
|
+
const res = await renameEntrySafe(current.fullPath, value);
|
|
354
|
+
this.syncRenamedPathReferences(current.fullPath, res.targetPath);
|
|
355
|
+
this.toastMessage = `Renomeado para: ${res.focusName}`;
|
|
356
|
+
await this.reloadDirectory(res.focusName);
|
|
322
357
|
}
|
|
323
358
|
catch (err) {
|
|
324
359
|
this.toastMessage = err instanceof Error ? err.message : String(err);
|
|
@@ -326,16 +361,24 @@ export class ExploreioApp {
|
|
|
326
361
|
}
|
|
327
362
|
}
|
|
328
363
|
else if (kind === 'delete') {
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
364
|
+
const targets = [...this.pendingDeletePaths];
|
|
365
|
+
this.pendingDeletePaths = [];
|
|
366
|
+
if (targets.length > 0 && (value.trim().toLowerCase() === 'y' || value.trim().toLowerCase() === 's')) {
|
|
367
|
+
const res = await deleteEntriesSafe(targets);
|
|
368
|
+
for (const item of res.succeeded) {
|
|
369
|
+
this.removePathFromFsState(item.sourcePath);
|
|
335
370
|
}
|
|
336
|
-
|
|
337
|
-
this.toastMessage =
|
|
371
|
+
if (res.failed.length === 0) {
|
|
372
|
+
this.toastMessage =
|
|
373
|
+
res.succeeded.length === 1
|
|
374
|
+
? `Removido: ${path.basename(res.succeeded[0].sourcePath)}`
|
|
375
|
+
: `Removidos ${res.succeeded.length} itens com sucesso.`;
|
|
338
376
|
}
|
|
377
|
+
else {
|
|
378
|
+
const firstErr = res.failed[0]?.error ?? 'Erro ao remover';
|
|
379
|
+
this.toastMessage = `Removidos: ${res.succeeded.length} · Falhas: ${res.failed.length} (${firstErr})`;
|
|
380
|
+
}
|
|
381
|
+
await this.reloadDirectory();
|
|
339
382
|
}
|
|
340
383
|
else {
|
|
341
384
|
this.toastMessage = 'Exclusão cancelada.';
|
|
@@ -477,6 +520,7 @@ export class ExploreioApp {
|
|
|
477
520
|
process.exit(0);
|
|
478
521
|
}
|
|
479
522
|
if (this.keybinds.matches('global.help', ev)) {
|
|
523
|
+
this.helpTab = getDefaultHelpTabForView('browser');
|
|
480
524
|
this.showHelp = true;
|
|
481
525
|
this.draw();
|
|
482
526
|
return;
|
|
@@ -529,16 +573,94 @@ export class ExploreioApp {
|
|
|
529
573
|
this.draw();
|
|
530
574
|
return;
|
|
531
575
|
}
|
|
576
|
+
if (this.keybinds.matches('browser.toggleSelect', ev) && this.currentEntries[this.selectedIndex]) {
|
|
577
|
+
const current = this.currentEntries[this.selectedIndex];
|
|
578
|
+
if (this.selectedPaths.has(current.fullPath)) {
|
|
579
|
+
this.selectedPaths.delete(current.fullPath);
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
this.selectedPaths.add(current.fullPath);
|
|
583
|
+
}
|
|
584
|
+
if (this.selectedIndex < maxIdx) {
|
|
585
|
+
this.selectedIndex++;
|
|
586
|
+
await this.refreshSelectedPreview();
|
|
587
|
+
}
|
|
588
|
+
this.draw();
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (this.keybinds.matches('browser.yankCopy', ev)) {
|
|
592
|
+
const targets = this.getTargetPathsForFsAction();
|
|
593
|
+
if (targets.length === 0) {
|
|
594
|
+
this.toastMessage = 'Nenhum item selecionado para copiar.';
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
this.fsClipboard = { mode: 'copy', paths: targets };
|
|
598
|
+
this.selectedPaths.clear();
|
|
599
|
+
const pasteKey = this.keybinds.formatActionKeys('browser.paste', '/');
|
|
600
|
+
const label = targets.length === 1 ? `"${path.basename(targets[0])}"` : `${targets.length} itens`;
|
|
601
|
+
this.toastMessage = `Copiado: ${label} · navegue e pressione ${pasteKey} para colar`;
|
|
602
|
+
}
|
|
603
|
+
this.draw();
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
if (this.keybinds.matches('browser.yankMove', ev)) {
|
|
607
|
+
const targets = this.getTargetPathsForFsAction();
|
|
608
|
+
if (targets.length === 0) {
|
|
609
|
+
this.toastMessage = 'Nenhum item selecionado para mover.';
|
|
610
|
+
}
|
|
611
|
+
else {
|
|
612
|
+
this.fsClipboard = { mode: 'move', paths: targets };
|
|
613
|
+
this.selectedPaths.clear();
|
|
614
|
+
const pasteKey = this.keybinds.formatActionKeys('browser.paste', '/');
|
|
615
|
+
const label = targets.length === 1 ? `"${path.basename(targets[0])}"` : `${targets.length} itens`;
|
|
616
|
+
this.toastMessage = `Recortado p/ mover: ${label} · navegue e pressione ${pasteKey} para colar`;
|
|
617
|
+
}
|
|
618
|
+
this.draw();
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
if (this.keybinds.matches('browser.paste', ev)) {
|
|
622
|
+
await this.executeFsPaste();
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (this.keybinds.matches('browser.clearSelection', ev)) {
|
|
626
|
+
if (this.selectedPaths.size > 0 || this.fsClipboard) {
|
|
627
|
+
this.selectedPaths.clear();
|
|
628
|
+
this.fsClipboard = null;
|
|
629
|
+
this.toastMessage = 'Seleção e clipboard interno limpos.';
|
|
630
|
+
this.draw();
|
|
631
|
+
}
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
if (ev.name === 'escape') {
|
|
635
|
+
if (this.filterQuery) {
|
|
636
|
+
this.filterQuery = '';
|
|
637
|
+
await this.reloadDirectory();
|
|
638
|
+
this.toastMessage = 'Filtro limpo.';
|
|
639
|
+
this.draw();
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
if (this.selectedPaths.size > 0 || this.fsClipboard) {
|
|
643
|
+
this.selectedPaths.clear();
|
|
644
|
+
this.fsClipboard = null;
|
|
645
|
+
this.toastMessage = 'Seleção e clipboard interno limpos.';
|
|
646
|
+
this.draw();
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
532
650
|
if (this.keybinds.matches('browser.renameEntry', ev) && this.currentEntries[this.selectedIndex]) {
|
|
533
651
|
this.promptKind = 'rename';
|
|
534
652
|
this.promptInput = this.currentEntries[this.selectedIndex]?.name ?? '';
|
|
535
653
|
this.draw();
|
|
536
654
|
return;
|
|
537
655
|
}
|
|
538
|
-
if (this.keybinds.matches('browser.deleteEntry', ev)
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
656
|
+
if (this.keybinds.matches('browser.deleteEntry', ev)) {
|
|
657
|
+
const targets = this.getTargetPathsForFsAction();
|
|
658
|
+
if (targets.length > 0) {
|
|
659
|
+
this.pendingDeletePaths = targets;
|
|
660
|
+
this.promptKind = 'delete';
|
|
661
|
+
this.promptInput = '';
|
|
662
|
+
this.draw();
|
|
663
|
+
}
|
|
542
664
|
return;
|
|
543
665
|
}
|
|
544
666
|
if (this.keybinds.matches('browser.copyPath', ev)) {
|
|
@@ -631,6 +753,82 @@ export class ExploreioApp {
|
|
|
631
753
|
}
|
|
632
754
|
this.draw();
|
|
633
755
|
}
|
|
756
|
+
getTargetPathsForFsAction() {
|
|
757
|
+
if (this.selectedPaths.size > 0) {
|
|
758
|
+
return Array.from(this.selectedPaths);
|
|
759
|
+
}
|
|
760
|
+
const current = this.currentEntries[this.selectedIndex];
|
|
761
|
+
return current ? [current.fullPath] : [];
|
|
762
|
+
}
|
|
763
|
+
syncRenamedPathReferences(oldPath, newPath) {
|
|
764
|
+
if (this.selectedPaths.has(oldPath)) {
|
|
765
|
+
this.selectedPaths.delete(oldPath);
|
|
766
|
+
this.selectedPaths.add(newPath);
|
|
767
|
+
}
|
|
768
|
+
if (this.fsClipboard) {
|
|
769
|
+
this.fsClipboard = {
|
|
770
|
+
...this.fsClipboard,
|
|
771
|
+
paths: this.fsClipboard.paths.map((p) => (p === oldPath ? newPath : p)),
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
removePathFromFsState(targetPath) {
|
|
776
|
+
this.selectedPaths.delete(targetPath);
|
|
777
|
+
if (this.fsClipboard) {
|
|
778
|
+
const remaining = this.fsClipboard.paths.filter((p) => p !== targetPath);
|
|
779
|
+
this.fsClipboard = remaining.length > 0 ? { ...this.fsClipboard, paths: remaining } : null;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
buildDeletePromptLabel() {
|
|
783
|
+
const targets = this.pendingDeletePaths;
|
|
784
|
+
if (targets.length === 1) {
|
|
785
|
+
const targetPath = targets[0];
|
|
786
|
+
const entry = this.currentEntries.find((e) => e.fullPath === targetPath);
|
|
787
|
+
const safeName = stripUnsafeAnsi(entry?.name ?? path.basename(targetPath));
|
|
788
|
+
if (entry?.isDirectory) {
|
|
789
|
+
return `Excluir pasta "${safeName}" recursivamente? (y/N): `;
|
|
790
|
+
}
|
|
791
|
+
return `Excluir "${safeName}"? (y/N): `;
|
|
792
|
+
}
|
|
793
|
+
if (targets.length > 1) {
|
|
794
|
+
return `Excluir ${targets.length} itens marcados? (y/N): `;
|
|
795
|
+
}
|
|
796
|
+
return `Excluir "${stripUnsafeAnsi(this.currentEntries[this.selectedIndex]?.name ?? '')}"? (y/N): `;
|
|
797
|
+
}
|
|
798
|
+
async executeFsPaste() {
|
|
799
|
+
if (!this.fsClipboard || this.fsClipboard.paths.length === 0) {
|
|
800
|
+
const copyKey = this.keybinds.formatActionKeys('browser.yankCopy', '/');
|
|
801
|
+
const moveKey = this.keybinds.formatActionKeys('browser.yankMove', '/');
|
|
802
|
+
this.toastMessage = `Nada para colar. Use ${copyKey} (copiar) ou ${moveKey} (mover) antes.`;
|
|
803
|
+
this.draw();
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
const { mode, paths } = this.fsClipboard;
|
|
807
|
+
const res = mode === 'copy'
|
|
808
|
+
? await copyEntriesSafe(paths, this.currentDir)
|
|
809
|
+
: await moveEntriesSafe(paths, this.currentDir);
|
|
810
|
+
if (mode === 'move') {
|
|
811
|
+
const failedPaths = res.failed.map((f) => f.sourcePath);
|
|
812
|
+
this.fsClipboard = failedPaths.length > 0 ? { mode: 'move', paths: failedPaths } : null;
|
|
813
|
+
}
|
|
814
|
+
const verb = mode === 'copy' ? 'Copiado' : 'Movido';
|
|
815
|
+
const verbPlural = mode === 'copy' ? 'Copiados' : 'Movidos';
|
|
816
|
+
if (res.failed.length === 0) {
|
|
817
|
+
this.toastMessage =
|
|
818
|
+
res.succeeded.length === 1
|
|
819
|
+
? `${verb}: ${res.focusName ?? path.basename(res.succeeded[0].sourcePath)}`
|
|
820
|
+
: `${verbPlural} ${res.succeeded.length} itens para esta pasta.`;
|
|
821
|
+
}
|
|
822
|
+
else if (res.succeeded.length > 0) {
|
|
823
|
+
const firstErr = res.failed[0]?.error ?? 'erro desconhecido';
|
|
824
|
+
this.toastMessage = `${verbPlural}: ${res.succeeded.length} · Falhas: ${res.failed.length} (${firstErr})`;
|
|
825
|
+
}
|
|
826
|
+
else {
|
|
827
|
+
this.toastMessage = res.failed[0]?.error ?? 'Não foi possível concluir a operação.';
|
|
828
|
+
}
|
|
829
|
+
await this.reloadDirectory(res.focusName);
|
|
830
|
+
this.draw();
|
|
831
|
+
}
|
|
634
832
|
async handleReaderKey(ev) {
|
|
635
833
|
this.toastMessage = '';
|
|
636
834
|
const { height } = this.screen.getSize();
|
|
@@ -651,6 +849,7 @@ export class ExploreioApp {
|
|
|
651
849
|
return;
|
|
652
850
|
}
|
|
653
851
|
if (this.keybinds.matches('global.help', ev)) {
|
|
852
|
+
this.helpTab = getDefaultHelpTabForView('reader');
|
|
654
853
|
this.showHelp = true;
|
|
655
854
|
this.draw();
|
|
656
855
|
return;
|
|
@@ -1206,17 +1405,27 @@ export class ExploreioApp {
|
|
|
1206
1405
|
const cEntry = this.currentEntries[cIdx];
|
|
1207
1406
|
if (cEntry) {
|
|
1208
1407
|
const selected = cIdx === this.selectedIndex;
|
|
1408
|
+
const isMarked = this.selectedPaths.has(cEntry.fullPath);
|
|
1409
|
+
const clipMode = this.fsClipboard?.paths.includes(cEntry.fullPath) ? this.fsClipboard.mode : null;
|
|
1410
|
+
const markPrefixPlain = isMarked ? '● ' : clipMode === 'copy' ? '⧉ ' : clipMode === 'move' ? '✂ ' : '';
|
|
1411
|
+
const markPrefixStyled = isMarked
|
|
1412
|
+
? `${fg(theme.warning)}${BOLD}●${RESET} `
|
|
1413
|
+
: clipMode === 'copy'
|
|
1414
|
+
? `${fg(theme.success)}${BOLD}⧉${RESET} `
|
|
1415
|
+
: clipMode === 'move'
|
|
1416
|
+
? `${fg(theme.danger)}${BOLD}✂${RESET} `
|
|
1417
|
+
: '';
|
|
1209
1418
|
const sizeLabel = cEntry.isDirectory ? '/' : formatBytes(cEntry.size);
|
|
1210
1419
|
const badge = getFileBadge(cEntry, theme);
|
|
1211
|
-
const nameBudget = Math.max(8, currentW - sizeLabel.length - 5);
|
|
1420
|
+
const nameBudget = Math.max(8, currentW - sizeLabel.length - 5 - markPrefixPlain.length);
|
|
1212
1421
|
const clippedName = truncateAnsi(stripUnsafeAnsi(cEntry.name), nameBudget);
|
|
1213
1422
|
if (selected) {
|
|
1214
|
-
const inner = ` ▸ ${clippedName}${' '.repeat(Math.max(1, currentW - visibleLength(clippedName) - sizeLabel.length - 4))}${sizeLabel} `;
|
|
1423
|
+
const inner = ` ▸ ${markPrefixPlain}${clippedName}${' '.repeat(Math.max(1, currentW - visibleLength(clippedName) - markPrefixPlain.length - sizeLabel.length - 4))}${sizeLabel} `;
|
|
1215
1424
|
rowStr += `${bg(theme.selectionBg)}${fg(theme.selectionFg)}${BOLD}${fitAnsi(inner, currentW)}${RESET}`;
|
|
1216
1425
|
}
|
|
1217
1426
|
else {
|
|
1218
1427
|
const color = cEntry.isDirectory ? theme.dir : theme.text;
|
|
1219
|
-
const left = ` ${badge} ${fg(color)}${clippedName}${RESET}`;
|
|
1428
|
+
const left = ` ${badge} ${markPrefixStyled}${fg(color)}${clippedName}${RESET}`;
|
|
1220
1429
|
const pad = ' '.repeat(Math.max(1, currentW - visibleLength(left) - sizeLabel.length - 1));
|
|
1221
1430
|
rowStr += fitAnsi(`${left}${pad}${fg(theme.muted)}${DIM}${sizeLabel}${RESET} `, currentW);
|
|
1222
1431
|
}
|
|
@@ -1274,14 +1483,14 @@ export class ExploreioApp {
|
|
|
1274
1483
|
create: 'Criar arquivo ou pasta/ : ',
|
|
1275
1484
|
duplicate: 'Duplicar para: ',
|
|
1276
1485
|
rename: 'Renomear para: ',
|
|
1277
|
-
delete:
|
|
1486
|
+
delete: this.buildDeletePromptLabel(),
|
|
1278
1487
|
'git-commit': 'git commit -m : ',
|
|
1279
1488
|
'git-branch-create': 'Nova branch (git checkout -b): ',
|
|
1280
1489
|
'git-confirm': `${this.gitPendingConfirm?.label ?? 'Confirmar operação Git'}? (y/N): `,
|
|
1281
1490
|
'keybinds-filter': 'Filtrar keybinds: ',
|
|
1282
1491
|
'keybinds-reset-confirm': 'Restaurar TODOS os keybinds para o padrão? (y/N): ',
|
|
1283
1492
|
};
|
|
1284
|
-
const text = ` ${labels[this.promptKind]}${this.promptInput}█`;
|
|
1493
|
+
const text = ` ${labels[this.promptKind]}${stripUnsafeAnsi(this.promptInput)}█`;
|
|
1285
1494
|
return `${bg(theme.selectionBg)}${fg(theme.selectionFg)}${BOLD}${fitAnsi(text, width)}${RESET}`;
|
|
1286
1495
|
}
|
|
1287
1496
|
if (this.view === 'keybinds' && this.keybindsCaptureMode) {
|
|
@@ -1289,7 +1498,7 @@ export class ExploreioApp {
|
|
|
1289
1498
|
return `${bg(theme.selectionBg)}${fg(theme.selectionFg)}${BOLD}${fitAnsi(` ◉ Pressione a nova tecla para ${modeText} (Esc cancela)`, width)}${RESET}`;
|
|
1290
1499
|
}
|
|
1291
1500
|
if (this.toastMessage) {
|
|
1292
|
-
return `${bg(theme.statusBg)}${fg(theme.warning)}${BOLD}${fitAnsi(` ◆ ${this.toastMessage}`, width)}${RESET}`;
|
|
1501
|
+
return `${bg(theme.statusBg)}${fg(theme.warning)}${BOLD}${fitAnsi(` ◆ ${stripUnsafeAnsi(this.toastMessage)}`, width)}${RESET}`;
|
|
1293
1502
|
}
|
|
1294
1503
|
if (this.view === 'keybinds') {
|
|
1295
1504
|
const hint = ' Esc/q Voltar · ↑↓ Selecionar · Enter Capturar · +/a Add tecla · d/Bksp Remover · r Reset · R Reset Tudo · s Salvar · / Filtrar · 1-5/Tab Abas';
|
|
@@ -1315,72 +1524,28 @@ export class ExploreioApp {
|
|
|
1315
1524
|
}
|
|
1316
1525
|
const pos = this.currentEntries.length > 0 ? `${this.selectedIndex + 1}/${this.currentEntries.length}` : '0/0';
|
|
1317
1526
|
const filterTag = this.filterQuery ? ` [filtro: ${this.filterQuery}]` : '';
|
|
1527
|
+
const selTag = this.selectedPaths.size > 0 ? ` [● ${this.selectedPaths.size} sel]` : '';
|
|
1528
|
+
const pasteKey = this.keybinds.formatActionKeys('browser.paste', '/');
|
|
1529
|
+
const clipTag = this.fsClipboard
|
|
1530
|
+
? this.fsClipboard.mode === 'copy'
|
|
1531
|
+
? ` [⧉ copiar ${this.fsClipboard.paths.length} · ${pasteKey}]`
|
|
1532
|
+
: ` [✂ mover ${this.fsClipboard.paths.length} · ${pasteKey}]`
|
|
1533
|
+
: '';
|
|
1318
1534
|
const kbKey = this.keybinds.formatActionKeys('global.openKeybinds', '/');
|
|
1319
1535
|
const helpKey = this.keybinds.formatActionKeys('global.help', '/');
|
|
1320
1536
|
const quitKey = this.keybinds.formatActionKeys('global.quit', '/');
|
|
1321
|
-
const hint = ` ${pos}${filterTag} · Enter Ler · Tab/Ctrl+G Git · e Vim · ${kbKey} Binds ·
|
|
1537
|
+
const hint = ` ${pos}${filterTag}${selTag}${clipTag} · Enter Ler · Tab/Ctrl+G Git · e Vim · ${kbKey} Binds · ${helpKey} Ajuda · ${quitKey} Sair`;
|
|
1322
1538
|
return `${bg(theme.statusBg)}${fg(theme.statusFg)}${fitAnsi(hint, width)}${RESET}`;
|
|
1323
1539
|
}
|
|
1324
1540
|
overlayHelpModal(lines, width, height, theme) {
|
|
1325
|
-
const
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
row(`${k('browser.moveUp')} · ${k('browser.moveDown')}`, 'Mover seleção (roda do mouse suportada)'),
|
|
1332
|
-
row(k('browser.open'), 'Entrar na pasta ou ABRIR ARQUIVO NO LEITOR'),
|
|
1333
|
-
row(k('browser.parentDir'), 'Subir para diretório pai'),
|
|
1334
|
-
row(k('browser.filter'), 'Filtrar arquivos (fuzzy)'),
|
|
1335
|
-
row(k('browser.toggleHidden'), 'Mostrar/ocultar arquivos ocultos'),
|
|
1336
|
-
row(k('browser.copyPath'), 'Copiar caminho selecionado (arquivo ou pasta)'),
|
|
1337
|
-
row(`${k('browser.createFile')} / ${k('browser.createFolder')}`, 'Novo arquivo (com extensão) / Nova pasta cross-OS'),
|
|
1338
|
-
row(`${k('browser.duplicateEntry')} / ${k('browser.renameEntry')} / ${k('browser.deleteEntry')}`, 'Duplicar / Renomear / Excluir (com confirmação)'),
|
|
1339
|
-
row(k('browser.openGitPanel'), 'Abrir PAINEL GIT / GITHUB (status, árvore, branches, PRs)'),
|
|
1340
|
-
'',
|
|
1341
|
-
' PAINEL GIT / GITHUB',
|
|
1342
|
-
row(`1-4 / ${k('git.nextTab')}`, 'Alternar abas (Status/Parados · Árvore · Branches · GitHub)'),
|
|
1343
|
-
row(`${k('git.stageToggle')} · ${k('git.stageAll')} · ${k('git.commit')}`, 'Stage/Unstage · Stage All · Commit com mensagem'),
|
|
1344
|
-
row(`${k('git.pull')}/${k('git.push')}/${k('git.fetch')}/${k('git.createBranch')}`, `Pull · Push · Fetch · Nova branch (${k('git.quickPalette')} paleta)`),
|
|
1345
|
-
'',
|
|
1346
|
-
' MODO LEITOR FULLSCREEN (Markdown · Mermaid · JSON · HTML · Código)',
|
|
1347
|
-
row(k('reader.toggleMode'), 'Alternar modo (Rendered↔Raw | Tree↔Pretty | Reader↔Source)'),
|
|
1348
|
-
row(k('reader.openFullscreen'), 'Abrir arquivo em novo terminal TELA CHEIA'),
|
|
1349
|
-
row(`${k('reader.jsonToggleNode')}`, `JSON Tree: alternar nó (${k('reader.jsonExpandAll')}=tudo, ${k('reader.jsonCollapseAll')}=recolher)`),
|
|
1350
|
-
row(`${k('reader.search')} · ${k('reader.searchNext')}/${k('reader.searchPrev')}`, 'Buscar texto no arquivo e saltar ocorrências'),
|
|
1351
|
-
row(k('reader.openEditor'), 'Abrir arquivo no EDITOR VIM NATIVO'),
|
|
1352
|
-
row(k('global.cycleTheme'), 'Alternar tema (Midnight · Parchment Light · Nord)'),
|
|
1353
|
-
row(k('reader.back'), 'Voltar ao navegador (ou sair)'),
|
|
1354
|
-
'',
|
|
1355
|
-
' CUSTOMIZAÇÃO DE KEYBINDS (Pressione ' + kbKey + ' agora para editar!)',
|
|
1356
|
-
row(kbKey, 'Abrir PAINEL INTERATIVO DE EDIÇÃO DE BINDS'),
|
|
1357
|
-
row('~/.exploreiorc.json', 'Config base (rode "exploreio --init-config" para gerar)'),
|
|
1358
|
-
'',
|
|
1359
|
-
' MODO EDITOR VIM (NORMAL · INSERT · VISUAL · COMMAND)',
|
|
1360
|
-
row('i/I/a/A/o/O · Esc', 'Entrar em INSERT · voltar para NORMAL'),
|
|
1361
|
-
row(':w · :wq · :q!', 'Salvar · Salvar e sair · Sair sem salvar · :<linha>'),
|
|
1362
|
-
];
|
|
1363
|
-
const startRow = Math.max(1, Math.floor((height - (helpItems.length + 4)) / 2));
|
|
1364
|
-
const padLeft = ' '.repeat(Math.max(0, Math.floor((width - boxW) / 2)));
|
|
1365
|
-
const innerW = boxW - 2;
|
|
1366
|
-
const modalLines = [
|
|
1367
|
-
`${padLeft}${fg(theme.borderActive)}${BOLD}╭${'─'.repeat(innerW)}╮${RESET}`,
|
|
1368
|
-
`${padLeft}${fg(theme.borderActive)}${BOLD}│${bg(theme.headerBg)}${fg(theme.accent)}${fitAnsi(` ◈ EXPLOREIO — ATALHOS (${kbKey} Editar Binds · Esc/? Fechar)`, innerW)}${RESET}${fg(theme.borderActive)}${BOLD}│${RESET}`,
|
|
1369
|
-
...helpItems.map((item) => {
|
|
1370
|
-
const isHeader = item.startsWith(' NAVEGADOR') ||
|
|
1371
|
-
item.startsWith(' PAINEL') ||
|
|
1372
|
-
item.startsWith(' MODO') ||
|
|
1373
|
-
item.startsWith(' CUSTOMIZAÇÃO');
|
|
1374
|
-
return `${padLeft}${fg(theme.borderActive)}│${bg(theme.statusBg)}${fg(isHeader ? theme.accentAlt : theme.text)}${fitAnsi(item, innerW)}${RESET}${fg(theme.borderActive)}│${RESET}`;
|
|
1375
|
-
}),
|
|
1376
|
-
`${padLeft}${fg(theme.borderActive)}${BOLD}╰${'─'.repeat(innerW)}╯${RESET}`,
|
|
1377
|
-
];
|
|
1378
|
-
modalLines.forEach((mLine, offset) => {
|
|
1379
|
-
const targetRow = startRow + offset;
|
|
1380
|
-
if (targetRow >= 0 && targetRow < lines.length) {
|
|
1381
|
-
lines[targetRow] = mLine;
|
|
1382
|
-
}
|
|
1541
|
+
const modalLines = renderHelpModalOverlay({
|
|
1542
|
+
activeTab: this.helpTab,
|
|
1543
|
+
keybinds: this.keybinds,
|
|
1544
|
+
width,
|
|
1545
|
+
height,
|
|
1546
|
+
theme,
|
|
1383
1547
|
});
|
|
1548
|
+
applyModalOverlay(lines, modalLines, height);
|
|
1384
1549
|
}
|
|
1385
1550
|
// ==================== PAINEL GIT & GITHUB (SPEC-005) ====================
|
|
1386
1551
|
refreshGitHeaderSummary() {
|