dsh-linked-workspace 0.13.0 → 0.15.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/lib/client.js CHANGED
@@ -2139,6 +2139,7 @@ function attributeViolation(name, value, tagName) {
2139
2139
  welcomePasswordWhere: '添加工作区时直接填 SSH 密码,只保存在本机',
2140
2140
  welcomeStar: '★ 点个 Star',
2141
2141
  welcomeDone: '知道了',
2142
+ welcomeReplay: '再次查看欢迎卡片',
2142
2143
  intro: '把 SSH 连接变成工作区:联动工作区把本地目录与远端目录配对,远程工作区让会话直接运行在远端目录。会话都能读取、搜索和编辑远端文件。',
2143
2144
  addWorkspace: '添加工作区',
2144
2145
  addLinked: '添加联动工作区',
@@ -2248,6 +2249,14 @@ function attributeViolation(name, value, tagName) {
2248
2249
  filterPlaceholder: '按名称过滤…',
2249
2250
  filterEmpty: '没有匹配当前过滤条件的条目',
2250
2251
  searchTruncated: '结果过多,仅显示前 200 条;请输入更精确的关键词',
2252
+ searchTruncatedFiles: '文件太多,搜索结果不完整;请缩小目录范围或换个关键词',
2253
+ searchTruncatedBytes: '读取的文件总量已达上限,搜索结果不完整;请缩小目录范围',
2254
+ searchTruncatedDeadline: '搜索超时,结果不完整;请缩小目录范围或换个关键词',
2255
+ searchCase: '区分大小写',
2256
+ searchRegex: '正则表达式',
2257
+ searchScopeAll: '整个工作区',
2258
+ searchScopeHere: '只搜当前目录',
2259
+ searchScopeLabel: '范围:{{scope}}',
2251
2260
  findPlaceholder: '查找…',
2252
2261
  replacePlaceholder: '替换为…',
2253
2262
  findCounter: '第 {{index}} / {{total}} 个',
@@ -2329,6 +2338,24 @@ function attributeViolation(name, value, tagName) {
2329
2338
  searchModeContent: '内容',
2330
2339
  searchPlaceholderContent: '在文件内容中搜索…',
2331
2340
  queueRetry: '重试',
2341
+ rowModifiedAt: '修改于 {{when}}',
2342
+ ctxRenameSelected: '批量重命名所选的 {{count}} 项…',
2343
+ renameManyTitle: '批量重命名 {{count}} 项',
2344
+ renameManyPattern: '按序号',
2345
+ renameManyReplace: '查找替换',
2346
+ renameManyPrefix: '前缀',
2347
+ renameManyStart: '起始序号',
2348
+ renameManyPad: '序号位数',
2349
+ renameManyFind: '查找',
2350
+ renameManyReplaceWith: '替换为',
2351
+ renameManyEmpty: '(名称不能为空)',
2352
+ renameManyConflict: '有重名,先调整规则再重命名',
2353
+ renameManyApply: '重命名 {{count}} 项',
2354
+ renameManyDone: '已重命名 {{count}} 项',
2355
+ queueCancel: '取消',
2356
+ queueProgress: '已传 {{files}} 个 · {{size}}',
2357
+ queueCancelling: '正在取消…',
2358
+ queueCancelled: '已取消(已传 {{files}} 个)',
2332
2359
  shortcutWebNote: 'Web GUI 中 Ctrl+W、Ctrl+Tab 由浏览器占用,请在 DSH 桌面端使用这些快捷键。',
2333
2360
  themeTitle: '编辑器主题',
2334
2361
  themeHint: '远程文件编辑器的配色;主题只影响本插件的远程文件视图。',
@@ -2539,6 +2566,7 @@ function attributeViolation(name, value, tagName) {
2539
2566
  queueClear: '清空已完成',
2540
2567
  tooManyTabs: '同时打开的文件标签已达上限(12 个),请先关闭一些标签。',
2541
2568
  transferSelected: '传输所选文件/文件夹',
2569
+ transferNeedsLinked: '传输只在联动工作区可用(远端 → 本地)',
2542
2570
  selectFirst: '先在目录树中选择一个远端文件或文件夹。',
2543
2571
  showHidden: '显示隐藏的文件',
2544
2572
  hideHidden: '隐藏隐藏的文件',
@@ -2571,6 +2599,7 @@ function attributeViolation(name, value, tagName) {
2571
2599
  welcomePasswordWhere: 'Type the SSH password when adding a workspace; it stays on this machine',
2572
2600
  welcomeStar: '★ Star the repo',
2573
2601
  welcomeDone: 'Got it',
2602
+ welcomeReplay: 'Show the welcome card again',
2574
2603
  intro: 'Turn an SSH connection into a workspace: a linked workspace pairs a local folder with a remote folder, and a remote workspace runs sessions directly inside the remote folder. Either way sessions can read, search and edit remote files.',
2575
2604
  addWorkspace: 'Add workspace',
2576
2605
  addRemoteDir: 'Add remote directory',
@@ -2681,6 +2710,14 @@ function attributeViolation(name, value, tagName) {
2681
2710
  filterPlaceholder: 'Filter by name…',
2682
2711
  filterEmpty: 'No entries match the current filter',
2683
2712
  searchTruncated: 'Too many results; showing the first 200. Narrow the query.',
2713
+ searchTruncatedFiles: 'Too many files were scanned; results are incomplete. Narrow the folder or the query.',
2714
+ searchTruncatedBytes: 'The byte budget ran out; results are incomplete. Narrow the folder.',
2715
+ searchTruncatedDeadline: 'The search timed out; results are incomplete. Narrow the folder or the query.',
2716
+ searchCase: 'Match case',
2717
+ searchRegex: 'Regular expression',
2718
+ searchScopeAll: 'Whole workspace',
2719
+ searchScopeHere: 'Current folder only',
2720
+ searchScopeLabel: 'Scope: {{scope}}',
2684
2721
  findPlaceholder: 'Find…',
2685
2722
  replacePlaceholder: 'Replace with…',
2686
2723
  findCounter: '{{index}} / {{total}}',
@@ -2762,6 +2799,24 @@ function attributeViolation(name, value, tagName) {
2762
2799
  searchModeContent: 'Content',
2763
2800
  searchPlaceholderContent: 'Search file contents…',
2764
2801
  queueRetry: 'Retry',
2802
+ rowModifiedAt: 'Modified {{when}}',
2803
+ ctxRenameSelected: 'Rename the {{count}} selected…',
2804
+ renameManyTitle: 'Rename {{count}} entries',
2805
+ renameManyPattern: 'Numbering',
2806
+ renameManyReplace: 'Find and replace',
2807
+ renameManyPrefix: 'Prefix',
2808
+ renameManyStart: 'Start at',
2809
+ renameManyPad: 'Digits',
2810
+ renameManyFind: 'Find',
2811
+ renameManyReplaceWith: 'Replace with',
2812
+ renameManyEmpty: '(name cannot be empty)',
2813
+ renameManyConflict: 'Two entries would share a name — adjust the rule first',
2814
+ renameManyApply: 'Rename {{count}}',
2815
+ renameManyDone: 'Renamed {{count}} entries',
2816
+ queueCancel: 'Cancel',
2817
+ queueProgress: '{{files}} sent · {{size}}',
2818
+ queueCancelling: 'Cancelling…',
2819
+ queueCancelled: 'Cancelled ({{files}} sent)',
2765
2820
  shortcutWebNote: 'In the Web GUI, Ctrl+W and Ctrl+Tab are reserved by the browser; use these shortcuts in the DSH desktop app.',
2766
2821
  themeTitle: 'Editor theme',
2767
2822
  themeHint: 'Colors of the remote file editor. Themes affect this plugin’s remote file views only.',
@@ -2972,6 +3027,7 @@ function attributeViolation(name, value, tagName) {
2972
3027
  queueClear: 'Clear finished',
2973
3028
  tooManyTabs: 'At most 12 file tabs can be open at once; close one first.',
2974
3029
  transferSelected: 'Transfer the selected file/folder',
3030
+ transferNeedsLinked: 'Transfer needs a linked workspace (remote → local)',
2975
3031
  selectFirst: 'Select a remote file or folder in the tree first.',
2976
3032
  showHidden: 'Show hidden files',
2977
3033
  hideHidden: 'Hide hidden files',
@@ -3059,6 +3115,27 @@ function attributeViolation(name, value, tagName) {
3059
3115
  });
3060
3116
  }
3061
3117
 
3118
+ /**
3119
+ * Keep in sync with `API_REVISION` in lib/index.js. When this build needs
3120
+ * Host methods the running DSH process does not have yet, the directory
3121
+ * pane says so instead of surfacing an unrelated error.
3122
+ */
3123
+ var HOST_API_REVISION = 2;
3124
+ var hostInfoProbe = null;
3125
+
3126
+ function probeHostInfo() {
3127
+ if (hostInfoProbe) return hostInfoProbe;
3128
+ hostInfoProbe = apiCall('meta.info', {}).then(function (info) {
3129
+ var revision = Number(info && info.apiRevision) || 0;
3130
+ return { stale: revision < HOST_API_REVISION, info: info || null };
3131
+ }, function (error) {
3132
+ var message = error && typeof error.message === 'string' ? error.message : '';
3133
+ // No such method: the running Host predates this Client.
3134
+ return { stale: message.indexOf('unknown method:') === 0, info: null };
3135
+ });
3136
+ return hostInfoProbe;
3137
+ }
3138
+
3062
3139
  var CODE_TEXT = {
3063
3140
  zh: {
3064
3141
  NOT_FOUND: '远端对象不存在',
@@ -3402,6 +3479,9 @@ function attributeViolation(name, value, tagName) {
3402
3479
  '.rw-input{height:32px;padding:0 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;outline:none;min-width:0;box-sizing:border-box}',
3403
3480
  '.rw-input:focus{border-color:var(--dsw-alias-brand-primary)}',
3404
3481
  '.rw-input-mono{font-family:ui-monospace,"Cascadia Code",Consolas,monospace;font-size:12.5px}',
3482
+ // A long remote path must never push the "use this directory" button out of
3483
+ // the row; it ellipsizes inside its own flex item instead.
3484
+ '.rw-path-text{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
3405
3485
  '.rw-input-row{display:flex;align-items:center;gap:8px;min-width:0}',
3406
3486
  '.rw-input-row .rw-input{flex:1 1 auto}',
3407
3487
  '.rw-host-list{display:flex;flex-direction:column;gap:2px;max-height:216px;overflow:auto;padding:4px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}',
@@ -3530,6 +3610,7 @@ function attributeViolation(name, value, tagName) {
3530
3610
  '.rw-menu-backdrop{position:fixed;inset:0;z-index:40}',
3531
3611
  '.rw-searchbar{display:flex;align-items:center;gap:6px;margin:6px 8px 0;padding:0 8px;height:30px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-1);flex:none}',
3532
3612
  '.rw-searchbar input{flex:1 1 auto;border:0;outline:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;min-width:0}',
3613
+ '.rw-search-flags{display:inline-flex;align-items:center;gap:2px;flex:none}',
3533
3614
  '.rw-chips{display:flex;gap:4px;padding:6px 8px 0;overflow:auto;flex:none}',
3534
3615
  '.rw-chip-btn{display:inline-flex;align-items:center;gap:4px;max-width:190px;padding:2px 8px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:16px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:none}',
3535
3616
  '.rw-chip-btn.is-on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-label-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 10%,transparent)}',
@@ -3550,6 +3631,10 @@ function attributeViolation(name, value, tagName) {
3550
3631
  '.rw-change-meta{flex:none;font-size:10.5px;color:var(--dsw-alias-label-tertiary)}',
3551
3632
  '.rw-search-results{flex:1 1 auto;min-height:0;overflow:auto;padding:6px 8px}',
3552
3633
  '.rw-result-row{display:flex;align-items:center;gap:6px;width:100%;padding:4px;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;cursor:pointer;text-align:left}',
3634
+ '.rw-result-row.is-content{flex-direction:column;align-items:stretch;gap:1px}',
3635
+ '.rw-result-head{display:flex;align-items:center;gap:6px;min-width:0}',
3636
+ '.rw-result-line{flex:none;font-size:11px;color:var(--dsw-alias-label-secondary)}',
3637
+ '.rw-result-preview{display:block;font-size:11px;line-height:15px;color:var(--dsw-alias-label-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}',
3553
3638
  '.rw-result-row:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}',
3554
3639
  '.rw-hint-row{padding:9px 6px;font-size:11.5px;line-height:17px;color:var(--dsw-alias-label-tertiary)}',
3555
3640
  '.rw-linked-notice{margin:6px 8px 0}',
@@ -3644,13 +3729,15 @@ function attributeViolation(name, value, tagName) {
3644
3729
  '.rw-ctx-arrow{display:inline-flex;color:var(--dsw-alias-label-tertiary)}',
3645
3730
  '.rw-ctx-sub{display:none;position:absolute;left:100%;top:-5px;min-width:150px;padding:4px 0;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-overlay);box-shadow:0 12px 36px rgba(0,0,0,.3)}',
3646
3731
  '.rw-ctx-item.has-sub:hover .rw-ctx-sub{display:block}',
3647
- '.rw-dialog-backdrop{position:fixed;inset:0;z-index:80;background:rgba(0,0,0,.32);display:flex;align-items:center;justify-content:center}',
3648
- '.rw-dialog{width:min(430px,calc(100vw - 48px));max-height:min(72vh,560px);overflow:auto;border:1px solid var(--dsw-alias-border-l2);border-radius:11px;background:var(--dsw-alias-bg-overlay);box-shadow:0 18px 50px rgba(0,0,0,.34);padding:14px}',
3649
- '.rw-dialog-title{font-size:13px;font-weight:600;line-height:20px;margin-bottom:9px}',
3732
+ '.rw-dialog-backdrop{position:fixed;inset:0;z-index:80;padding:24px;background:rgba(0,0,0,.34);backdrop-filter:blur(2px);display:flex;align-items:center;justify-content:center}',
3733
+ // D4: dialogs share the add-workspace modal's frame so a confirm never
3734
+ // looks like a foreign panel next to it.
3735
+ '.rw-dialog{width:min(460px,calc(100vw - 48px));max-height:min(80vh,620px);overflow:auto;border:1px solid var(--dsw-alias-border-l2);border-radius:16px;background:var(--dsw-alias-bg-overlay);box-shadow:0 18px 60px rgba(0,0,0,.35);padding:18px 20px}',
3736
+ '.rw-dialog-title{font-size:15px;font-weight:600;line-height:22px;margin-bottom:10px}',
3650
3737
  '.rw-dialog-label{display:block;margin:7px 0 4px;font-size:11.5px;color:var(--dsw-alias-label-tertiary)}',
3651
3738
  '.rw-dialog-input{width:100%;box-sizing:border-box;padding:6px 9px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;outline:none}',
3652
- '.rw-dialog-actions{display:flex;justify-content:flex-end;gap:7px;margin-top:12px}',
3653
- '.rw-dialog-message{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}',
3739
+ '.rw-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}',
3740
+ '.rw-dialog-message{font-size:13px;line-height:19px;color:var(--dsw-alias-label-secondary)}',
3654
3741
  // First-run welcome card: sits in shell.overlay, so the backdrop is its own.
3655
3742
  '.rw-welcome-backdrop{position:fixed;inset:0;z-index:2000;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(0,0,0,.42)}',
3656
3743
  '.rw-welcome{position:relative;width:min(470px,100%);max-height:min(86vh,700px);overflow:auto;box-sizing:border-box;padding:22px 22px 18px;border:1px solid var(--dsw-alias-border-l2);border-radius:18px;background:var(--dsw-alias-bg-layer-2);box-shadow:0 26px 70px rgba(0,0,0,.42);color:var(--dsw-alias-label-primary)}',
@@ -3687,6 +3774,12 @@ function attributeViolation(name, value, tagName) {
3687
3774
  '.rw-csv-table tr:nth-child(even) td{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 52%,transparent)}',
3688
3775
  '.rw-csv-note{padding:5px 9px;font-size:10.5px;color:var(--dsw-alias-label-tertiary);border-top:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}',
3689
3776
  '.rw-queue-row{display:flex;align-items:center;gap:8px;padding:5px 0;border-bottom:1px solid var(--dsw-alias-border-l1);font-size:12px}',
3777
+ '.rw-rename-preview{max-height:min(38vh,300px);overflow:auto;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;padding:4px 8px;margin:2px 0 10px}',
3778
+ '.rw-rename-row{display:flex;align-items:center;gap:6px;padding:3px 0;font-size:12px;line-height:18px}',
3779
+ '.rw-rename-row.is-bad{color:var(--dsw-alias-state-error-primary)}',
3780
+ '.rw-rename-from{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary)}',
3781
+ '.rw-rename-arrow{flex:none;color:var(--dsw-alias-label-tertiary)}',
3782
+ '.rw-rename-to{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}',
3690
3783
  '.rw-queue-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
3691
3784
  '.rw-queue-state{flex:none;font-size:10.5px;color:var(--dsw-alias-label-tertiary)}',
3692
3785
  ].join('\n');
@@ -4424,7 +4517,7 @@ function attributeViolation(name, value, tagName) {
4424
4517
  placeholder: t('filterPlaceholder'),
4425
4518
  'aria-label': t('filterPlaceholder'),
4426
4519
  spellCheck: false,
4427
- onChange: function (event) { setLocal(function (previous) { return Object.assign({}, previous, { filter: event.currentTarget.value }); }); },
4520
+ onChange: function (event) { var value = event.currentTarget.value; setLocal(function (previous) { return Object.assign({}, previous, { filter: value }); }); },
4428
4521
  })),
4429
4522
  h('div', { className: 'rw-browser-list', role: 'list' },
4430
4523
  local.error
@@ -4448,10 +4541,9 @@ function attributeViolation(name, value, tagName) {
4448
4541
  className: 'rw-input rw-input-mono', style: { height: 28, fontSize: 11.5 },
4449
4542
  value: local.input,
4450
4543
  spellCheck: false,
4451
- onChange: function (event) { setLocal(function (previous) { return Object.assign({}, previous, { input: event.currentTarget.value }); }); },
4544
+ onChange: function (event) { var value = event.currentTarget.value; setLocal(function (previous) { return Object.assign({}, previous, { input: value }); }); },
4452
4545
  onKeyDown: function (event) { if (event.key === 'Enter') navigate(local.input); },
4453
4546
  }),
4454
- h('button', { type: 'button', className: 'rw-btn rw-btn-sm', onClick: function () { navigate(local.input); } }, t('open')),
4455
4547
  typeof window !== 'undefined' && typeof window.__DSH_DESKTOP_PICK_DIRECTORY__ === 'function'
4456
4548
  ? h('button', { type: 'button', className: 'rw-btn rw-btn-sm', onClick: nativePick, title: t('nativePicker') }, t('nativePicker'))
4457
4549
  : null,
@@ -4470,7 +4562,7 @@ function attributeViolation(name, value, tagName) {
4470
4562
  h('input', {
4471
4563
  className: 'rw-input', style: { height: 28, fontSize: 12 }, placeholder: t('folderName'),
4472
4564
  value: local.folderName, autoFocus: true,
4473
- onChange: function (event) { setLocal(function (previous) { return Object.assign({}, previous, { folderName: event.currentTarget.value }); }); },
4565
+ onChange: function (event) { var value = event.currentTarget.value; setLocal(function (previous) { return Object.assign({}, previous, { folderName: value }); }); },
4474
4566
  onKeyDown: function (event) { if (event.key === 'Enter') createFolder(); },
4475
4567
  }),
4476
4568
  h('button', { type: 'button', className: 'rw-btn rw-btn-sm rw-btn-primary', disabled: local.folderName.trim() === '', onClick: createFolder }, t('create')),
@@ -4485,7 +4577,7 @@ function attributeViolation(name, value, tagName) {
4485
4577
  var t = props.t;
4486
4578
  var locale = props.locale;
4487
4579
  var hostId = props.hostId;
4488
- var state = useState({ loading: true, listing: null, error: '', input: props.initialPath || '', filter: '' });
4580
+ var state = useState({ loading: true, listing: null, error: '', input: props.initialPath || '', filter: '', creating: false, folderName: '', busy: false });
4489
4581
  var remote = state[0];
4490
4582
  var setRemote = state[1];
4491
4583
 
@@ -4511,6 +4603,20 @@ function attributeViolation(name, value, tagName) {
4511
4603
  load(path);
4512
4604
  }
4513
4605
 
4606
+ function createFolder() {
4607
+ var name = remote.folderName.trim();
4608
+ if (name === '' || !listing || remote.busy) return;
4609
+ setRemote(function (previous) { return Object.assign({}, previous, { busy: true, error: '' }); });
4610
+ apiCall('hosts.mkdir', { hostId: hostId, path: listing.path, name: name }).then(function (result) {
4611
+ setRemote(function (previous) { return Object.assign({}, previous, { busy: false, creating: false, folderName: '' }); });
4612
+ // Land inside the folder that was just made: it is almost always the
4613
+ // directory the user wants to pick.
4614
+ load(result && result.path ? result.path : listing.path);
4615
+ }).catch(function (error) {
4616
+ setRemote(function (previous) { return Object.assign({}, previous, { busy: false, error: messageOf(error, t, locale) }); });
4617
+ });
4618
+ }
4619
+
4514
4620
  var listing = remote.listing;
4515
4621
  var dirs = listing ? (listing.entries || []).filter(function (entry) { return entry.type === 'dir'; }) : [];
4516
4622
  var PICKER_LIMIT = 500;
@@ -4553,7 +4659,7 @@ function attributeViolation(name, value, tagName) {
4553
4659
  placeholder: t('filterPlaceholder'),
4554
4660
  'aria-label': t('filterPlaceholder'),
4555
4661
  spellCheck: false,
4556
- onChange: function (event) { setRemote(function (previous) { return Object.assign({}, previous, { filter: event.currentTarget.value }); }); },
4662
+ onChange: function (event) { var value = event.currentTarget.value; setRemote(function (previous) { return Object.assign({}, previous, { filter: value }); }); },
4557
4663
  })),
4558
4664
  h('div', { className: 'rw-browser-list', role: 'list' },
4559
4665
  remote.error
@@ -4571,14 +4677,43 @@ function attributeViolation(name, value, tagName) {
4571
4677
  pickerTruncated
4572
4678
  ? h('div', { className: 'rw-row-msg' }, t('pickerTruncated', { count: PICKER_LIMIT }))
4573
4679
  : null),
4574
- h('div', { className: 'rw-browser-actions', style: { padding: '8px' } },
4575
- h('span', { className: 'rw-hint rw-input-mono', title: remote.input || (listing && listing.path) || '' },
4576
- (listing && listing.path) || (remote.input !== '' ? remote.input : t('home'))),
4577
- h('button', {
4578
- type: 'button', className: 'rw-btn rw-btn-sm rw-btn-primary',
4579
- disabled: !listing || remote.loading,
4580
- onClick: function () { if (listing && props.onPick) props.onPick(listing.path); },
4581
- }, IconCheck(12), t('useThisDir'))));
4680
+ h('div', { className: 'rw-browser-actions', style: { padding: '8px', gap: 8 } },
4681
+ h('div', { className: 'rw-inline', style: { minWidth: 0, flex: '1 1 auto', flexWrap: 'nowrap' } },
4682
+ h('span', {
4683
+ className: 'rw-hint rw-input-mono rw-path-text',
4684
+ title: remote.input || (listing && listing.path) || '',
4685
+ }, (listing && listing.path) || (remote.input !== '' ? remote.input : t('home'))),
4686
+ h('button', {
4687
+ type: 'button', className: 'rw-btn rw-btn-sm',
4688
+ disabled: !listing || remote.loading,
4689
+ onClick: function () { setRemote(function (previous) { return Object.assign({}, previous, { creating: !previous.creating, folderName: '' }); }); },
4690
+ }, IconPlus(12), t('newFolder'))),
4691
+ h('div', { className: 'rw-actions', style: { flex: 'none' } },
4692
+ h('button', {
4693
+ type: 'button', className: 'rw-btn rw-btn-sm rw-btn-primary',
4694
+ disabled: !listing || remote.loading,
4695
+ onClick: function () { if (listing && props.onPick) props.onPick(listing.path); },
4696
+ }, IconCheck(12), t('useThisDir')))),
4697
+ remote.creating
4698
+ ? h('div', { className: 'rw-browser-actions', style: { padding: '0 8px 8px', gap: 8 } },
4699
+ h('div', { className: 'rw-inline', style: { minWidth: 0, flex: '1 1 auto', flexWrap: 'nowrap' } },
4700
+ h('input', {
4701
+ className: 'rw-input', style: { height: 28, fontSize: 12 }, placeholder: t('folderName'),
4702
+ value: remote.folderName, autoFocus: true,
4703
+ onChange: function (event) { var value = event.currentTarget.value; setRemote(function (previous) { return Object.assign({}, previous, { folderName: value }); }); },
4704
+ onKeyDown: function (event) { if (event.key === 'Enter') createFolder(); },
4705
+ })),
4706
+ h('div', { className: 'rw-actions', style: { flex: 'none' } },
4707
+ h('button', {
4708
+ type: 'button', className: 'rw-btn rw-btn-sm rw-btn-primary',
4709
+ disabled: remote.busy || remote.folderName.trim() === '',
4710
+ onClick: createFolder,
4711
+ }, t('create')),
4712
+ h('button', {
4713
+ type: 'button', className: 'rw-btn rw-btn-sm',
4714
+ onClick: function () { setRemote(function (previous) { return Object.assign({}, previous, { creating: false, folderName: '' }); }); },
4715
+ }, t('cancel'))))
4716
+ : null);
4582
4717
  }
4583
4718
 
4584
4719
  function ScopePathPicker(props) {
@@ -4893,13 +5028,37 @@ function attributeViolation(name, value, tagName) {
4893
5028
  return nodes;
4894
5029
  }
4895
5030
 
5031
+ // Rows are plain buttons, so ↑/↓/Home/End only have to move focus; the
5032
+ // browser keeps the click and Enter behaviour for free.
5033
+ var LIST_KEY_STEP = { ArrowDown: 1, ArrowUp: -1 };
5034
+
5035
+ function handleListKeys(event, container, selector) {
5036
+ if (!container) return false;
5037
+ if (event.ctrlKey || event.metaKey || event.altKey) return false;
5038
+ var step = LIST_KEY_STEP[event.key];
5039
+ var isHome = event.key === 'Home';
5040
+ var isEnd = event.key === 'End';
5041
+ if (step === undefined && !isHome && !isEnd) return false;
5042
+ var rows = Array.prototype.slice.call(container.querySelectorAll(selector));
5043
+ if (rows.length === 0) return false;
5044
+ var index = rows.indexOf(document.activeElement);
5045
+ var next;
5046
+ if (isHome) next = 0;
5047
+ else if (isEnd) next = rows.length - 1;
5048
+ else if (index === -1) next = step > 0 ? 0 : rows.length - 1;
5049
+ else next = Math.min(rows.length - 1, Math.max(0, index + step));
5050
+ event.preventDefault();
5051
+ event.stopPropagation();
5052
+ rows[next].focus();
5053
+ return true;
5054
+ }
5055
+
4896
5056
  function RemoteFileEditor(props) {
4897
5057
  var ctx = props.ctx;
4898
5058
  var t = props.t;
4899
5059
  var locale = props.locale;
4900
5060
  var scope = props.scope;
4901
5061
  var local = props.local === true;
4902
- var readOnly = props.readOnly === true;
4903
5062
  var filePath = props.path;
4904
5063
  var sidebar = sidebarService(ctx);
4905
5064
  var settings = useRuntimeSettings();
@@ -4927,7 +5086,7 @@ function attributeViolation(name, value, tagName) {
4927
5086
  var gutterRef = useRef(null);
4928
5087
  var baseTitle = basename(filePath) || t('fileTabTitle');
4929
5088
  var params = scopeParams(scope);
4930
- var editable = Boolean(load.file && load.file.editable) && !readOnly;
5089
+ var editable = Boolean(load.file && load.file.editable);
4931
5090
 
4932
5091
  var loadFile = useCallback(function () {
4933
5092
  if (!filePath || (!local && !scope)) {
@@ -4952,6 +5111,45 @@ function attributeViolation(name, value, tagName) {
4952
5111
  if (typeof props.onDirtyChange === 'function') props.onDirtyChange(dirty);
4953
5112
  }, [dirty]);
4954
5113
 
5114
+ // A content-search hit opens the file at the matching line: place the
5115
+ // caret on it and centre the row, but only once per (file, line) pair so
5116
+ // typing and saving never yank the viewport back.
5117
+ var jumpedRef = useRef('');
5118
+ useEffect(function () {
5119
+ var target = Number(props.focusLine) || 0;
5120
+ if (target <= 0 || load.loading || load.error || content === '') return undefined;
5121
+ var stamp = filePath + '#' + target;
5122
+ if (jumpedRef.current === stamp) return undefined;
5123
+ // The textarea can mount one commit after the content arrives, so retry
5124
+ // for a few frames instead of giving up on the first pass.
5125
+ var tries = 0;
5126
+ var timers = [];
5127
+ function attempt() {
5128
+ if (jumpedRef.current === stamp) return;
5129
+ var area = textareaRef.current;
5130
+ if (!area) {
5131
+ if (tries < 12) { tries += 1; timers.push(setTimeout(attempt, 40)); }
5132
+ return;
5133
+ }
5134
+ jumpedRef.current = stamp;
5135
+ var lines = String(content).split('\n');
5136
+ var offset = 0;
5137
+ var last = Math.min(Math.max(target - 1, 0), Math.max(lines.length - 1, 0));
5138
+ for (var index = 0; index < last; index += 1) offset += lines[index].length + 1;
5139
+ var end = offset + (lines[last] ? lines[last].length : 0);
5140
+ try {
5141
+ area.focus();
5142
+ area.setSelectionRange(offset, end);
5143
+ } catch (error) { /* not focusable yet */ }
5144
+ var lineHeight = 18;
5145
+ area.scrollTop = Math.max(0, (last - 4) * lineHeight);
5146
+ if (highlightRef.current) highlightRef.current.scrollTop = area.scrollTop;
5147
+ if (gutterRef.current) gutterRef.current.scrollTop = area.scrollTop;
5148
+ }
5149
+ attempt();
5150
+ return function () { timers.forEach(function (timer) { clearTimeout(timer); }); };
5151
+ }, [filePath, props.focusLine, load.loading, load.error, content]);
5152
+
4955
5153
  useEffect(function () {
4956
5154
  if (!sidebar || typeof sidebar.updateTab !== 'function' || !props.tabId) return;
4957
5155
  try {
@@ -4960,7 +5158,7 @@ function attributeViolation(name, value, tagName) {
4960
5158
  }, [dirty, baseTitle]);
4961
5159
 
4962
5160
  function saveFile(force) {
4963
- if (readOnly || !load.file || load.file.binary || load.file.tooLarge || save.saving) return Promise.resolve(false);
5161
+ if (!load.file || load.file.binary || load.file.tooLarge || save.saving) return Promise.resolve(false);
4964
5162
  setSave({ saving: true, conflict: false, error: '', ok: false });
4965
5163
  var payload = local ? { path: filePath, content: content } : Object.assign({ path: filePath, content: content }, params);
4966
5164
  if (!force && load.file && typeof load.file.mtime === 'number') payload.expectedMtime = load.file.mtime;
@@ -5285,7 +5483,7 @@ function attributeViolation(name, value, tagName) {
5285
5483
  h('textarea', {
5286
5484
  ref: textareaRef,
5287
5485
  className: 'rw-textarea',
5288
- readOnly: readOnly || !editable,
5486
+ readOnly: !editable,
5289
5487
  value: content,
5290
5488
  spellCheck: false,
5291
5489
  wrap: 'off',
@@ -5326,9 +5524,7 @@ function attributeViolation(name, value, tagName) {
5326
5524
  h('span', { className: 'rw-status-chip' }, formatBytes(file.size)),
5327
5525
  dirty
5328
5526
  ? h('span', { className: 'rw-status-chip rw-status-warn' }, t('dirty'))
5329
- : readOnly
5330
- ? h('span', { className: 'rw-status-chip rw-status-error' }, t('readOnly'))
5331
- : file.tooLarge || file.truncated || file.binary
5527
+ : file.tooLarge || file.truncated || file.binary
5332
5528
  ? h('span', { className: 'rw-status-chip rw-status-error' }, t('readOnly'))
5333
5529
  : h('span', { className: 'rw-status-chip rw-status-ok' }, theme.label ? (locale === 'zh' ? theme.label.zh : theme.label.en) : theme.id),
5334
5530
  h('span', { className: 'rw-fill', style: { flex: '1 1 auto' } })));
@@ -5530,6 +5726,7 @@ function attributeViolation(name, value, tagName) {
5530
5726
  className: 'rw-tree',
5531
5727
  role: 'tree',
5532
5728
  'aria-label': t('allFiles'),
5729
+ onKeyDown: function (event) { handleListKeys(event, event.currentTarget, '[role="treeitem"]'); },
5533
5730
  onDragOver: function (event) {
5534
5731
  if (!props.onDropOnPath) return;
5535
5732
  event.preventDefault();
@@ -5563,6 +5760,7 @@ function attributeViolation(name, value, tagName) {
5563
5760
  selectedPath: props.selectedPath || '',
5564
5761
  selectedSet: props.selectedPaths && props.selectedPaths.length > 0 ? new Set(props.selectedPaths) : null,
5565
5762
  siblings: rootSiblings,
5763
+ statSide: props.kind || 'remote',
5566
5764
  }));
5567
5765
  }
5568
5766
 
@@ -5675,7 +5873,7 @@ function attributeViolation(name, value, tagName) {
5675
5873
  h('button', {
5676
5874
  type: 'button',
5677
5875
  className: 'rw-icon-btn',
5678
- title: t('transferSelected'),
5876
+ title: props.transferTitle || t('transferSelected'),
5679
5877
  disabled: !props.transferEnabled,
5680
5878
  style: props.transferEnabled ? undefined : { opacity: 0.42, cursor: 'default' },
5681
5879
  onClick: props.transferSelected,
@@ -5692,6 +5890,8 @@ function attributeViolation(name, value, tagName) {
5692
5890
  var t = props.t;
5693
5891
  var locale = props.locale;
5694
5892
  var state = props.state;
5893
+ var contentMode = props.mode === 'content';
5894
+ var resultsRef = useRef(null);
5695
5895
  var groups = [
5696
5896
  { side: 'remote', label: t('remoteTree'), entries: state.remote || [] },
5697
5897
  { side: 'local', label: t('localTree'), entries: props.hasLocal ? state.local || [] : [] },
@@ -5709,26 +5909,46 @@ function attributeViolation(name, value, tagName) {
5709
5909
  });
5710
5910
  }
5711
5911
  var total = groups.reduce(function (sum, group) { return sum + group.entries.length; }, 0);
5712
- return h('div', { className: 'rw-search-results' },
5912
+ // The Host reports *why* it stopped, because "too many results" and "the
5913
+ // search timed out" need different advice from the user.
5914
+ var reasonKey = state.truncatedReason === 'files' ? 'searchTruncatedFiles'
5915
+ : state.truncatedReason === 'bytes' ? 'searchTruncatedBytes'
5916
+ : state.truncatedReason === 'deadline' ? 'searchTruncatedDeadline'
5917
+ : 'searchTruncated';
5918
+ return h('div', {
5919
+ className: 'rw-search-results',
5920
+ ref: resultsRef,
5921
+ onKeyDown: function (event) { handleListKeys(event, resultsRef.current, '.rw-result-row'); },
5922
+ },
5713
5923
  state.error ? h(Banner, { kind: 'error' }, state.error) : null,
5714
5924
  state.loading ? h('div', { className: 'rw-hint-row' }, Spinner(12), t('loading')) : null,
5715
5925
  !state.loading && total === 0 ? h('div', { className: 'rw-hint-row' }, t('searchEmpty')) : null,
5716
- !state.loading && state.truncated ? h('div', { className: 'rw-hint-row' }, t('searchTruncated')) : null,
5926
+ !state.loading && state.truncated ? h('div', { className: 'rw-hint-row' }, t(reasonKey)) : null,
5717
5927
  groups.map(function (group) {
5718
5928
  if (group.entries.length === 0) return null;
5719
5929
  return h('div', { key: group.side, className: 'rw-change-group' },
5720
5930
  h('div', { className: 'rw-change-group-title' }, group.label, h('span', { className: 'rw-change-meta' }, String(group.entries.length))),
5721
5931
  group.entries.map(function (entry) {
5932
+ var line = Number(entry.line) || 0;
5722
5933
  return h('button', {
5723
- key: group.side + ':' + entry.path,
5934
+ key: group.side + ':' + entry.path + ':' + line,
5724
5935
  type: 'button',
5725
- className: 'rw-result-row',
5726
- title: entry.path,
5936
+ className: 'rw-result-row' + (contentMode ? ' is-content' : ''),
5937
+ title: line > 0 ? entry.path + ':' + line : entry.path,
5727
5938
  onClick: function () { props.onOpen(group.side, entry.path, entry); },
5728
5939
  },
5729
- h(FileGlyph, { name: entry.relative || entry.path, size: 13 }),
5730
- h('span', { className: 'rw-change-path' }, entry.relative || entry.path),
5731
- h('span', { className: 'rw-change-meta' }, group.side === 'remote' ? t('sideRemote') : t('sideLocal')));
5940
+ contentMode
5941
+ ? h('span', { className: 'rw-result-head' },
5942
+ h(FileGlyph, { name: entry.relative || entry.path, size: 13 }),
5943
+ h('span', { className: 'rw-change-path' }, entry.relative || entry.path),
5944
+ line > 0 ? h('span', { className: 'rw-result-line' }, ':' + line) : null,
5945
+ h('span', { className: 'rw-change-meta' }, group.side === 'remote' ? t('sideRemote') : t('sideLocal')))
5946
+ : [
5947
+ h(FileGlyph, { name: entry.relative || entry.path, size: 13 }),
5948
+ h('span', { className: 'rw-change-path' }, entry.relative || entry.path),
5949
+ h('span', { className: 'rw-change-meta' }, group.side === 'remote' ? t('sideRemote') : t('sideLocal')),
5950
+ ],
5951
+ contentMode && entry.preview ? h('span', { className: 'rw-result-preview' }, entry.preview) : null);
5732
5952
  }));
5733
5953
  }));
5734
5954
  }
@@ -5878,6 +6098,9 @@ function attributeViolation(name, value, tagName) {
5878
6098
  // Shown once per browser profile: the flag lives in localStorage so the
5879
6099
  // dialog never reopens on refresh, and a fresh DSH install opens it again.
5880
6100
  var WELCOME_KEY = 'dsh-linked-workspace:welcome';
6101
+ // F6: the settings page can replay the card, so the flag is cleared and an
6102
+ // event wakes the overlay instead of the user hunting for local storage.
6103
+ var WELCOME_EVENT = 'dsh-linked-workspace:welcome-open';
5881
6104
 
5882
6105
  function welcomeSeen() {
5883
6106
  try {
@@ -5907,6 +6130,11 @@ function attributeViolation(name, value, tagName) {
5907
6130
  var open = state[0];
5908
6131
  var setOpen = state[1];
5909
6132
  function close() { welcomeRemember(); setOpen(false); }
6133
+ useEffect(function () {
6134
+ function onReplay() { setOpen(true); }
6135
+ window.addEventListener(WELCOME_EVENT, onReplay);
6136
+ return function () { window.removeEventListener(WELCOME_EVENT, onReplay); };
6137
+ }, []);
5910
6138
  useEffect(function () {
5911
6139
  if (!open) return undefined;
5912
6140
  function onKey(event) {
@@ -6023,6 +6251,129 @@ function attributeViolation(name, value, tagName) {
6023
6251
  h('button', { type: 'button', className: 'rw-btn rw-btn-sm rw-btn-danger', onClick: props.onConfirm }, props.confirmLabel)));
6024
6252
  }
6025
6253
 
6254
+ // F2: renaming a dozen files one by one is the slowest thing left in the
6255
+ // tree, so a multi-selection gets a single batch dialog with a live preview.
6256
+ function BatchRenameDialog(props) {
6257
+ var t = props.t;
6258
+ var entries = props.entries || [];
6259
+ var modeState = useState('pattern');
6260
+ var mode = modeState[0];
6261
+ var setMode = modeState[1];
6262
+ var prefixState = useState('');
6263
+ var prefix = prefixState[0];
6264
+ var setPrefix = prefixState[1];
6265
+ var startState = useState('1');
6266
+ var start = startState[0];
6267
+ var setStart = startState[1];
6268
+ var padState = useState('2');
6269
+ var pad = padState[0];
6270
+ var setPad = padState[1];
6271
+ var findState = useState('');
6272
+ var find = findState[0];
6273
+ var setFind = findState[1];
6274
+ var replaceState = useState('');
6275
+ var replaceWith = replaceState[0];
6276
+ var setReplaceWith = replaceState[1];
6277
+ var busyState = useState(false);
6278
+ var busy = busyState[0];
6279
+ var setBusy = busyState[1];
6280
+
6281
+ function splitName(name) {
6282
+ var dot = String(name).lastIndexOf('.');
6283
+ if (dot <= 0) return { base: String(name), ext: '' };
6284
+ return { base: String(name).slice(0, dot), ext: String(name).slice(dot) };
6285
+ }
6286
+
6287
+ var pairs = entries.map(function (entry, index) {
6288
+ var parts = splitName(entry.name);
6289
+ var next = '';
6290
+ if (mode === 'pattern') {
6291
+ var number = String(Number(start || 0) + index).padStart(Math.max(1, Number(pad) || 1), '0');
6292
+ next = prefix + number + (entry.isDir ? '' : parts.ext);
6293
+ } else {
6294
+ next = find === '' ? entry.name : String(entry.name).split(find).join(replaceWith);
6295
+ }
6296
+ return { entry: entry, from: entry.name, to: next };
6297
+ });
6298
+ var seen = {};
6299
+ var conflict = false;
6300
+ var invalid = false;
6301
+ pairs.forEach(function (pair) {
6302
+ if (pair.to === '') invalid = true;
6303
+ if (seen[pair.to]) conflict = true;
6304
+ seen[pair.to] = true;
6305
+ if (pair.to !== pair.from && pairs.some(function (other) { return other.entry.name === pair.to; })) conflict = true;
6306
+ });
6307
+ var changed = pairs.filter(function (pair) { return pair.to !== pair.from; }).length;
6308
+
6309
+ function apply() {
6310
+ if (busy || invalid || conflict || changed === 0) return;
6311
+ setBusy(true);
6312
+ props.onApply(pairs.filter(function (pair) { return pair.to !== pair.from; })).then(function () {
6313
+ setBusy(false);
6314
+ props.onClose();
6315
+ }).catch(function () { setBusy(false); });
6316
+ }
6317
+
6318
+ return h(DialogShell, { title: t('renameManyTitle', { count: entries.length }), onClose: props.onClose },
6319
+ h('div', { className: 'rw-inline', style: { gap: 6, marginBottom: 10 } },
6320
+ h('button', {
6321
+ type: 'button',
6322
+ className: 'rw-chip-btn' + (mode === 'pattern' ? ' is-on' : ''),
6323
+ 'aria-pressed': mode === 'pattern',
6324
+ onClick: function () { setMode('pattern'); },
6325
+ }, t('renameManyPattern')),
6326
+ h('button', {
6327
+ type: 'button',
6328
+ className: 'rw-chip-btn' + (mode === 'replace' ? ' is-on' : ''),
6329
+ 'aria-pressed': mode === 'replace',
6330
+ onClick: function () { setMode('replace'); },
6331
+ }, t('renameManyReplace'))),
6332
+ mode === 'pattern'
6333
+ ? h('div', { className: 'rw-inline', style: { gap: 6, marginBottom: 10 } },
6334
+ h('input', {
6335
+ className: 'rw-input', style: { flex: '2 1 0', minWidth: 0 }, value: prefix,
6336
+ placeholder: t('renameManyPrefix'), 'aria-label': t('renameManyPrefix'),
6337
+ onChange: function (event) { var value = event.currentTarget.value; setPrefix(value); },
6338
+ }),
6339
+ h('input', {
6340
+ className: 'rw-input rw-input-mono', style: { flex: '1 1 0', minWidth: 0 }, value: start,
6341
+ placeholder: t('renameManyStart'), 'aria-label': t('renameManyStart'),
6342
+ onChange: function (event) { var value = event.currentTarget.value; setStart(value.replace(/[^0-9]/g, '')); },
6343
+ }),
6344
+ h('input', {
6345
+ className: 'rw-input rw-input-mono', style: { flex: '1 1 0', minWidth: 0 }, value: pad,
6346
+ placeholder: t('renameManyPad'), 'aria-label': t('renameManyPad'),
6347
+ onChange: function (event) { var value = event.currentTarget.value; setPad(value.replace(/[^0-9]/g, '')); },
6348
+ }))
6349
+ : h('div', { className: 'rw-inline', style: { gap: 6, marginBottom: 10 } },
6350
+ h('input', {
6351
+ className: 'rw-input', style: { flex: '1 1 0', minWidth: 0 }, value: find,
6352
+ placeholder: t('renameManyFind'), 'aria-label': t('renameManyFind'),
6353
+ onChange: function (event) { var value = event.currentTarget.value; setFind(value); },
6354
+ }),
6355
+ h('input', {
6356
+ className: 'rw-input', style: { flex: '1 1 0', minWidth: 0 }, value: replaceWith,
6357
+ placeholder: t('renameManyReplaceWith'), 'aria-label': t('renameManyReplaceWith'),
6358
+ onChange: function (event) { var value = event.currentTarget.value; setReplaceWith(value); },
6359
+ })),
6360
+ h('div', { className: 'rw-rename-preview' }, pairs.slice(0, 50).map(function (pair) {
6361
+ return h('div', { key: pair.entry.path, className: 'rw-rename-row' + (pair.to === '' || seen[pair.to] > 1 ? ' is-bad' : '') },
6362
+ h('span', { className: 'rw-rename-from', title: pair.entry.path }, pair.from),
6363
+ h('span', { className: 'rw-rename-arrow' }, '→'),
6364
+ h('span', { className: 'rw-rename-to' }, pair.to === '' ? t('renameManyEmpty') : pair.to));
6365
+ })),
6366
+ conflict ? h('div', { className: 'rw-dialog-message rw-dialog-error' }, t('renameManyConflict')) : null,
6367
+ h('div', { className: 'rw-dialog-actions' },
6368
+ h('button', { type: 'button', className: 'rw-btn rw-btn-sm', onClick: props.onClose }, t('cancel')),
6369
+ h('button', {
6370
+ type: 'button',
6371
+ className: 'rw-btn rw-btn-sm rw-btn-primary',
6372
+ disabled: busy || invalid || conflict || changed === 0,
6373
+ onClick: apply,
6374
+ }, t(busy ? 'loading' : 'renameManyApply', { count: changed }))));
6375
+ }
6376
+
6026
6377
  function PropertiesDialog(props) {
6027
6378
  return h(DialogShell, { title: props.title, onClose: props.onClose },
6028
6379
  h('div', { className: 'rw-props' }, props.rows.map(function (row) {
@@ -6122,6 +6473,14 @@ function attributeViolation(name, value, tagName) {
6122
6473
  return h('div', { key: entry.id, className: 'rw-queue-row' },
6123
6474
  h('span', { className: 'rw-queue-label', title: entry.path }, entry.label),
6124
6475
  h('span', { className: 'rw-queue-state' }, entry.message || entry.state),
6476
+ entry.state === 'running' && props.onCancel
6477
+ ? h('button', {
6478
+ type: 'button',
6479
+ className: 'rw-btn rw-btn-sm',
6480
+ disabled: Boolean(entry.cancelling),
6481
+ onClick: function () { props.onCancel(entry); },
6482
+ }, props.t('queueCancel'))
6483
+ : null,
6125
6484
  entry.state === 'error' && props.onRetry
6126
6485
  ? h('button', {
6127
6486
  type: 'button',
@@ -6539,7 +6898,16 @@ function attributeViolation(name, value, tagName) {
6539
6898
  var searchModeState = useState('name');
6540
6899
  var searchMode = searchModeState[0];
6541
6900
  var setSearchMode = searchModeState[1];
6542
- var searchState = useState({ loading: false, remote: [], local: [], error: null });
6901
+ var searchCaseState = useState(false);
6902
+ var searchCase = searchCaseState[0];
6903
+ var setSearchCase = searchCaseState[1];
6904
+ var searchRegexState = useState(false);
6905
+ var searchRegex = searchRegexState[0];
6906
+ var setSearchRegex = searchRegexState[1];
6907
+ var searchHereState = useState(false);
6908
+ var searchHere = searchHereState[0];
6909
+ var setSearchHere = searchHereState[1];
6910
+ var searchState = useState({ loading: false, remote: [], local: [], truncated: false, truncatedReason: '', error: null });
6543
6911
  var search = searchState[0];
6544
6912
  var setSearch = searchState[1];
6545
6913
  var gitState = useState({ loading: false, remote: null, local: null, error: null });
@@ -6577,6 +6945,17 @@ function attributeViolation(name, value, tagName) {
6577
6945
  var showHiddenState = useState(true);
6578
6946
  var showHidden = showHiddenState[0];
6579
6947
  var setShowHidden = showHiddenState[1];
6948
+ // A refresh only reloads this bundle, so the running Host may be older.
6949
+ var hostStaleState = useState(false);
6950
+ var hostStale = hostStaleState[0];
6951
+ var setHostStale = hostStaleState[1];
6952
+ useEffect(function () {
6953
+ var alive = true;
6954
+ probeHostInfo().then(function (result) {
6955
+ if (alive && result && result.stale) setHostStale(true);
6956
+ });
6957
+ return function () { alive = false; };
6958
+ }, []);
6580
6959
 
6581
6960
  // Rename tabs persisted before 0.3.0 (type alias keeps the title "远程目录").
6582
6961
  useEffect(function () {
@@ -6839,6 +7218,12 @@ function attributeViolation(name, value, tagName) {
6839
7218
  setOpenFiles(function (previous) {
6840
7219
  var existing = previous.filter(function (file) { return file.key === key; })[0];
6841
7220
  if (existing) {
7221
+ var wanted = Number(opts.line) || 0;
7222
+ if (wanted > 0 && existing.line !== wanted) {
7223
+ // Re-opening the same file from another hit must move the caret,
7224
+ // so the line travels with the tab instead of being dropped.
7225
+ return previous.map(function (file) { return file.key === key ? Object.assign({}, file, { line: wanted, pinned: Boolean(opts.pinned) || file.pinned }) : file; });
7226
+ }
6842
7227
  if (opts.pinned && !existing.pinned) {
6843
7228
  return previous.map(function (file) { return file.key === key ? Object.assign({}, file, { pinned: true }) : file; });
6844
7229
  }
@@ -6851,13 +7236,13 @@ function attributeViolation(name, value, tagName) {
6851
7236
  var active = previous[activeIndex];
6852
7237
  if (!active.pinned && !fileDirty[active.key]) {
6853
7238
  var replaced = previous.slice();
6854
- replaced[activeIndex] = { key: key, side: side, path: filePath, name: basename(filePath), pinned: false };
7239
+ replaced[activeIndex] = { key: key, side: side, path: filePath, name: basename(filePath), pinned: false, line: Number(opts.line) || 0 };
6855
7240
  setFileDirty(function (dirtyMap) { var copy = Object.assign({}, dirtyMap); delete copy[active.key]; return copy; });
6856
7241
  return replaced;
6857
7242
  }
6858
7243
  }
6859
7244
  }
6860
- return previous.concat([{ key: key, side: side, path: filePath, name: basename(filePath), pinned: Boolean(opts.pinned) }]);
7245
+ return previous.concat([{ key: key, side: side, path: filePath, name: basename(filePath), pinned: Boolean(opts.pinned), line: Number(opts.line) || 0 }]);
6861
7246
  });
6862
7247
  setActiveFileKey(key);
6863
7248
  setDirectoryOpen(true);
@@ -7021,10 +7406,13 @@ function attributeViolation(name, value, tagName) {
7021
7406
  function enqueueTransfer(side, filePath, name) {
7022
7407
  var entry = {
7023
7408
  id: String(Date.now()) + Math.random().toString(16).slice(2),
7409
+ jobId: 'job-' + String(Date.now()) + '-' + Math.random().toString(16).slice(2, 8),
7024
7410
  side: side || 'remote',
7025
7411
  path: filePath,
7026
7412
  label: name,
7027
7413
  state: 'queued',
7414
+ files: 0,
7415
+ bytes: 0,
7028
7416
  message: t('queueQueued'),
7029
7417
  };
7030
7418
  queueRef.current = queueRef.current.concat([entry]);
@@ -7032,23 +7420,49 @@ function attributeViolation(name, value, tagName) {
7032
7420
  pumpQueue();
7033
7421
  }
7034
7422
 
7423
+ /** Ask the Host to stop a running transfer after the current file. */
7424
+ function cancelTransfer(entry) {
7425
+ if (!entry || !entry.jobId) return;
7426
+ entry.cancelling = true;
7427
+ entry.message = t('queueCancelling');
7428
+ setQueueList(queueRef.current.slice());
7429
+ apiCall('fs.transferCancel', { jobId: entry.jobId }).catch(function () { /* the transfer may be over */ });
7430
+ }
7431
+
7035
7432
  function pumpQueue() {
7036
7433
  if (queueRunning.current) return;
7037
7434
  var next = queueRef.current.filter(function (entry) { return entry.state === 'queued'; })[0];
7038
7435
  if (!next) return;
7039
7436
  queueRunning.current = true;
7040
7437
  next.state = 'running';
7438
+ next.files = 0;
7439
+ next.bytes = 0;
7041
7440
  next.message = t('queueRunning');
7042
7441
  setQueueList(queueRef.current.slice());
7043
- apiCall('fs.transfer', Object.assign({ side: next.side || 'remote', path: next.path }, scopeParams(scopeRef))).then(function (result) {
7442
+ // Poll the Host while the transfer runs: a folder can take minutes and
7443
+ // the row otherwise sits on “running” with no evidence of progress.
7444
+ var poll = setInterval(function () {
7445
+ apiCall('fs.transferProgress', { jobId: next.jobId }).then(function (result) {
7446
+ var job = result && result.job;
7447
+ if (!job || next.state !== 'running') return;
7448
+ next.files = job.files;
7449
+ next.bytes = job.bytes;
7450
+ next.message = t('queueProgress', { files: job.files, size: formatBytes(job.bytes) });
7451
+ setQueueList(queueRef.current.slice());
7452
+ }).catch(function () { /* progress is best-effort */ });
7453
+ }, 700);
7454
+ apiCall('fs.transfer', Object.assign({ side: next.side || 'remote', path: next.path, jobId: next.jobId }, scopeParams(scopeRef))).then(function (result) {
7044
7455
  next.state = 'done';
7045
7456
  next.message = t('transferDone', { files: result.files, size: formatBytes(result.bytes) }) + (result.truncated ? t('transferTruncated') : '');
7046
7457
  showNotice('success', next.message);
7047
7458
  refreshTree();
7048
7459
  }).catch(function (error) {
7049
- next.state = 'error';
7050
- next.message = messageOf(error, t, locale);
7460
+ var cancelled = error && error.code === 'CANCELLED';
7461
+ next.state = cancelled ? 'cancelled' : 'error';
7462
+ next.message = cancelled ? t('queueCancelled', { files: next.files }) : messageOf(error, t, locale);
7051
7463
  }).then(function () {
7464
+ clearInterval(poll);
7465
+ next.cancelling = false;
7052
7466
  setQueueList(queueRef.current.slice());
7053
7467
  queueRunning.current = false;
7054
7468
  pumpQueue();
@@ -7372,6 +7786,32 @@ function attributeViolation(name, value, tagName) {
7372
7786
  }).catch(noticeError);
7373
7787
  }
7374
7788
 
7789
+ /**
7790
+ * F2: rename sequentially so one failure (a clash on disk) does not leave
7791
+ * the rest half-applied without a word.
7792
+ */
7793
+ function renameManyEntries(side, pairs) {
7794
+ var method = side === 'remote' ? 'fs.rename' : 'local.rename';
7795
+ var done = 0;
7796
+ return pairs.reduce(function (chain, pair) {
7797
+ return chain.then(function () {
7798
+ var target = joinChildPath(parentPathOf(pair.entry.path, side), pair.to, side);
7799
+ var params = side === 'remote'
7800
+ ? Object.assign({ from: pair.entry.path, to: target }, scopeParams(scopeRef))
7801
+ : { from: pair.entry.path, to: target };
7802
+ return apiCall(method, params).then(function () { done += 1; });
7803
+ });
7804
+ }, Promise.resolve()).then(function () {
7805
+ showNotice('success', t('renameManyDone', { count: done }));
7806
+ refreshTree();
7807
+ return done;
7808
+ }).catch(function (error) {
7809
+ if (done > 0) showNotice('success', t('renameManyDone', { count: done }));
7810
+ noticeError(error);
7811
+ throw error;
7812
+ });
7813
+ }
7814
+
7375
7815
  function pathUnder(filePath, parentPath) {
7376
7816
  if (!filePath || !parentPath) return false;
7377
7817
  var normalized = String(filePath).replace(/\\/g, '/').replace(/\/+$/, '');
@@ -7409,23 +7849,19 @@ function attributeViolation(name, value, tagName) {
7409
7849
 
7410
7850
  function buildContextItems(menu) {
7411
7851
  var isRemote = menu.side === 'remote';
7412
- if (remoteOnly) {
7413
- var readOnlyItems = [];
7414
- if (isRemote) readOnlyItems.push({ label: t('ctxDownload'), onSelect: function () { downloadEntry(menu); } });
7415
- if (!menu.isDir) readOnlyItems.push({ label: t('ctxOpen'), onSelect: function () { openByMode(menu.side, menu.path); } });
7416
- readOnlyItems.push({ separator: true });
7417
- readOnlyItems.push({ label: t('ctxCopyPath'), onSelect: function () { copyPathToClipboard(menu.path); } });
7418
- readOnlyItems.push({ separator: true });
7419
- readOnlyItems.push({ label: t('ctxProperties'), onSelect: function () { showProperties(menu.side, menu.path); } });
7420
- return readOnlyItems;
7421
- }
7852
+ // Transfer, compare and the local terminal need a local directory, so
7853
+ // they only show up for a linked workspace; everything else works on
7854
+ // both kinds (a remote workspace just has the remote side).
7855
+ var hasLocal = Boolean(selected && selected.kind === 'linked');
7422
7856
  var canPaste = clipboard !== null && clipboard.side === menu.side && menu.isDir;
7423
7857
  var items = [];
7424
7858
  var batch = multi.filter(function (item) { return item.side === menu.side; });
7425
7859
  if (batch.length > 1) {
7426
- items.push({ label: t('ctxTransferSelected', { count: batch.length }), onSelect: function () {
7427
- batch.forEach(function (item) { enqueueTransfer(item.side, item.path, item.name); });
7428
- } });
7860
+ if (hasLocal) {
7861
+ items.push({ label: t('ctxTransferSelected', { count: batch.length }), onSelect: function () {
7862
+ batch.forEach(function (item) { enqueueTransfer(item.side, item.path, item.name); });
7863
+ } });
7864
+ }
7429
7865
  items.push({ label: t('ctxDeleteSelected', { count: batch.length }), onSelect: deleteSelection });
7430
7866
  if (batch.some(function (item) { return item.path === menu.path; })) {
7431
7867
  items.push({ label: t('ctxMoveSelected', { count: batch.length }), onSelect: function () {
@@ -7434,13 +7870,20 @@ function attributeViolation(name, value, tagName) {
7434
7870
  initialPath: parentPathOf(menu.path, menu.side),
7435
7871
  });
7436
7872
  } });
7873
+ items.push({ label: t('ctxRenameSelected', { count: batch.length }), onSelect: function () {
7874
+ setDialog({ kind: 'renameMany', side: menu.side, entries: batch });
7875
+ } });
7437
7876
  }
7438
7877
  items.push({ separator: true });
7439
7878
  }
7440
7879
  if (isRemote) {
7441
- items.push({ label: t('ctxTransfer'), onSelect: function () { enqueueTransfer('remote', menu.path, menu.name); } });
7880
+ if (hasLocal) {
7881
+ items.push({ label: t('ctxTransfer'), onSelect: function () { enqueueTransfer('remote', menu.path, menu.name); } });
7882
+ }
7442
7883
  items.push({ label: t('ctxDownload'), onSelect: function () { downloadEntry(menu); } });
7443
- items.push({ label: t('ctxQueue'), onSelect: function () { setDialog({ kind: 'queue' }); } });
7884
+ if (hasLocal) {
7885
+ items.push({ label: t('ctxQueue'), onSelect: function () { setDialog({ kind: 'queue' }); } });
7886
+ }
7444
7887
  items.push({ separator: true });
7445
7888
  } else {
7446
7889
  items.push({ label: t('ctxTransferLocal'), onSelect: function () { enqueueTransfer('local', menu.path, menu.name); } });
@@ -7483,7 +7926,7 @@ function attributeViolation(name, value, tagName) {
7483
7926
  items.push({ label: t('ctxTerminalHere'), onSelect: function () { openTerminal(menu.side, menu.path); } });
7484
7927
  items = items.concat(newEntryMenuItems(menu, t, setDialog));
7485
7928
  }
7486
- if (menu.isDir && menu.side === 'remote' && selected && selected.kind === 'linked') {
7929
+ if (menu.isDir && menu.side === 'remote' && hasLocal) {
7487
7930
  items.push({ label: t('ctxCompare'), onSelect: function () { openCompare(menu.path); } });
7488
7931
  }
7489
7932
  items.push({ separator: true });
@@ -7546,6 +7989,7 @@ function attributeViolation(name, value, tagName) {
7546
7989
  setQueueList(queueRef.current.slice());
7547
7990
  },
7548
7991
  onRetry: function (entry) { enqueueTransfer(entry.side, entry.path, entry.label); },
7992
+ onCancel: cancelTransfer,
7549
7993
  });
7550
7994
  }
7551
7995
  if (dialog.kind === 'delete') {
@@ -7594,6 +8038,14 @@ function attributeViolation(name, value, tagName) {
7594
8038
  onPick: function (targetDir) { moveEntries(dialog.side, moveTargets, targetDir); },
7595
8039
  });
7596
8040
  }
8041
+ if (dialog.kind === 'renameMany') {
8042
+ return h(BatchRenameDialog, {
8043
+ t: t,
8044
+ entries: dialog.entries,
8045
+ onClose: function () { setDialog(null); },
8046
+ onApply: function (pairs) { return renameManyEntries(dialog.side, pairs); },
8047
+ });
8048
+ }
7597
8049
  if (dialog.kind === 'closeDirty') {
7598
8050
  return h(ConfirmDialog, {
7599
8051
  t: t,
@@ -7640,26 +8092,50 @@ function attributeViolation(name, value, tagName) {
7640
8092
  return function () { alive = false; };
7641
8093
  }, [mode, selectedKey, version]);
7642
8094
 
8095
+ // F3: when the user ticks “current folder only”, the sweep starts from the
8096
+ // row they have selected (its parent when the row is a file).
8097
+ var searchRootPath = '';
8098
+ if (selected && selected.kind !== 'workspace' && selectedEntry && selectedEntry.side === 'remote' && selected.remotePath) {
8099
+ var entryPath = String(selectedEntry.path || '');
8100
+ var rootPrefix = String(selected.remotePath).replace(/\/+$/, '');
8101
+ if (entryPath === rootPrefix) {
8102
+ searchRootPath = '';
8103
+ } else if (entryPath.indexOf(rootPrefix + '/') === 0) {
8104
+ var inside = entryPath.slice(rootPrefix.length + 1);
8105
+ searchRootPath = selectedEntry.isDir === false ? parentPathOf(inside, 'remote') : inside;
8106
+ }
8107
+ }
8108
+
7643
8109
  useEffect(function () {
7644
8110
  if (!searchOpen) {
7645
- setSearch({ loading: false, remote: [], local: [], error: null });
8111
+ setSearch({ loading: false, remote: [], local: [], truncated: false, truncatedReason: '', error: null });
7646
8112
  return undefined;
7647
8113
  }
7648
8114
  var query = searchQuery.trim();
7649
8115
  if (query.length < 2 || !selected) {
7650
- setSearch({ loading: false, remote: [], local: [], error: null });
8116
+ setSearch({ loading: false, remote: [], local: [], truncated: false, truncatedReason: '', error: null });
7651
8117
  return undefined;
7652
8118
  }
7653
8119
  var alive = true;
7654
8120
  var timer = setTimeout(function () {
7655
- setSearch(function (previous) { return { loading: true, remote: previous.remote, local: previous.local, truncated: false, error: null }; });
8121
+ setSearch(function (previous) { return { loading: true, remote: previous.remote, local: previous.local, truncated: false, truncatedReason: '', error: null }; });
7656
8122
  var scopeNow = sourceScopeOf(selected);
7657
- var method = searchMode === 'content' ? 'fs.grep' : 'fs.search';
7658
- var jobs = [apiCall(method, Object.assign({ side: 'remote', query: query, maxResults: 200 }, scopeParams(scopeNow))).catch(function (error) {
8123
+ var contentMode = searchMode === 'content';
8124
+ var method = contentMode ? 'fs.grep' : 'fs.search';
8125
+ var extra = { side: 'remote', query: query, maxResults: 200 };
8126
+ if (contentMode) {
8127
+ // F3: narrow the sweep to the folder the user is standing in.
8128
+ if (searchHere && searchRootPath !== '') extra.path = searchRootPath;
8129
+ extra.ignoreCase = !searchCase;
8130
+ extra.regex = searchRegex;
8131
+ }
8132
+ var jobs = [apiCall(method, Object.assign(extra, scopeParams(scopeNow))).catch(function (error) {
7659
8133
  return { ok: false, entries: [], error: messageOf(error, t, locale) };
7660
8134
  })];
7661
8135
  if (selected.kind === 'linked') {
7662
- jobs.push(apiCall(method, Object.assign({ side: 'local', query: query, maxResults: 200 }, scopeParams(scopeNow))).catch(function (error) {
8136
+ var localExtra = Object.assign({}, extra, { side: 'local' });
8137
+ if (contentMode) localExtra.ignoreCase = !searchCase;
8138
+ jobs.push(apiCall(method, Object.assign(localExtra, scopeParams(scopeNow))).catch(function (error) {
7663
8139
  return { ok: false, entries: [], error: messageOf(error, t, locale) };
7664
8140
  }));
7665
8141
  } else {
@@ -7672,12 +8148,13 @@ function attributeViolation(name, value, tagName) {
7672
8148
  remote: results[0] && results[0].entries ? results[0].entries : [],
7673
8149
  local: results[1] && results[1].entries ? results[1].entries : [],
7674
8150
  truncated: Boolean((results[0] && results[0].truncated) || (results[1] && results[1].truncated)),
8151
+ truncatedReason: (results[0] && results[0].truncatedReason) || (results[1] && results[1].truncatedReason) || '',
7675
8152
  error: (results[0] && results[0].error) || (results[1] && results[1].error) || null,
7676
8153
  });
7677
8154
  });
7678
8155
  }, 320);
7679
8156
  return function () { alive = false; clearTimeout(timer); };
7680
- }, [searchOpen, searchQuery, selectedKey, version, searchMode]);
8157
+ }, [searchOpen, searchQuery, selectedKey, version, searchMode, searchCase, searchRegex, searchHere]);
7681
8158
 
7682
8159
  if (!selected) {
7683
8160
  return h('div', { className: 'rw-workbench rw-workspace', ref: workbenchRef },
@@ -7692,14 +8169,22 @@ function attributeViolation(name, value, tagName) {
7692
8169
  var info = null;
7693
8170
  if (notice) info = h('div', { className: 'rw-linked-notice' }, h(Banner, { kind: notice.kind }, notice.text));
7694
8171
  else if (data.data.error) info = h('div', { className: 'rw-linked-notice' }, h(Banner, { kind: 'error' }, t('workspacesFailed') + ':' + messageOf(data.data.error, t, locale)));
8172
+ if (hostStale) {
8173
+ var staleNotice = h('div', { className: 'rw-linked-notice' }, h(Banner, { kind: 'warn' }, t('staleHost')));
8174
+ info = info ? h('div', null, staleNotice, info) : staleNotice;
8175
+ }
7695
8176
 
7696
8177
  var body;
7697
8178
  if (searchOpen && searchQuery.trim().length >= 2) {
7698
8179
  body = h(SearchResults, {
7699
8180
  t: t, locale: locale, state: search,
8181
+ mode: searchMode,
7700
8182
  hasLocal: selected.kind === 'linked',
7701
8183
  showHidden: showHidden,
7702
- onOpen: openByMode,
8184
+ onOpen: function (side, filePath, entry) {
8185
+ var line = entry && Number(entry.line) ? Number(entry.line) : 0;
8186
+ openByMode(side, filePath, line > 0 ? { pinned: true, line: line } : undefined);
8187
+ },
7703
8188
  });
7704
8189
  } else if (mode !== 'files') {
7705
8190
  body = h(GitChangesView, {
@@ -7759,6 +8244,10 @@ function attributeViolation(name, value, tagName) {
7759
8244
 
7760
8245
  var activeFile = openFiles.filter(function (file) { return file.key === activeFileKey; })[0] || null;
7761
8246
  var activeDocKind = activeFile ? documentKindOf(activeFile.name) : '';
8247
+ // A hit that carries a line number needs the code view: the document pane
8248
+ // has no caret, so the jump would be lost on Markdown/HTML files.
8249
+ var activeForceCode = Boolean(activeFile && Number(activeFile.line) > 0);
8250
+ if (activeForceCode) activeDocKind = '';
7762
8251
  var contentArea = activeFile
7763
8252
  ? (activeDocKind === 'image'
7764
8253
  ? h(ImagePreview, {
@@ -7799,8 +8288,8 @@ function attributeViolation(name, value, tagName) {
7799
8288
  scope: activeFile.side === 'remote' ? sourceScopeOf(selected) : undefined,
7800
8289
  path: activeFile.path,
7801
8290
  local: activeFile.side === 'local',
7802
- readOnly: remoteOnly,
7803
8291
  hideHeader: true,
8292
+ focusLine: activeFile.line || 0,
7804
8293
  onSaveReady: function (handler) {
7805
8294
  if (handler) saveHandlersRef.current[activeFile.key] = handler;
7806
8295
  else delete saveHandlersRef.current[activeFile.key];
@@ -7832,7 +8321,8 @@ function attributeViolation(name, value, tagName) {
7832
8321
  localEnabled: !remoteOnly && selected.kind === 'linked',
7833
8322
  showHidden: showHidden,
7834
8323
  onToggleHidden: function () { setShowHidden(!showHidden); },
7835
- transferEnabled: !remoteOnly && (multi.length > 0 || Boolean(selectedEntry)),
8324
+ transferEnabled: selected.kind === 'linked' && (multi.length > 0 || Boolean(selectedEntry)),
8325
+ transferTitle: selected.kind === 'linked' ? undefined : t('transferNeedsLinked'),
7836
8326
  transferSelected: function () {
7837
8327
  if (multi.length === 0 && !selectedEntry) {
7838
8328
  showNotice('info', t('selectFirst'));
@@ -7867,7 +8357,42 @@ function attributeViolation(name, value, tagName) {
7867
8357
  spellCheck: false,
7868
8358
  autoFocus: true,
7869
8359
  onChange: function (event) { setSearchQuery(event.currentTarget.value); },
8360
+ onKeyDown: function (event) {
8361
+ if (event.key !== 'ArrowDown') return;
8362
+ // Landing on the first hit without leaving the keyboard is the
8363
+ // whole point of the list shortcuts.
8364
+ var list = document.querySelector('.rw-search-results');
8365
+ var first = list && list.querySelector('.rw-result-row');
8366
+ if (!first) return;
8367
+ event.preventDefault();
8368
+ first.focus();
8369
+ },
7870
8370
  }),
8371
+ searchMode === 'content'
8372
+ ? h('span', { className: 'rw-search-flags' },
8373
+ h('button', {
8374
+ type: 'button',
8375
+ className: 'rw-chip-btn' + (searchCase ? ' is-on' : ''),
8376
+ title: t('searchCase'),
8377
+ 'aria-pressed': searchCase ? 'true' : 'false',
8378
+ onClick: function () { setSearchCase(!searchCase); },
8379
+ }, 'Aa'),
8380
+ h('button', {
8381
+ type: 'button',
8382
+ className: 'rw-chip-btn' + (searchRegex ? ' is-on' : ''),
8383
+ title: t('searchRegex'),
8384
+ 'aria-pressed': searchRegex ? 'true' : 'false',
8385
+ onClick: function () { setSearchRegex(!searchRegex); },
8386
+ }, '.*'),
8387
+ h('button', {
8388
+ type: 'button',
8389
+ className: 'rw-chip-btn' + (searchHere ? ' is-on' : ''),
8390
+ title: searchHere ? t('searchScopeHere') : t('searchScopeAll'),
8391
+ 'aria-pressed': searchHere ? 'true' : 'false',
8392
+ disabled: searchRootPath === '',
8393
+ onClick: function () { setSearchHere(!searchHere); },
8394
+ }, IconFolderTree(11)))
8395
+ : null,
7871
8396
  h('button', {
7872
8397
  type: 'button', className: 'rw-icon-btn', title: t('cancel'),
7873
8398
  onClick: function () { setSearchOpen(false); setSearchQuery(''); },
@@ -7953,6 +8478,39 @@ function attributeViolation(name, value, tagName) {
7953
8478
 
7954
8479
  // ── tree ───────────────────────────────────────────────────────────────
7955
8480
 
8481
+ // F5: the row tooltip shows where a file lives, which is the one thing a
8482
+ // hover cannot tell you about time. One stat per row per 5 s is cheap and
8483
+ // keeps the tree quiet otherwise.
8484
+ var ROW_STAT_TTL_MS = 5000;
8485
+ var rowStatCache = new Map();
8486
+
8487
+ function rowStatKey(side, filePath) {
8488
+ return (side === 'remote' ? 'r:' : 'l:') + filePath;
8489
+ }
8490
+
8491
+ function decorateRowStat(row, side, filePath, scope, t, locale) {
8492
+ if (!row || !filePath) return;
8493
+ var key = rowStatKey(side, filePath);
8494
+ var cached = rowStatCache.get(key);
8495
+ if (cached && Date.now() - cached.at < ROW_STAT_TTL_MS) {
8496
+ row.title = cached.text;
8497
+ return;
8498
+ }
8499
+ row.title = filePath;
8500
+ var method = side === 'remote' ? 'fs.stat' : 'local.stat';
8501
+ var params = side === 'remote'
8502
+ ? Object.assign({ path: filePath }, scopeParams(scope))
8503
+ : { path: filePath };
8504
+ apiCall(method, params).then(function (result) {
8505
+ var stamp = Number(result && result.mtime);
8506
+ var when = stamp > 0 ? new Date(stamp).toLocaleString() : '-';
8507
+ var text = filePath + '\n' + t('rowModifiedAt', { when: when })
8508
+ + (result && result.type === 'dir' ? '' : ' · ' + formatBytes(result && result.size));
8509
+ rowStatCache.set(key, { at: Date.now(), text: text });
8510
+ if (row.isConnected) row.title = text;
8511
+ }).catch(function () { /* a tooltip is not worth a notice */ });
8512
+ }
8513
+
7956
8514
  function TreeDirectory(props) {
7957
8515
  var path = props.path;
7958
8516
  var name = props.name;
@@ -8023,6 +8581,7 @@ function attributeViolation(name, value, tagName) {
8023
8581
  selectedPath: selectedPath,
8024
8582
  selectedSet: props.selectedSet,
8025
8583
  siblings: childSiblings,
8584
+ statSide: props.statSide || 'remote',
8026
8585
  }));
8027
8586
  } else if (child.type === 'file' || child.type === 'symlink') {
8028
8587
  var active = selectedPath === child.path || Boolean(props.selectedSet && props.selectedSet.has(child.path));
@@ -8044,6 +8603,25 @@ function attributeViolation(name, value, tagName) {
8044
8603
  if (event.detail !== 2) onSelect(child.path);
8045
8604
  },
8046
8605
  onDoubleClick: function () { if (onPin) onPin(child.path); },
8606
+ onMouseEnter: function (event) {
8607
+ decorateRowStat(event.currentTarget, props.statSide || 'remote', child.path, source, t, locale);
8608
+ },
8609
+ onKeyDown: function (event) {
8610
+ // ← on a file folds the focus back onto its parent folder,
8611
+ // which is what a file tree is expected to do.
8612
+ if (event.key !== 'ArrowLeft') return;
8613
+ var owner = event.currentTarget.closest('[data-dir-path]');
8614
+ // The folder header is the wrapper's previous sibling, not a
8615
+ // child of it, so look sideways first and fall back inside.
8616
+ var header = owner ? owner.previousElementSibling : null;
8617
+ if (!header || String(header.getAttribute('role')) !== 'treeitem') {
8618
+ header = owner ? owner.querySelector('[data-dir-path]') : null;
8619
+ }
8620
+ if (!header) return;
8621
+ event.preventDefault();
8622
+ event.stopPropagation();
8623
+ header.focus();
8624
+ },
8047
8625
  onContextMenu: function (event) {
8048
8626
  if (!onContextMenu) return;
8049
8627
  event.preventDefault();
@@ -8079,6 +8657,7 @@ function attributeViolation(name, value, tagName) {
8079
8657
  role: 'treeitem',
8080
8658
  'aria-level': depth + 1,
8081
8659
  'aria-expanded': isOpen,
8660
+ 'data-dir-path': path,
8082
8661
  className: 'rw-row' + (selectedPath === path || (props.selectedSet && props.selectedSet.has(path)) ? ' is-active' : ''),
8083
8662
  style: { paddingLeft: 6 + depth * 12 },
8084
8663
  title: path,
@@ -8090,6 +8669,9 @@ function attributeViolation(name, value, tagName) {
8090
8669
  if (onSelectPath) onSelectPath({ path: path, name: name, isDir: true, siblings: props.siblings || [], event: event });
8091
8670
  if (event.detail !== 2) toggle(path);
8092
8671
  },
8672
+ onMouseEnter: function (event) {
8673
+ decorateRowStat(event.currentTarget, props.statSide || 'remote', path, source, t, locale);
8674
+ },
8093
8675
  onKeyDown: function (event) {
8094
8676
  if (event.key === 'ArrowRight' && !isOpen) { event.preventDefault(); toggle(path); }
8095
8677
  else if (event.key === 'ArrowLeft' && isOpen) { event.preventDefault(); toggle(path); }
@@ -8132,7 +8714,9 @@ function attributeViolation(name, value, tagName) {
8132
8714
  h('span', { className: 'rw-chevron' + (isOpen ? ' is-open' : '') }, IconChevron(12)),
8133
8715
  h(FileGlyph, { name: name, dir: true, open: isOpen, size: 13 }),
8134
8716
  h('span', { className: 'rw-row-name' }, name)),
8135
- children);
8717
+ // The wrapper carries the folder path so a child row can walk back up
8718
+ // to the folder that owns it (← from a file focuses its folder).
8719
+ children.length > 0 ? h('div', { className: 'rw-tree-children', 'data-dir-path': path }, children) : null);
8136
8720
  }
8137
8721
 
8138
8722
  function WorkspaceTreeSource(props) {
@@ -8267,7 +8851,14 @@ function attributeViolation(name, value, tagName) {
8267
8851
  + (source.kind === 'linked' ? ' · ' + t('linkedChip') : source.kind === 'remote' ? ' · ' + t('remoteChip') : ''))),
8268
8852
  h(StatusPill, { status: source.status, t: t })),
8269
8853
  open
8270
- ? h('div', { className: 'rw-tree-body', role: 'tree', 'aria-label': source.name },
8854
+ ? h('div', {
8855
+ className: 'rw-tree-body',
8856
+ role: 'tree',
8857
+ 'aria-label': source.name,
8858
+ // D3: ↑/↓/Home/End walk the visible rows; ←/→ are handled per row
8859
+ // (expand/collapse a folder, fold back up from a file).
8860
+ onKeyDown: function (event) { handleListKeys(event, event.currentTarget, '[role="treeitem"]'); },
8861
+ },
8271
8862
  h(TreeDirectory, {
8272
8863
  path: source.remotePath,
8273
8864
  name: '/',
@@ -8282,6 +8873,7 @@ function attributeViolation(name, value, tagName) {
8282
8873
  loadMore: loadMore,
8283
8874
  onSelect: props.onSelect,
8284
8875
  selectedPath: props.selectedPath,
8876
+ statSide: 'remote',
8285
8877
  }))
8286
8878
  : null);
8287
8879
  }
@@ -9469,7 +10061,20 @@ function attributeViolation(name, value, tagName) {
9469
10061
  h('button', {
9470
10062
  type: 'button', className: 'rw-btn' + (adding === 'remote' ? '' : ' rw-btn-primary'),
9471
10063
  onClick: function () { toggleAdding('remote'); },
9472
- }, adding === 'remote' ? IconClose(13) : IconRemoteWorkspace(13), t('createRemote')))),
10064
+ }, adding === 'remote' ? IconClose(13) : IconRemoteWorkspace(13), t('createRemote')),
10065
+ // F6: the welcome card only shows once, so offer a way back to it.
10066
+ h('button', {
10067
+ type: 'button', className: 'rw-btn rw-btn-sm',
10068
+ title: t('welcomeReplay'),
10069
+ onClick: function () {
10070
+ try { if (window.localStorage) window.localStorage.removeItem(WELCOME_KEY); } catch (error) { /* ignore */ }
10071
+ // The card sits under the settings overlay, so close it first.
10072
+ dismissSettingsOverlay();
10073
+ setTimeout(function () {
10074
+ try { window.dispatchEvent(new CustomEvent(WELCOME_EVENT)); } catch (error) { /* ignore */ }
10075
+ }, 60);
10076
+ },
10077
+ }, IconAlert(13), t('welcomeReplay')))),
9473
10078
  !sidebarAvailable ? h(Banner, { kind: 'warn' }, t('needsSidebar')) : null,
9474
10079
  h(ThemeGroup, { t: t, locale: locale }),
9475
10080
  h(EditorSettingsGroup, { t: t, locale: locale }),