dsh-gufa-code 1.3.64 → 1.3.67

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/client.js CHANGED
@@ -16,7 +16,7 @@ const GUFA_NS = 'gufa-code'
16
16
  const G = {}
17
17
  G.NS = GUFA_NS
18
18
  /** 客户端构建标记(排查页面是否加载了新代码时看标题栏) */
19
- G.BUILD = '1.3.64'
19
+ G.BUILD = '1.3.67'
20
20
  G.PANEL_ID = 'gufa-code'
21
21
  /** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
22
22
  G.pendingEntryWorkspace = null
@@ -210,13 +210,13 @@ const DICT_ZH = {
210
210
  'search.preserveCase': '保留大小写(AB)',
211
211
  'search.replaceOne': '替换此匹配',
212
212
  'search.dismiss': '忽略此匹配',
213
+ 'search.dismissFile': '忽略该文件的所有匹配',
213
214
  'search.openInEditor': '在编辑器中打开',
214
215
  'search.stale': '匹配位置已变化,已重新搜索',
215
216
  'search.replacePlaceholder': '替换为…',
216
217
  'search.replaceAll': '全部替换',
217
- 'search.replaceThisFile': '替换此文件',
218
+ 'search.replaceThisFile': '替换该文件所有匹配',
218
219
  'search.replacing': '替换中…',
219
- 'search.replaced': '已替换 {count} 处({files} 个文件)',
220
220
  'search.confirmReplace': '确定替换 {count} 处({files} 个文件)?直接写文件,编辑器撤销无效。',
221
221
  'search.confirmYes': '确定替换',
222
222
  'search.confirmNo': '取消',
@@ -257,11 +257,9 @@ const DICT_ZH = {
257
257
  'git.behindCount': '待拉取',
258
258
  'git.pull': '拉取',
259
259
  'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
260
- 'git.pushDone': '已推送(如需首次建立上游会自动 -u)',
261
260
  'git.discardFile': '还原该文件的改动',
262
261
  'git.autoStageHint': '提交时会自动暂存所有未暂存改动(也可以先手动选择要暂存的文件)',
263
262
  'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
264
- 'git.commitDone': '提交成功',
265
263
  'git.more': '更多操作',
266
264
  'git.viewDiff': '查看改动对比',
267
265
  'git.copyPath': '复制文件路径',
@@ -289,8 +287,6 @@ const DICT_ZH = {
289
287
  'diff.stageFile': '暂存文件',
290
288
  'git.discardAll': '撤销所有未暂存改动',
291
289
  'git.discardConfirm': '再点一次确认撤销(未跟踪文件不会被删除)',
292
- 'git.discardDone': '已撤销所有改动(未跟踪文件保留)',
293
- 'git.pullDone': '拉取完成',
294
290
  'git.committed': '已提交',
295
291
  'git.refresh': '刷新',
296
292
  'git.staged': '已暂存',
@@ -461,13 +457,13 @@ const DICT_EN = {
461
457
  'search.preserveCase': 'Preserve case (AB)',
462
458
  'search.replaceOne': 'Replace this match',
463
459
  'search.dismiss': 'Dismiss this match',
460
+ 'search.dismissFile': 'Dismiss all matches in this file',
464
461
  'search.openInEditor': 'Open in editor',
465
462
  'search.stale': 'Match moved; search refreshed',
466
463
  'search.replacePlaceholder': 'Replace with…',
467
464
  'search.replaceAll': 'Replace all',
468
- 'search.replaceThisFile': 'Replace in this file',
465
+ 'search.replaceThisFile': 'Replace all matches in this file',
469
466
  'search.replacing': 'Replacing…',
470
- 'search.replaced': 'Replaced {count} occurrences ({files} files)',
471
467
  'search.confirmReplace': 'Replace {count} occurrences in {files} files? This writes files directly; editor undo will not work.',
472
468
  'search.confirmYes': 'Replace',
473
469
  'search.confirmNo': 'Cancel',
@@ -508,11 +504,9 @@ const DICT_EN = {
508
504
  'git.behindCount': 'to pull',
509
505
  'git.pull': 'Pull',
510
506
  'git.noUpstreamHint': 'No upstream for this branch yet: click ↑ in the header to push once (auto git push -u)',
511
- 'git.pushDone': 'Pushed',
512
507
  'git.discardFile': 'Revert this file',
513
508
  'git.autoStageHint': 'Committing auto-stages all unstaged changes',
514
509
  'git.commitNeedsMessage': 'Write a commit message first, then press ⌘⇧↵',
515
- 'git.commitDone': 'Committed',
516
510
  'git.more': 'More actions',
517
511
  'git.viewDiff': 'View diff',
518
512
  'git.copyPath': 'Copy file path',
@@ -540,8 +534,6 @@ const DICT_EN = {
540
534
  'diff.stageFile': 'Stage file',
541
535
  'git.discardAll': 'Discard all unstaged changes',
542
536
  'git.discardConfirm': 'Click again to confirm (untracked files are kept)',
543
- 'git.discardDone': 'All changes discarded (untracked files kept)',
544
- 'git.pullDone': 'Pull complete',
545
537
  'git.committed': 'Committed',
546
538
  'git.refresh': 'Refresh',
547
539
  'git.staged': 'Staged',
@@ -1751,7 +1743,6 @@ html[data-platform=darwin][data-fullscreen] .gufa-titlebar{height:44px;padding-l
1751
1743
  .gufa-search-action[data-primary]{background:var(--gufa-accent);border-color:var(--gufa-accent);color:#fff}
1752
1744
  .gufa-search-confirm{margin:6px 8px 0;padding:7px 9px;border-radius:7px;border:1px solid var(--gufa-accent);background:color-mix(in srgb, var(--gufa-accent) 12%, transparent);font-size:11.5px;line-height:1.55;color:var(--gufa-text)}
1753
1745
  .gufa-search-confirm-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:6px}
1754
- .gufa-search-notice{margin:6px 8px 0;padding:5px 9px;border-radius:7px;font-size:11.5px;color:var(--dsw-alias-state-success-primary);border:1px solid color-mix(in srgb, var(--dsw-alias-state-success-primary) 45%, transparent)}
1755
1746
  .gufa-search-error{margin:6px 8px 0;padding:5px 9px;border-radius:7px;font-size:11.5px;color:var(--dsw-alias-state-error-primary);border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 45%, transparent)}
1756
1747
  .gufa-search-file-replace{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-left:2px;border-radius:4px;color:var(--gufa-text-dim);cursor:pointer}
1757
1748
  .gufa-search-file-replace:hover{background:var(--gufa-active);color:var(--gufa-text)}
@@ -1770,6 +1761,10 @@ html[data-platform=darwin][data-fullscreen] .gufa-titlebar{height:44px;padding-l
1770
1761
  .gufa-search-summarybar{display:flex;align-items:center;gap:8px}
1771
1762
  .gufa-search-summarybar .gufa-search-summary{flex:1 1 auto;margin-left:0}
1772
1763
  .gufa-search-summarybar .gufa-search-link{flex:0 0 auto}
1764
+ .gufa-tip{position:fixed;z-index:2147483600;max-width:320px;padding:4px 8px;border-radius:5px;background:#2c2f36;color:#f2f2f2;border:1px solid rgba(255,255,255,.18);font-size:11px;line-height:1.45;white-space:normal;pointer-events:none;box-shadow:0 4px 14px rgba(0,0,0,.4)}
1765
+ .gufa-search-file-dismiss{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-left:2px;border-radius:4px;color:var(--gufa-text-dim);cursor:pointer;opacity:0;transition:opacity .12s ease}
1766
+ .gufa-search-file-head:hover .gufa-search-file-dismiss,.gufa-search-file-head:focus-within .gufa-search-file-dismiss{opacity:1}
1767
+ .gufa-search-file-dismiss:hover{background:var(--gufa-active);color:var(--gufa-text)}
1773
1768
  .gufa-search-link{border:0;background:transparent;color:var(--gufa-accent);font-size:11px;cursor:pointer;padding:0}
1774
1769
  .gufa-search-link:hover{text-decoration:underline}
1775
1770
 
@@ -1889,15 +1884,6 @@ html[data-gufa-ide] .liang-skin-backdrop{display:none!important}
1889
1884
  .gufa-git-sync[data-active]{color:var(--gufa-accent)}
1890
1885
  .gufa-git-sync-count{font-size:10.5px;font-variant-numeric:tabular-nums;min-width:8px;text-align:center}
1891
1886
  .gufa-git-sync[data-active] .gufa-git-sync-count{font-weight:700}
1892
- .gufa-info-banner{display:flex;align-items:center;gap:6px;margin:8px 10px 0;padding:4px 8px;border-radius:6px;font-size:11.5px;
1893
- color:var(--dsw-alias-state-success-primary, #3fa66f);border:1px solid color-mix(in srgb, currentColor 35%, transparent);
1894
- background:color-mix(in srgb, currentColor 10%, transparent)}
1895
- .gufa-toast-success{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:2147483300;
1896
- display:flex;align-items:center;gap:6px;padding:6px 14px;border-radius:999px;font-size:12px;pointer-events:none;
1897
- color:var(--dsw-alias-state-success-primary, #3fb950);
1898
- background:color-mix(in srgb, #3fb950 16%, var(--gufa-solid-overlay-bg, #1c1c1c));
1899
- border:1px solid color-mix(in srgb, #3fb950 50%, transparent);
1900
- box-shadow:0 8px 24px rgba(0,0,0,.35);backdrop-filter:blur(8px)}
1901
1887
  /* 资源管理器:Git 改动状态颜色(M/A/D/R/??) */
1902
1888
  .gufa-tree-row[data-git-status="M"] .gufa-tree-name{color:#e5c07b}
1903
1889
  .gufa-tree-row[data-git-status="A"] .gufa-tree-name{color:#3fb950}
@@ -2217,6 +2203,11 @@ const ICON_PATHS = {
2217
2203
  ['path', { d: 'M12 2.8l1 2.6 2.7.7 2-1.8 2.2 2.2-1.8 2 .7 2.7 2.6 1v3l-2.6 1-.7 2.7 1.8 2-2.2 2.2-2-1.8-2.7.7-1 2.6h-3l-1-2.6-2.7-.7-2 1.8-2.2-2.2 1.8-2-.7-2.7-2.6-1v-3l2.6-1 .7-2.7-1.8-2 2.2-2.2 2 1.8 2.7-.7 1-2.6h3z' }],
2218
2204
  ],
2219
2205
  code: [['path', { d: 'M8.5 6L3 12l5.5 6M15.5 6L21 12l-5.5 6' }]],
2206
+ replace: [
2207
+ ['rect', { x: 7, y: 4.5, width: 12.5, height: 15, rx: 2 }],
2208
+ ['path', { d: 'M3 12h9' }],
2209
+ ['path', { d: 'M9.5 9.5L12 12l-2.5 2.5' }],
2210
+ ],
2220
2211
  search: [['circle', { cx: 11, cy: 11, r: 6.5 }], ['path', { d: 'M16 16l4.5 4.5' }]],
2221
2212
  message: [['path', { d: 'M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9l-5 4V6a1 1 0 0 1 1-1z' }]],
2222
2213
  'panel-right': [['rect', { x: 3, y: 4, width: 18, height: 16, rx: 2 }], ['path', { d: 'M14 4v16' }]],
@@ -7041,7 +7032,6 @@ G.Explorer = function Explorer(props) {
7041
7032
  await loadDir(targetDir)
7042
7033
  await loadDir('')
7043
7034
  props.onChanged?.()
7044
- showNotice(`已粘贴 ${written.length} 个文件到 ${targetDir === '' ? '项目根目录' : targetDir}`)
7045
7035
  } catch (error) {
7046
7036
  showNotice(`粘贴失败:${G.errorText(error)}`)
7047
7037
  }
@@ -7372,7 +7362,7 @@ G.SearchPanel = function SearchPanel(props) {
7372
7362
  const [confirming, setConfirming] = useState(null)
7373
7363
  const [replacing, setReplacing] = useState(false)
7374
7364
  const [replaceError, setReplaceError] = useState('')
7375
- const [notice, setNotice] = useState('')
7365
+ const [tip, setTip] = useState(null)
7376
7366
  const inputRef = useRef(null)
7377
7367
  const requestRef = useRef(0)
7378
7368
 
@@ -7494,7 +7484,6 @@ G.SearchPanel = function SearchPanel(props) {
7494
7484
  if (typeof root !== 'string' || root === '' || replacing) return
7495
7485
  setReplacing(true)
7496
7486
  setReplaceError('')
7497
- setNotice('')
7498
7487
  try {
7499
7488
  await props.onBeforeReplace?.()
7500
7489
  const value = await G.api('fs.replace', payload)
@@ -7504,9 +7493,7 @@ G.SearchPanel = function SearchPanel(props) {
7504
7493
  await runSearch(query)
7505
7494
  return
7506
7495
  }
7507
- const count = Number(value?.replacedCount) || 0
7508
7496
  const files = Array.isArray(value?.replacedFiles) ? value.replacedFiles : []
7509
- setNotice(t('search.replaced', { count, files: files.length }))
7510
7497
  await props.onFilesChanged?.(files)
7511
7498
  setIgnored(new Set())
7512
7499
  await runSearch(query)
@@ -7520,7 +7507,6 @@ G.SearchPanel = function SearchPanel(props) {
7520
7507
  const requestReplaceAll = () => {
7521
7508
  if (view === null || view.total === 0 || replacing) return
7522
7509
  setReplaceError('')
7523
- setNotice('')
7524
7510
  setConfirming({ count: view.total, files: view.files.length })
7525
7511
  }
7526
7512
  const doReplaceAll = () => {
@@ -7561,6 +7547,34 @@ G.SearchPanel = function SearchPanel(props) {
7561
7547
  return next
7562
7548
  })
7563
7549
  }
7550
+ const dismissFile = (file) => {
7551
+ setIgnored((current) => {
7552
+ const next = new Set(current)
7553
+ for (const match of file.matches) next.add(matchKey(file.path, match))
7554
+ return next
7555
+ })
7556
+ }
7557
+ /* 悬停提示:鼠标进入时在图标下方显示一行说明(原生 title 在 WebView 里要等很久,体验差) */
7558
+ const tipProps = (text) => ({
7559
+ onMouseEnter: (event) => {
7560
+ try {
7561
+ const rect = event.currentTarget.getBoundingClientRect()
7562
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
7563
+ } catch {
7564
+ /* ignore */
7565
+ }
7566
+ },
7567
+ onMouseLeave: () => setTip(null),
7568
+ onFocus: (event) => {
7569
+ try {
7570
+ const rect = event.currentTarget.getBoundingClientRect()
7571
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
7572
+ } catch {
7573
+ /* ignore */
7574
+ }
7575
+ },
7576
+ onBlur: () => setTip(null),
7577
+ })
7564
7578
  const openFirst = () => {
7565
7579
  const file = view?.files?.[0]
7566
7580
  const match = file?.matches?.[0]
@@ -7615,15 +7629,31 @@ G.SearchPanel = function SearchPanel(props) {
7615
7629
  className: 'gufa-search-file-replace',
7616
7630
  title: t('search.replaceThisFile'),
7617
7631
  role: 'button',
7632
+ ...tipProps(t('search.replaceThisFile')),
7618
7633
  onClick: (event) => {
7619
7634
  event.stopPropagation()
7620
7635
  event.preventDefault()
7621
7636
  replaceFile(file)
7622
7637
  },
7623
7638
  },
7624
- h(G.Icon, { name: 'pencil', size: 11 }),
7639
+ h(G.Icon, { name: 'replace', size: 12 }),
7625
7640
  )
7626
7641
  : null,
7642
+ h(
7643
+ 'span',
7644
+ {
7645
+ className: 'gufa-search-file-dismiss',
7646
+ title: t('search.dismissFile'),
7647
+ role: 'button',
7648
+ ...tipProps(t('search.dismissFile')),
7649
+ onClick: (event) => {
7650
+ event.stopPropagation()
7651
+ event.preventDefault()
7652
+ dismissFile(file)
7653
+ },
7654
+ },
7655
+ h(G.Icon, { name: 'close', size: 11 }),
7656
+ ),
7627
7657
  ),
7628
7658
  isCollapsed
7629
7659
  ? null
@@ -7655,13 +7685,14 @@ G.SearchPanel = function SearchPanel(props) {
7655
7685
  className: 'gufa-search-row-action',
7656
7686
  title: t('search.replaceOne'),
7657
7687
  role: 'button',
7688
+ ...tipProps(t('search.replaceOne')),
7658
7689
  onClick: (event) => {
7659
7690
  event.stopPropagation()
7660
7691
  event.preventDefault()
7661
7692
  replaceOne(file.path, match)
7662
7693
  },
7663
7694
  },
7664
- h(G.Icon, { name: 'pencil', size: 11 }),
7695
+ h(G.Icon, { name: 'replace', size: 12 }),
7665
7696
  )
7666
7697
  : null,
7667
7698
  h(
@@ -7670,6 +7701,7 @@ G.SearchPanel = function SearchPanel(props) {
7670
7701
  className: 'gufa-search-row-action',
7671
7702
  title: t('search.dismiss'),
7672
7703
  role: 'button',
7704
+ ...tipProps(t('search.dismiss')),
7673
7705
  onClick: (event) => {
7674
7706
  event.stopPropagation()
7675
7707
  event.preventDefault()
@@ -7719,7 +7751,11 @@ G.SearchPanel = function SearchPanel(props) {
7719
7751
  query === ''
7720
7752
  ? null
7721
7753
  : h(G.IconButton, { title: t('search.clear'), onClick: () => { setQuery(''); focusInput() } }, h(G.Icon, { name: 'close', size: 11 })),
7722
- h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
7754
+ h(
7755
+ 'span',
7756
+ { style: { display: 'inline-flex' }, ...tipProps(t('search.replaceToggle')) },
7757
+ h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
7758
+ ),
7723
7759
  ),
7724
7760
  h(
7725
7761
  'div',
@@ -7765,6 +7801,7 @@ G.SearchPanel = function SearchPanel(props) {
7765
7801
  className: 'gufa-search-toggle',
7766
7802
  'data-active': preserveCase ? '' : undefined,
7767
7803
  title: t('search.preserveCase'),
7804
+ ...tipProps(t('search.preserveCase')),
7768
7805
  onClick: () => setPreserveCase((value) => !value),
7769
7806
  }, 'AB'),
7770
7807
  ),
@@ -7832,10 +7869,10 @@ G.SearchPanel = function SearchPanel(props) {
7832
7869
  ),
7833
7870
  )
7834
7871
  : null,
7835
- notice !== '' ? h('div', { className: 'gufa-search-notice' }, notice) : null,
7836
7872
  replaceError !== '' ? h('div', { className: 'gufa-search-error' }, `${t('search.replaceError')}:${replaceError}`) : null,
7837
7873
  ),
7838
7874
  h('div', { className: 'gufa-panel-body gufa-scroll' }, body),
7875
+ tip !== null ? h('div', { className: 'gufa-tip', style: { left: `${tip.left}px`, top: `${tip.top}px` } }, tip.text) : null,
7839
7876
  )
7840
7877
  }
7841
7878
 
@@ -7847,14 +7884,6 @@ G.GitPanel = function GitPanel(props) {
7847
7884
  const [error, setError] = useState('')
7848
7885
  const [pending, setPending] = useState(false)
7849
7886
  const [message, setMessage] = useState('')
7850
- const [info, setInfo] = useState('')
7851
-
7852
- /* 操作结果提示(已推送 / 拉取完成 等)自动消失 */
7853
- useEffect(() => {
7854
- if (info === '') return undefined
7855
- const timer = window.setTimeout(() => setInfo(''), 1500)
7856
- return () => window.clearTimeout(timer)
7857
- }, [info])
7858
7887
  const [discardArmed, setDiscardArmed] = useState(false)
7859
7888
  const [headMenu, setHeadMenu] = useState(null)
7860
7889
  const [rowMenu, setRowMenu] = useState(null)
@@ -7903,7 +7932,6 @@ G.GitPanel = function GitPanel(props) {
7903
7932
  const act = async (fn) => {
7904
7933
  setPending(true)
7905
7934
  setError('')
7906
- setInfo('')
7907
7935
  try {
7908
7936
  await fn()
7909
7937
  await refresh()
@@ -7918,21 +7946,17 @@ G.GitPanel = function GitPanel(props) {
7918
7946
  /* 推送 / 拉取:点 ↑/↓ 直接执行 */
7919
7947
  const push = () => void act(async () => {
7920
7948
  await G.api('git.push', { root })
7921
- setInfo(t('git.pushDone'))
7922
7949
  })
7923
7950
  const pull = () => void act(async () => {
7924
7951
  await G.api('git.pull', { root })
7925
- setInfo(t('git.pullDone'))
7926
7952
  })
7927
7953
 
7928
7954
  /* 推送 / 拉取(新建分支还没有上游时也能直接发布:Host 会自动 -u <remote> <branch>) */
7929
7955
  const pushBranch = () => void act(async () => {
7930
7956
  await G.api('git.push', { root })
7931
- setInfo(t('git.pushDone'))
7932
7957
  })
7933
7958
  const pullBranch = () => void act(async () => {
7934
7959
  await G.api('git.pull', { root })
7935
- setInfo(t('git.pullDone'))
7936
7960
  })
7937
7961
 
7938
7962
  /* 一键撤销所有未暂存改动:第一次点击进入「再点确认」,3 秒后自动取消 */
@@ -7945,7 +7969,6 @@ G.GitPanel = function GitPanel(props) {
7945
7969
  setDiscardArmed(false)
7946
7970
  void act(async () => {
7947
7971
  await G.api('git.discardAll', { root })
7948
- setInfo(t('git.discardDone'))
7949
7972
  })
7950
7973
  }
7951
7974
 
@@ -7954,7 +7977,7 @@ G.GitPanel = function GitPanel(props) {
7954
7977
  if (root === null || pending) return
7955
7978
  const text = typeof message === 'string' ? message.trim() : ''
7956
7979
  if (text === '') {
7957
- setInfo(t('git.commitNeedsMessage'))
7980
+ setError(t('git.commitNeedsMessage'))
7958
7981
  return
7959
7982
  }
7960
7983
  void act(async () => {
@@ -7963,7 +7986,6 @@ G.GitPanel = function GitPanel(props) {
7963
7986
  if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
7964
7987
  await G.api('git.commit', { root, message: text })
7965
7988
  setMessage('')
7966
- setInfo(t('git.commitDone'))
7967
7989
  })
7968
7990
  }
7969
7991
  commitRef.current = commit
@@ -8085,7 +8107,6 @@ G.GitPanel = function GitPanel(props) {
8085
8107
  'div',
8086
8108
  { className: 'gufa-panel-body gufa-scroll', style: { display: 'flex', flexDirection: 'column' } },
8087
8109
  error !== '' ? h('div', { className: 'gufa-error-banner' }, G.Icon ? h(G.Icon, { name: 'warn', size: 13 }) : null, error) : null,
8088
- info !== '' ? h('div', { className: 'gufa-info-banner' }, info) : null,
8089
8110
  !root
8090
8111
  ? h(G.Empty, { icon: 'git', title: t('explorer.openProjectFirst') })
8091
8112
  : status === null
@@ -10610,7 +10631,6 @@ G.GufaApp = function GufaApp(props) {
10610
10631
  const [modal, setModal] = useState(null)
10611
10632
  const [shortcutsOpen, setShortcutsOpen] = useState(false)
10612
10633
  const [trashUndo, setTrashUndo] = useState([])
10613
- const [bannerTone, setBannerTone] = useState('error')
10614
10634
  const [branchMenu, setBranchMenu] = useState(null)
10615
10635
  const [workspaceDialog, setWorkspaceDialog] = useState(null)
10616
10636
  const [workspaceSessions, setWorkspaceSessions] = useState({ status: 'idle', sessions: [], groups: [], sessionIds: [], archivedSessionIds: [] })
@@ -10993,28 +11013,11 @@ G.GufaApp = function GufaApp(props) {
10993
11013
  void refreshGit()
10994
11014
  }, [project, patchTab, refreshGit])
10995
11015
 
10996
- /** 顶栏提示:错误常驻红色;成功用绿色 toast,1.2 秒后自动消失。 */
10997
- const successTimerRef = useRef(null)
11016
+ /** 顶栏提示:只显示错误/需要用户处理的提示;成功类操作直接看界面结果,不再弹 toast。 */
10998
11017
  const showBanner = useCallback((text, tone) => {
10999
- if (successTimerRef.current !== null) {
11000
- window.clearTimeout(successTimerRef.current)
11001
- successTimerRef.current = null
11002
- }
11003
- if (tone === 'success') {
11004
- setBannerTone('success')
11005
- setBanner(text)
11006
- successTimerRef.current = window.setTimeout(() => {
11007
- successTimerRef.current = null
11008
- setBanner('')
11009
- }, 1200)
11010
- return
11011
- }
11012
- setBannerTone('error')
11018
+ if (tone === 'success') return
11013
11019
  setBanner(text)
11014
11020
  }, [])
11015
- useEffect(() => () => {
11016
- if (successTimerRef.current !== null) window.clearTimeout(successTimerRef.current)
11017
- }, [])
11018
11021
 
11019
11022
  const closeTab = useCallback((path) => {
11020
11023
  editorBuffersRef.current.delete(path)
@@ -11142,7 +11145,6 @@ G.GufaApp = function GufaApp(props) {
11142
11145
  try {
11143
11146
  await G.api('git.checkout', { root: project.root, branch: name })
11144
11147
  closeBranchMenu()
11145
- showBanner(`已切换到分支 ${name}`, 'success')
11146
11148
  setGitRefreshToken((token) => token + 1)
11147
11149
  setRefreshToken((token) => token + 1)
11148
11150
  void refreshGit()
@@ -11158,7 +11160,6 @@ G.GufaApp = function GufaApp(props) {
11158
11160
  try {
11159
11161
  await G.api('git.createBranch', { root: project.root, name })
11160
11162
  closeBranchMenu()
11161
- showBanner(`已创建并切换到分支 ${name}`, 'success')
11162
11163
  setGitRefreshToken((token) => token + 1)
11163
11164
  setRefreshToken((token) => token + 1)
11164
11165
  void refreshGit()
@@ -11322,7 +11323,6 @@ G.GufaApp = function GufaApp(props) {
11322
11323
  if (project === null) return
11323
11324
  try {
11324
11325
  await G.api('git.discard', { root: project.root, paths: [path] })
11325
- showBanner('已还原该文件的改动', 'success')
11326
11326
  // 改动已还原:关掉该 diff 标签(内容已与暂存区一致)
11327
11327
  setTabs((current) => current.filter((tab) => tab.path !== path))
11328
11328
  setActivePath((current) => (current === path ? null : current))
@@ -11338,7 +11338,6 @@ G.GufaApp = function GufaApp(props) {
11338
11338
  if (project === null) return
11339
11339
  try {
11340
11340
  await G.api('git.stage', { root: project.root, paths: [path] })
11341
- showBanner('已暂存该文件', 'success')
11342
11341
  setGitRefreshToken((token) => token + 1)
11343
11342
  void refreshGit()
11344
11343
  } catch (error) {
@@ -11823,7 +11822,6 @@ G.GufaApp = function GufaApp(props) {
11823
11822
  const missingSet = new Set(missing)
11824
11823
  setTabs((current) => current.filter((tab) => tab !== null && !missingSet.has(tab.path)))
11825
11824
  setActivePath((current) => (current !== null && missingSet.has(current) ? null : current))
11826
- showBanner(`已关闭 ${missing.length} 个已删除文件的标签`, 'success')
11827
11825
  }, [project, tabs, showBanner])
11828
11826
  const pruneMissingTabsRef = useRef(null)
11829
11827
  pruneMissingTabsRef.current = pruneMissingTabs
@@ -11993,7 +11991,6 @@ G.GufaApp = function GufaApp(props) {
11993
11991
  await openProjectPath(workspace.path)
11994
11992
  }
11995
11993
  closeWorkspaceDialog()
11996
- showBanner(`已切换到工作区 ${workspace.title || workspace.path || ''}`, 'success')
11997
11994
  } catch (error) {
11998
11995
  setWorkspaceDialog((current) => (current === null ? current : { ...current, error: G.errorText(error) }))
11999
11996
  }
@@ -12024,7 +12021,6 @@ G.GufaApp = function GufaApp(props) {
12024
12021
  }
12025
12022
  await openProjectPath(directory)
12026
12023
  closeWorkspaceDialog()
12027
- showBanner('已创建工作区', 'success')
12028
12024
  } catch (error) {
12029
12025
  setBanner(G.errorText(error))
12030
12026
  } finally {
@@ -12801,10 +12797,7 @@ G.GufaApp = function GufaApp(props) {
12801
12797
  h(
12802
12798
  'div',
12803
12799
  { className: 'gufa-editor-area' },
12804
- banner !== '' && bannerTone === 'success'
12805
- ? h('div', { className: 'gufa-toast-success' }, h(G.Icon, { name: 'check', size: 13 }), h('span', null, banner))
12806
- : null,
12807
- banner !== '' && bannerTone !== 'success'
12800
+ banner !== ''
12808
12801
  ? h(
12809
12802
  'div',
12810
12803
  { className: 'gufa-error-banner' },
@@ -7,8 +7,8 @@
7
7
  <key>CFBundleDisplayName</key><string>古法编程悬浮层</string>
8
8
  <key>CFBundleExecutable</key><string>gufa-float</string>
9
9
  <key>CFBundlePackageType</key><string>APPL</string>
10
- <key>CFBundleShortVersionString</key><string>1.3.64</string>
11
- <key>CFBundleVersion</key><string>1.3.64</string>
10
+ <key>CFBundleShortVersionString</key><string>1.3.67</string>
11
+ <key>CFBundleVersion</key><string>1.3.67</string>
12
12
  <key>LSUIElement</key><true/>
13
13
  <key>NSHighResolutionCapable</key><true/>
14
14
  <key>NSPrincipalClass</key><string>NSApplication</string>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.3.64",
3
+ "version": "1.3.67",
4
4
  "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
@@ -202,13 +202,13 @@ const DICT_ZH = {
202
202
  'search.preserveCase': '保留大小写(AB)',
203
203
  'search.replaceOne': '替换此匹配',
204
204
  'search.dismiss': '忽略此匹配',
205
+ 'search.dismissFile': '忽略该文件的所有匹配',
205
206
  'search.openInEditor': '在编辑器中打开',
206
207
  'search.stale': '匹配位置已变化,已重新搜索',
207
208
  'search.replacePlaceholder': '替换为…',
208
209
  'search.replaceAll': '全部替换',
209
- 'search.replaceThisFile': '替换此文件',
210
+ 'search.replaceThisFile': '替换该文件所有匹配',
210
211
  'search.replacing': '替换中…',
211
- 'search.replaced': '已替换 {count} 处({files} 个文件)',
212
212
  'search.confirmReplace': '确定替换 {count} 处({files} 个文件)?直接写文件,编辑器撤销无效。',
213
213
  'search.confirmYes': '确定替换',
214
214
  'search.confirmNo': '取消',
@@ -249,11 +249,9 @@ const DICT_ZH = {
249
249
  'git.behindCount': '待拉取',
250
250
  'git.pull': '拉取',
251
251
  'git.noUpstreamHint': '当前分支还没有上游:点标题栏 ↑ 推送一次即可自动创建上游(git push -u)',
252
- 'git.pushDone': '已推送(如需首次建立上游会自动 -u)',
253
252
  'git.discardFile': '还原该文件的改动',
254
253
  'git.autoStageHint': '提交时会自动暂存所有未暂存改动(也可以先手动选择要暂存的文件)',
255
254
  'git.commitNeedsMessage': '请先填写提交信息,再按 ⌘⇧↵ 提交',
256
- 'git.commitDone': '提交成功',
257
255
  'git.more': '更多操作',
258
256
  'git.viewDiff': '查看改动对比',
259
257
  'git.copyPath': '复制文件路径',
@@ -281,8 +279,6 @@ const DICT_ZH = {
281
279
  'diff.stageFile': '暂存文件',
282
280
  'git.discardAll': '撤销所有未暂存改动',
283
281
  'git.discardConfirm': '再点一次确认撤销(未跟踪文件不会被删除)',
284
- 'git.discardDone': '已撤销所有改动(未跟踪文件保留)',
285
- 'git.pullDone': '拉取完成',
286
282
  'git.committed': '已提交',
287
283
  'git.refresh': '刷新',
288
284
  'git.staged': '已暂存',
@@ -453,13 +449,13 @@ const DICT_EN = {
453
449
  'search.preserveCase': 'Preserve case (AB)',
454
450
  'search.replaceOne': 'Replace this match',
455
451
  'search.dismiss': 'Dismiss this match',
452
+ 'search.dismissFile': 'Dismiss all matches in this file',
456
453
  'search.openInEditor': 'Open in editor',
457
454
  'search.stale': 'Match moved; search refreshed',
458
455
  'search.replacePlaceholder': 'Replace with…',
459
456
  'search.replaceAll': 'Replace all',
460
- 'search.replaceThisFile': 'Replace in this file',
457
+ 'search.replaceThisFile': 'Replace all matches in this file',
461
458
  'search.replacing': 'Replacing…',
462
- 'search.replaced': 'Replaced {count} occurrences ({files} files)',
463
459
  'search.confirmReplace': 'Replace {count} occurrences in {files} files? This writes files directly; editor undo will not work.',
464
460
  'search.confirmYes': 'Replace',
465
461
  'search.confirmNo': 'Cancel',
@@ -500,11 +496,9 @@ const DICT_EN = {
500
496
  'git.behindCount': 'to pull',
501
497
  'git.pull': 'Pull',
502
498
  'git.noUpstreamHint': 'No upstream for this branch yet: click ↑ in the header to push once (auto git push -u)',
503
- 'git.pushDone': 'Pushed',
504
499
  'git.discardFile': 'Revert this file',
505
500
  'git.autoStageHint': 'Committing auto-stages all unstaged changes',
506
501
  'git.commitNeedsMessage': 'Write a commit message first, then press ⌘⇧↵',
507
- 'git.commitDone': 'Committed',
508
502
  'git.more': 'More actions',
509
503
  'git.viewDiff': 'View diff',
510
504
  'git.copyPath': 'Copy file path',
@@ -532,8 +526,6 @@ const DICT_EN = {
532
526
  'diff.stageFile': 'Stage file',
533
527
  'git.discardAll': 'Discard all unstaged changes',
534
528
  'git.discardConfirm': 'Click again to confirm (untracked files are kept)',
535
- 'git.discardDone': 'All changes discarded (untracked files kept)',
536
- 'git.pullDone': 'Pull complete',
537
529
  'git.committed': 'Committed',
538
530
  'git.refresh': 'Refresh',
539
531
  'git.staged': 'Staged',
@@ -1743,7 +1735,6 @@ html[data-platform=darwin][data-fullscreen] .gufa-titlebar{height:44px;padding-l
1743
1735
  .gufa-search-action[data-primary]{background:var(--gufa-accent);border-color:var(--gufa-accent);color:#fff}
1744
1736
  .gufa-search-confirm{margin:6px 8px 0;padding:7px 9px;border-radius:7px;border:1px solid var(--gufa-accent);background:color-mix(in srgb, var(--gufa-accent) 12%, transparent);font-size:11.5px;line-height:1.55;color:var(--gufa-text)}
1745
1737
  .gufa-search-confirm-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:6px}
1746
- .gufa-search-notice{margin:6px 8px 0;padding:5px 9px;border-radius:7px;font-size:11.5px;color:var(--dsw-alias-state-success-primary);border:1px solid color-mix(in srgb, var(--dsw-alias-state-success-primary) 45%, transparent)}
1747
1738
  .gufa-search-error{margin:6px 8px 0;padding:5px 9px;border-radius:7px;font-size:11.5px;color:var(--dsw-alias-state-error-primary);border:1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 45%, transparent)}
1748
1739
  .gufa-search-file-replace{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-left:2px;border-radius:4px;color:var(--gufa-text-dim);cursor:pointer}
1749
1740
  .gufa-search-file-replace:hover{background:var(--gufa-active);color:var(--gufa-text)}
@@ -1762,6 +1753,10 @@ html[data-platform=darwin][data-fullscreen] .gufa-titlebar{height:44px;padding-l
1762
1753
  .gufa-search-summarybar{display:flex;align-items:center;gap:8px}
1763
1754
  .gufa-search-summarybar .gufa-search-summary{flex:1 1 auto;margin-left:0}
1764
1755
  .gufa-search-summarybar .gufa-search-link{flex:0 0 auto}
1756
+ .gufa-tip{position:fixed;z-index:2147483600;max-width:320px;padding:4px 8px;border-radius:5px;background:#2c2f36;color:#f2f2f2;border:1px solid rgba(255,255,255,.18);font-size:11px;line-height:1.45;white-space:normal;pointer-events:none;box-shadow:0 4px 14px rgba(0,0,0,.4)}
1757
+ .gufa-search-file-dismiss{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-left:2px;border-radius:4px;color:var(--gufa-text-dim);cursor:pointer;opacity:0;transition:opacity .12s ease}
1758
+ .gufa-search-file-head:hover .gufa-search-file-dismiss,.gufa-search-file-head:focus-within .gufa-search-file-dismiss{opacity:1}
1759
+ .gufa-search-file-dismiss:hover{background:var(--gufa-active);color:var(--gufa-text)}
1765
1760
  .gufa-search-link{border:0;background:transparent;color:var(--gufa-accent);font-size:11px;cursor:pointer;padding:0}
1766
1761
  .gufa-search-link:hover{text-decoration:underline}
1767
1762
 
@@ -1881,15 +1876,6 @@ html[data-gufa-ide] .liang-skin-backdrop{display:none!important}
1881
1876
  .gufa-git-sync[data-active]{color:var(--gufa-accent)}
1882
1877
  .gufa-git-sync-count{font-size:10.5px;font-variant-numeric:tabular-nums;min-width:8px;text-align:center}
1883
1878
  .gufa-git-sync[data-active] .gufa-git-sync-count{font-weight:700}
1884
- .gufa-info-banner{display:flex;align-items:center;gap:6px;margin:8px 10px 0;padding:4px 8px;border-radius:6px;font-size:11.5px;
1885
- color:var(--dsw-alias-state-success-primary, #3fa66f);border:1px solid color-mix(in srgb, currentColor 35%, transparent);
1886
- background:color-mix(in srgb, currentColor 10%, transparent)}
1887
- .gufa-toast-success{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:2147483300;
1888
- display:flex;align-items:center;gap:6px;padding:6px 14px;border-radius:999px;font-size:12px;pointer-events:none;
1889
- color:var(--dsw-alias-state-success-primary, #3fb950);
1890
- background:color-mix(in srgb, #3fb950 16%, var(--gufa-solid-overlay-bg, #1c1c1c));
1891
- border:1px solid color-mix(in srgb, #3fb950 50%, transparent);
1892
- box-shadow:0 8px 24px rgba(0,0,0,.35);backdrop-filter:blur(8px)}
1893
1879
  /* 资源管理器:Git 改动状态颜色(M/A/D/R/??) */
1894
1880
  .gufa-tree-row[data-git-status="M"] .gufa-tree-name{color:#e5c07b}
1895
1881
  .gufa-tree-row[data-git-status="A"] .gufa-tree-name{color:#3fb950}
@@ -74,6 +74,11 @@ const ICON_PATHS = {
74
74
  ['path', { d: 'M12 2.8l1 2.6 2.7.7 2-1.8 2.2 2.2-1.8 2 .7 2.7 2.6 1v3l-2.6 1-.7 2.7 1.8 2-2.2 2.2-2-1.8-2.7.7-1 2.6h-3l-1-2.6-2.7-.7-2 1.8-2.2-2.2 1.8-2-.7-2.7-2.6-1v-3l2.6-1 .7-2.7-1.8-2 2.2-2.2 2 1.8 2.7-.7 1-2.6h3z' }],
75
75
  ],
76
76
  code: [['path', { d: 'M8.5 6L3 12l5.5 6M15.5 6L21 12l-5.5 6' }]],
77
+ replace: [
78
+ ['rect', { x: 7, y: 4.5, width: 12.5, height: 15, rx: 2 }],
79
+ ['path', { d: 'M3 12h9' }],
80
+ ['path', { d: 'M9.5 9.5L12 12l-2.5 2.5' }],
81
+ ],
77
82
  search: [['circle', { cx: 11, cy: 11, r: 6.5 }], ['path', { d: 'M16 16l4.5 4.5' }]],
78
83
  message: [['path', { d: 'M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9l-5 4V6a1 1 0 0 1 1-1z' }]],
79
84
  'panel-right': [['rect', { x: 3, y: 4, width: 18, height: 16, rx: 2 }], ['path', { d: 'M14 4v16' }]],
@@ -199,7 +199,6 @@ G.Explorer = function Explorer(props) {
199
199
  await loadDir(targetDir)
200
200
  await loadDir('')
201
201
  props.onChanged?.()
202
- showNotice(`已粘贴 ${written.length} 个文件到 ${targetDir === '' ? '项目根目录' : targetDir}`)
203
202
  } catch (error) {
204
203
  showNotice(`粘贴失败:${G.errorText(error)}`)
205
204
  }
@@ -530,7 +529,7 @@ G.SearchPanel = function SearchPanel(props) {
530
529
  const [confirming, setConfirming] = useState(null)
531
530
  const [replacing, setReplacing] = useState(false)
532
531
  const [replaceError, setReplaceError] = useState('')
533
- const [notice, setNotice] = useState('')
532
+ const [tip, setTip] = useState(null)
534
533
  const inputRef = useRef(null)
535
534
  const requestRef = useRef(0)
536
535
 
@@ -652,7 +651,6 @@ G.SearchPanel = function SearchPanel(props) {
652
651
  if (typeof root !== 'string' || root === '' || replacing) return
653
652
  setReplacing(true)
654
653
  setReplaceError('')
655
- setNotice('')
656
654
  try {
657
655
  await props.onBeforeReplace?.()
658
656
  const value = await G.api('fs.replace', payload)
@@ -662,9 +660,7 @@ G.SearchPanel = function SearchPanel(props) {
662
660
  await runSearch(query)
663
661
  return
664
662
  }
665
- const count = Number(value?.replacedCount) || 0
666
663
  const files = Array.isArray(value?.replacedFiles) ? value.replacedFiles : []
667
- setNotice(t('search.replaced', { count, files: files.length }))
668
664
  await props.onFilesChanged?.(files)
669
665
  setIgnored(new Set())
670
666
  await runSearch(query)
@@ -678,7 +674,6 @@ G.SearchPanel = function SearchPanel(props) {
678
674
  const requestReplaceAll = () => {
679
675
  if (view === null || view.total === 0 || replacing) return
680
676
  setReplaceError('')
681
- setNotice('')
682
677
  setConfirming({ count: view.total, files: view.files.length })
683
678
  }
684
679
  const doReplaceAll = () => {
@@ -719,6 +714,34 @@ G.SearchPanel = function SearchPanel(props) {
719
714
  return next
720
715
  })
721
716
  }
717
+ const dismissFile = (file) => {
718
+ setIgnored((current) => {
719
+ const next = new Set(current)
720
+ for (const match of file.matches) next.add(matchKey(file.path, match))
721
+ return next
722
+ })
723
+ }
724
+ /* 悬停提示:鼠标进入时在图标下方显示一行说明(原生 title 在 WebView 里要等很久,体验差) */
725
+ const tipProps = (text) => ({
726
+ onMouseEnter: (event) => {
727
+ try {
728
+ const rect = event.currentTarget.getBoundingClientRect()
729
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
730
+ } catch {
731
+ /* ignore */
732
+ }
733
+ },
734
+ onMouseLeave: () => setTip(null),
735
+ onFocus: (event) => {
736
+ try {
737
+ const rect = event.currentTarget.getBoundingClientRect()
738
+ setTip({ text, left: Math.min(rect.left, window.innerWidth - 330), top: Math.min(rect.bottom + 6, window.innerHeight - 40) })
739
+ } catch {
740
+ /* ignore */
741
+ }
742
+ },
743
+ onBlur: () => setTip(null),
744
+ })
722
745
  const openFirst = () => {
723
746
  const file = view?.files?.[0]
724
747
  const match = file?.matches?.[0]
@@ -773,15 +796,31 @@ G.SearchPanel = function SearchPanel(props) {
773
796
  className: 'gufa-search-file-replace',
774
797
  title: t('search.replaceThisFile'),
775
798
  role: 'button',
799
+ ...tipProps(t('search.replaceThisFile')),
776
800
  onClick: (event) => {
777
801
  event.stopPropagation()
778
802
  event.preventDefault()
779
803
  replaceFile(file)
780
804
  },
781
805
  },
782
- h(G.Icon, { name: 'pencil', size: 11 }),
806
+ h(G.Icon, { name: 'replace', size: 12 }),
783
807
  )
784
808
  : null,
809
+ h(
810
+ 'span',
811
+ {
812
+ className: 'gufa-search-file-dismiss',
813
+ title: t('search.dismissFile'),
814
+ role: 'button',
815
+ ...tipProps(t('search.dismissFile')),
816
+ onClick: (event) => {
817
+ event.stopPropagation()
818
+ event.preventDefault()
819
+ dismissFile(file)
820
+ },
821
+ },
822
+ h(G.Icon, { name: 'close', size: 11 }),
823
+ ),
785
824
  ),
786
825
  isCollapsed
787
826
  ? null
@@ -813,13 +852,14 @@ G.SearchPanel = function SearchPanel(props) {
813
852
  className: 'gufa-search-row-action',
814
853
  title: t('search.replaceOne'),
815
854
  role: 'button',
855
+ ...tipProps(t('search.replaceOne')),
816
856
  onClick: (event) => {
817
857
  event.stopPropagation()
818
858
  event.preventDefault()
819
859
  replaceOne(file.path, match)
820
860
  },
821
861
  },
822
- h(G.Icon, { name: 'pencil', size: 11 }),
862
+ h(G.Icon, { name: 'replace', size: 12 }),
823
863
  )
824
864
  : null,
825
865
  h(
@@ -828,6 +868,7 @@ G.SearchPanel = function SearchPanel(props) {
828
868
  className: 'gufa-search-row-action',
829
869
  title: t('search.dismiss'),
830
870
  role: 'button',
871
+ ...tipProps(t('search.dismiss')),
831
872
  onClick: (event) => {
832
873
  event.stopPropagation()
833
874
  event.preventDefault()
@@ -877,7 +918,11 @@ G.SearchPanel = function SearchPanel(props) {
877
918
  query === ''
878
919
  ? null
879
920
  : h(G.IconButton, { title: t('search.clear'), onClick: () => { setQuery(''); focusInput() } }, h(G.Icon, { name: 'close', size: 11 })),
880
- h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
921
+ h(
922
+ 'span',
923
+ { style: { display: 'inline-flex' }, ...tipProps(t('search.replaceToggle')) },
924
+ h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
925
+ ),
881
926
  ),
882
927
  h(
883
928
  'div',
@@ -923,6 +968,7 @@ G.SearchPanel = function SearchPanel(props) {
923
968
  className: 'gufa-search-toggle',
924
969
  'data-active': preserveCase ? '' : undefined,
925
970
  title: t('search.preserveCase'),
971
+ ...tipProps(t('search.preserveCase')),
926
972
  onClick: () => setPreserveCase((value) => !value),
927
973
  }, 'AB'),
928
974
  ),
@@ -990,10 +1036,10 @@ G.SearchPanel = function SearchPanel(props) {
990
1036
  ),
991
1037
  )
992
1038
  : null,
993
- notice !== '' ? h('div', { className: 'gufa-search-notice' }, notice) : null,
994
1039
  replaceError !== '' ? h('div', { className: 'gufa-search-error' }, `${t('search.replaceError')}:${replaceError}`) : null,
995
1040
  ),
996
1041
  h('div', { className: 'gufa-panel-body gufa-scroll' }, body),
1042
+ tip !== null ? h('div', { className: 'gufa-tip', style: { left: `${tip.left}px`, top: `${tip.top}px` } }, tip.text) : null,
997
1043
  )
998
1044
  }
999
1045
 
@@ -1005,14 +1051,6 @@ G.GitPanel = function GitPanel(props) {
1005
1051
  const [error, setError] = useState('')
1006
1052
  const [pending, setPending] = useState(false)
1007
1053
  const [message, setMessage] = useState('')
1008
- const [info, setInfo] = useState('')
1009
-
1010
- /* 操作结果提示(已推送 / 拉取完成 等)自动消失 */
1011
- useEffect(() => {
1012
- if (info === '') return undefined
1013
- const timer = window.setTimeout(() => setInfo(''), 1500)
1014
- return () => window.clearTimeout(timer)
1015
- }, [info])
1016
1054
  const [discardArmed, setDiscardArmed] = useState(false)
1017
1055
  const [headMenu, setHeadMenu] = useState(null)
1018
1056
  const [rowMenu, setRowMenu] = useState(null)
@@ -1061,7 +1099,6 @@ G.GitPanel = function GitPanel(props) {
1061
1099
  const act = async (fn) => {
1062
1100
  setPending(true)
1063
1101
  setError('')
1064
- setInfo('')
1065
1102
  try {
1066
1103
  await fn()
1067
1104
  await refresh()
@@ -1076,21 +1113,17 @@ G.GitPanel = function GitPanel(props) {
1076
1113
  /* 推送 / 拉取:点 ↑/↓ 直接执行 */
1077
1114
  const push = () => void act(async () => {
1078
1115
  await G.api('git.push', { root })
1079
- setInfo(t('git.pushDone'))
1080
1116
  })
1081
1117
  const pull = () => void act(async () => {
1082
1118
  await G.api('git.pull', { root })
1083
- setInfo(t('git.pullDone'))
1084
1119
  })
1085
1120
 
1086
1121
  /* 推送 / 拉取(新建分支还没有上游时也能直接发布:Host 会自动 -u <remote> <branch>) */
1087
1122
  const pushBranch = () => void act(async () => {
1088
1123
  await G.api('git.push', { root })
1089
- setInfo(t('git.pushDone'))
1090
1124
  })
1091
1125
  const pullBranch = () => void act(async () => {
1092
1126
  await G.api('git.pull', { root })
1093
- setInfo(t('git.pullDone'))
1094
1127
  })
1095
1128
 
1096
1129
  /* 一键撤销所有未暂存改动:第一次点击进入「再点确认」,3 秒后自动取消 */
@@ -1103,7 +1136,6 @@ G.GitPanel = function GitPanel(props) {
1103
1136
  setDiscardArmed(false)
1104
1137
  void act(async () => {
1105
1138
  await G.api('git.discardAll', { root })
1106
- setInfo(t('git.discardDone'))
1107
1139
  })
1108
1140
  }
1109
1141
 
@@ -1112,7 +1144,7 @@ G.GitPanel = function GitPanel(props) {
1112
1144
  if (root === null || pending) return
1113
1145
  const text = typeof message === 'string' ? message.trim() : ''
1114
1146
  if (text === '') {
1115
- setInfo(t('git.commitNeedsMessage'))
1147
+ setError(t('git.commitNeedsMessage'))
1116
1148
  return
1117
1149
  }
1118
1150
  void act(async () => {
@@ -1121,7 +1153,6 @@ G.GitPanel = function GitPanel(props) {
1121
1153
  if (toStage.length > 0) await G.api('git.stage', { root, paths: toStage })
1122
1154
  await G.api('git.commit', { root, message: text })
1123
1155
  setMessage('')
1124
- setInfo(t('git.commitDone'))
1125
1156
  })
1126
1157
  }
1127
1158
  commitRef.current = commit
@@ -1243,7 +1274,6 @@ G.GitPanel = function GitPanel(props) {
1243
1274
  'div',
1244
1275
  { className: 'gufa-panel-body gufa-scroll', style: { display: 'flex', flexDirection: 'column' } },
1245
1276
  error !== '' ? h('div', { className: 'gufa-error-banner' }, G.Icon ? h(G.Icon, { name: 'warn', size: 13 }) : null, error) : null,
1246
- info !== '' ? h('div', { className: 'gufa-info-banner' }, info) : null,
1247
1277
  !root
1248
1278
  ? h(G.Empty, { icon: 'git', title: t('explorer.openProjectFirst') })
1249
1279
  : status === null
@@ -268,7 +268,6 @@ G.GufaApp = function GufaApp(props) {
268
268
  const [modal, setModal] = useState(null)
269
269
  const [shortcutsOpen, setShortcutsOpen] = useState(false)
270
270
  const [trashUndo, setTrashUndo] = useState([])
271
- const [bannerTone, setBannerTone] = useState('error')
272
271
  const [branchMenu, setBranchMenu] = useState(null)
273
272
  const [workspaceDialog, setWorkspaceDialog] = useState(null)
274
273
  const [workspaceSessions, setWorkspaceSessions] = useState({ status: 'idle', sessions: [], groups: [], sessionIds: [], archivedSessionIds: [] })
@@ -651,28 +650,11 @@ G.GufaApp = function GufaApp(props) {
651
650
  void refreshGit()
652
651
  }, [project, patchTab, refreshGit])
653
652
 
654
- /** 顶栏提示:错误常驻红色;成功用绿色 toast,1.2 秒后自动消失。 */
655
- const successTimerRef = useRef(null)
653
+ /** 顶栏提示:只显示错误/需要用户处理的提示;成功类操作直接看界面结果,不再弹 toast。 */
656
654
  const showBanner = useCallback((text, tone) => {
657
- if (successTimerRef.current !== null) {
658
- window.clearTimeout(successTimerRef.current)
659
- successTimerRef.current = null
660
- }
661
- if (tone === 'success') {
662
- setBannerTone('success')
663
- setBanner(text)
664
- successTimerRef.current = window.setTimeout(() => {
665
- successTimerRef.current = null
666
- setBanner('')
667
- }, 1200)
668
- return
669
- }
670
- setBannerTone('error')
655
+ if (tone === 'success') return
671
656
  setBanner(text)
672
657
  }, [])
673
- useEffect(() => () => {
674
- if (successTimerRef.current !== null) window.clearTimeout(successTimerRef.current)
675
- }, [])
676
658
 
677
659
  const closeTab = useCallback((path) => {
678
660
  editorBuffersRef.current.delete(path)
@@ -800,7 +782,6 @@ G.GufaApp = function GufaApp(props) {
800
782
  try {
801
783
  await G.api('git.checkout', { root: project.root, branch: name })
802
784
  closeBranchMenu()
803
- showBanner(`已切换到分支 ${name}`, 'success')
804
785
  setGitRefreshToken((token) => token + 1)
805
786
  setRefreshToken((token) => token + 1)
806
787
  void refreshGit()
@@ -816,7 +797,6 @@ G.GufaApp = function GufaApp(props) {
816
797
  try {
817
798
  await G.api('git.createBranch', { root: project.root, name })
818
799
  closeBranchMenu()
819
- showBanner(`已创建并切换到分支 ${name}`, 'success')
820
800
  setGitRefreshToken((token) => token + 1)
821
801
  setRefreshToken((token) => token + 1)
822
802
  void refreshGit()
@@ -980,7 +960,6 @@ G.GufaApp = function GufaApp(props) {
980
960
  if (project === null) return
981
961
  try {
982
962
  await G.api('git.discard', { root: project.root, paths: [path] })
983
- showBanner('已还原该文件的改动', 'success')
984
963
  // 改动已还原:关掉该 diff 标签(内容已与暂存区一致)
985
964
  setTabs((current) => current.filter((tab) => tab.path !== path))
986
965
  setActivePath((current) => (current === path ? null : current))
@@ -996,7 +975,6 @@ G.GufaApp = function GufaApp(props) {
996
975
  if (project === null) return
997
976
  try {
998
977
  await G.api('git.stage', { root: project.root, paths: [path] })
999
- showBanner('已暂存该文件', 'success')
1000
978
  setGitRefreshToken((token) => token + 1)
1001
979
  void refreshGit()
1002
980
  } catch (error) {
@@ -1481,7 +1459,6 @@ G.GufaApp = function GufaApp(props) {
1481
1459
  const missingSet = new Set(missing)
1482
1460
  setTabs((current) => current.filter((tab) => tab !== null && !missingSet.has(tab.path)))
1483
1461
  setActivePath((current) => (current !== null && missingSet.has(current) ? null : current))
1484
- showBanner(`已关闭 ${missing.length} 个已删除文件的标签`, 'success')
1485
1462
  }, [project, tabs, showBanner])
1486
1463
  const pruneMissingTabsRef = useRef(null)
1487
1464
  pruneMissingTabsRef.current = pruneMissingTabs
@@ -1651,7 +1628,6 @@ G.GufaApp = function GufaApp(props) {
1651
1628
  await openProjectPath(workspace.path)
1652
1629
  }
1653
1630
  closeWorkspaceDialog()
1654
- showBanner(`已切换到工作区 ${workspace.title || workspace.path || ''}`, 'success')
1655
1631
  } catch (error) {
1656
1632
  setWorkspaceDialog((current) => (current === null ? current : { ...current, error: G.errorText(error) }))
1657
1633
  }
@@ -1682,7 +1658,6 @@ G.GufaApp = function GufaApp(props) {
1682
1658
  }
1683
1659
  await openProjectPath(directory)
1684
1660
  closeWorkspaceDialog()
1685
- showBanner('已创建工作区', 'success')
1686
1661
  } catch (error) {
1687
1662
  setBanner(G.errorText(error))
1688
1663
  } finally {
@@ -2459,10 +2434,7 @@ G.GufaApp = function GufaApp(props) {
2459
2434
  h(
2460
2435
  'div',
2461
2436
  { className: 'gufa-editor-area' },
2462
- banner !== '' && bannerTone === 'success'
2463
- ? h('div', { className: 'gufa-toast-success' }, h(G.Icon, { name: 'check', size: 13 }), h('span', null, banner))
2464
- : null,
2465
- banner !== '' && bannerTone !== 'success'
2437
+ banner !== ''
2466
2438
  ? h(
2467
2439
  'div',
2468
2440
  { className: 'gufa-error-banner' },