dsh-vscode-mode 0.15.2 → 0.15.4

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.
@@ -26,6 +26,8 @@ import { SVN_LOG_ACTION_LABEL } from '../../shared/svn.js'
26
26
  import { orderLogEntries } from '../../svnLog.js'
27
27
  import { SVN_LOG_SHOW_ALL_LIMIT } from '../svnLog.js'
28
28
  import { ModalShell } from './ModalShell.js'
29
+ import { FloatingWindow } from './FloatingWindow.js'
30
+ import { inputOwnsKey } from '../state/floatingWindow.js'
29
31
  import { ContextMenu } from './ContextMenu.js'
30
32
  import type { ContextMenuEntry } from './ContextMenu.js'
31
33
  import { SvnLogStats } from './SvnLogStats.js'
@@ -886,9 +888,6 @@ export function SvnLogDialog(props) {
886
888
  const [sortKey, setSortKey] = React.useState(null)
887
889
  const [sortDir, setSortDir] = React.useState('desc')
888
890
  const [menu, setMenu] = React.useState(null)
889
- const [dlgW, setDlgW] = React.useState(() => Math.min(DIALOG_W_DEFAULT, (typeof window !== 'undefined' ? window.innerWidth : 1280) - 24)) // P0-14:外框宽(拖拽受控)
890
- const [dlgH, setDlgH] = React.useState(() => Math.min(DIALOG_H_DEFAULT, (typeof window !== 'undefined' ? window.innerHeight : 800) - 24)) // P0-14:外框高(拖拽受控)
891
- const [anchor, setAnchor] = React.useState(null) // 八向拖拽锚点(null=flex 居中;非 null=absolute 定位于该视口坐标) @author ddj 2026年09月24号
892
891
  const [listH, setListH] = React.useState(LIST_H_DEFAULT) // P0-14:上段修订列表高(拖拽受控)
893
892
  const [msgH, setMsgH] = React.useState(MSG_H_DEFAULT) // P0-14:中段提交信息高(拖拽受控)
894
893
  const [statsOpen, setStatsOpen] = React.useState(false) // P1-10:统计窗开关
@@ -998,65 +997,6 @@ export function SvnLogDialog(props) {
998
997
  window.addEventListener('pointerup', up)
999
998
  }
1000
999
 
1001
- // 八向(13-log-ui-polish 增量3):pointerdown 取卡片视口 rect 起点并立即 absolute 锚定,
1002
- // 实现「拖哪边哪边动、对边固定」(flex 居中模型无法表达该语义);clamp = 尺寸下限 680/480
1003
- // 与视口 12px 边距;每把手柄都以实际 rect 重锚 → CSS 截断/取整漂移自校正。
1004
- const startResize = (event, mode) => {
1005
- event.preventDefault()
1006
- event.stopPropagation()
1007
- const card = event.currentTarget.parentElement
1008
- const rect = card ? card.getBoundingClientRect() : null
1009
- if (!rect) return
1010
- const r0 = { left: rect.left, top: rect.top, width: rect.width, height: rect.height }
1011
- const startX = event.clientX
1012
- const startY = event.clientY
1013
- const moveL = mode === 'w' || mode === 'nw' || mode === 'sw'
1014
- const moveR = mode === 'e' || mode === 'ne' || mode === 'se'
1015
- const moveT = mode === 'n' || mode === 'nw' || mode === 'ne'
1016
- const moveB = mode === 's' || mode === 'sw' || mode === 'se'
1017
- const EDGE = 12 // 视口边距
1018
- const right0 = r0.left + r0.width
1019
- const bottom0 = r0.top + r0.height
1020
- // 起手锚定:切 absolute 到当前 rect(视觉零跳变)并同步 state=实际渲染尺寸
1021
- setAnchor({ left: r0.left, top: r0.top })
1022
- setDlgW(Math.round(r0.width))
1023
- setDlgH(Math.round(r0.height))
1024
- const move = (e) => {
1025
- const dx = e.clientX - startX
1026
- const dy = e.clientY - startY
1027
- let left = r0.left
1028
- let top = r0.top
1029
- let width = r0.width
1030
- let height = r0.height
1031
- if (moveR) width = Math.min(Math.max(DIALOG_W_MIN, r0.width + dx), window.innerWidth - EDGE - r0.left)
1032
- if (moveL) { left = Math.min(Math.max(EDGE, r0.left + dx), right0 - DIALOG_W_MIN); width = right0 - left }
1033
- if (moveB) height = Math.min(Math.max(DIALOG_H_MIN, r0.height + dy), window.innerHeight - EDGE - r0.top)
1034
- if (moveT) { top = Math.min(Math.max(EDGE, r0.top + dy), bottom0 - DIALOG_H_MIN); height = bottom0 - top }
1035
- const nextLeft = left
1036
- const nextTop = top
1037
- setAnchor((prev) => (prev && prev.left === nextLeft && prev.top === nextTop) ? prev : { left: nextLeft, top: nextTop })
1038
- setDlgW(Math.round(width))
1039
- setDlgH(Math.round(height))
1040
- }
1041
- const up = () => {
1042
- window.removeEventListener('pointermove', move)
1043
- window.removeEventListener('pointerup', up)
1044
- swallowNextClick()
1045
- }
1046
- window.addEventListener('pointermove', move)
1047
- window.addEventListener('pointerup', up)
1048
- }
1049
-
1050
- /**
1051
- * 双击复位:清锚回 flex 居中 + 默认尺寸(视口 clamp 同初始,防小屏溢出)。
1052
- * @author ddj 2026年09月24号
1053
- */
1054
- const resetDlgSize = () => {
1055
- setAnchor(null)
1056
- setDlgW(Math.min(DIALOG_W_DEFAULT, window.innerWidth - 24))
1057
- setDlgH(Math.min(DIALOG_H_DEFAULT, window.innerHeight - 24))
1058
- }
1059
-
1060
1000
  /** 上段修订列表高度拖拽(clamp:下限 200,上限 = body 高 - 信息区/路径区/分隔条保留空间)。 */
1061
1001
  const onListHDrag = (event) => startDrag(event, 'y', listH, (next) => {
1062
1002
  const total = bodyRef.current?.clientHeight ?? 0
@@ -1106,9 +1046,14 @@ export function SvnLogDialog(props) {
1106
1046
 
1107
1047
  // 初始/弹窗尺寸变化 fit(2026-09-24 用户反馈:固定高中段把下段变更文件区挤到 0):
1108
1048
  // 挂载与 dlgH 变化时收敛一次;拖拽期间不介入(拖拽自带 clamp),双击复位经 fitHeights 显式收敛。
1049
+ const fitRef = React.useRef(null)
1050
+ fitRef.current = () => fitHeights(listH, msgH)
1109
1051
  React.useEffect(() => {
1110
- fitHeights(listH, msgH)
1111
- }, [dlgH])
1052
+ const observer = new ResizeObserver(() => fitRef.current?.())
1053
+ if (bodyRef.current) observer.observe(bodyRef.current)
1054
+ fitRef.current?.()
1055
+ return () => observer.disconnect()
1056
+ }, [])
1112
1057
 
1113
1058
  // 勘误2(2026-09-24):挂载 fit 量到的是数据到达前布局(终态差 ~4px → 保底 166)。
1114
1059
  // 初次数据到达以终态布局补 fit 一次收敛至 ≥170;单次门闩,之后刷新/加载更多/拖拽不介入。
@@ -1118,24 +1063,20 @@ export function SvnLogDialog(props) {
1118
1063
  fitHeights(listH, msgH)
1119
1064
  }, [list])
1120
1065
 
1121
- // 键盘:F5 刷新(防浏览器整页刷新);↑↓ 在显示列表内移动选中(输入框内不劫持)
1122
- React.useEffect(() => {
1123
- const onKey = (event) => {
1124
- if (event.key === 'F5') { event.preventDefault(); onRefresh(); return }
1125
- if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return
1126
- const tag = String(event.target?.tagName ?? '').toLowerCase()
1127
- if (tag === 'input' || tag === 'select' || tag === 'textarea') return
1128
- if (!sorted || !sorted.length) return
1129
- event.preventDefault()
1130
- const at = sorted.findIndex((item) => item.revision === selected[0]?.revision)
1131
- const next = at < 0 ? 0 : Math.min(sorted.length - 1, Math.max(0, at + (event.key === 'ArrowDown' ? 1 : -1)))
1132
- const hit = sorted[next]
1133
- setSelected([hit]) // ↑↓ 折叠为单选(官方同款),并重置 Shift 基准
1134
- setAnchorRev(hit.revision)
1135
- }
1136
- window.addEventListener('keydown', onKey, true)
1137
- return () => window.removeEventListener('keydown', onKey, true)
1138
- }, [sorted, onRefresh, selected])
1066
+ /** @private @author ddj 2026年10月14号 @param event 日志浮窗内按键。其他窗口及输入控件保留自己的键盘行为。 */
1067
+ function onLogKey(event) {
1068
+ if (rangeOpen || menu || inputOwnsKey(event.target)) return
1069
+ if (event.key === 'F5') { event.preventDefault(); event.stopPropagation(); onRefresh(); return }
1070
+ if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return
1071
+ if (!sorted || !sorted.length) return
1072
+ event.preventDefault()
1073
+ event.stopPropagation()
1074
+ const at = sorted.findIndex((item) => item.revision === selected[0]?.revision)
1075
+ const next = at < 0 ? 0 : Math.min(sorted.length - 1, Math.max(0, at + (event.key === 'ArrowDown' ? 1 : -1)))
1076
+ const hit = sorted[next]
1077
+ setSelected([hit])
1078
+ setAnchorRev(hit.revision)
1079
+ }
1139
1080
 
1140
1081
  /** 复制当前选中修订(P0-9;剪贴板不可用静默忽略)。 */
1141
1082
  const copyRevision = (entry) => {
@@ -1224,16 +1165,10 @@ export function SvnLogDialog(props) {
1224
1165
  React.createElement('div', { className: 'edrv-svnlog-pane edrv-svnlog-pathspane', ref: paneRef },
1225
1166
  React.createElement(LogPathsInner, { selected: visibleSelected, target, onlyAffected, onOpenFile, onOpenDiff, onPathMenu })))
1226
1167
 
1227
- return React.createElement(ModalShell, {
1228
- dialogClass: 'edrv-svnlog-dialog',
1229
- width: Math.round(dlgW) + 'px',
1230
- // 八向锚定(增量3):anchor 非空时 absolute 定位于视口坐标(脱离 flex 居中,视觉零跳变);
1231
- // border-box 令 rect==state(clamp/拖拽零换算);maxHeight:none 消除 88vh 造成 state≠视觉的漂移。
1232
- cardStyle: Object.assign(
1233
- { height: Math.round(dlgH) + 'px', boxSizing: 'border-box', maxHeight: 'none' },
1234
- anchor ? { position: 'absolute', left: Math.round(anchor.left) + 'px', top: Math.round(anchor.top) + 'px' } : null,
1235
- ),
1236
- onClose,
1168
+ return React.createElement(FloatingWindow, {
1169
+ title: 'SVN 日志', dialogClass: 'edrv-svnlog-dialog',
1170
+ width: DIALOG_W_DEFAULT, height: DIALOG_H_DEFAULT,
1171
+ onKeyDown: onLogKey, onClose,
1237
1172
  },
1238
1173
  React.createElement(LogHead, { target, onClose }),
1239
1174
  React.createElement(LogFilterBar, {
@@ -1249,15 +1184,6 @@ export function SvnLogDialog(props) {
1249
1184
  onExportCsv: () => onExport('csv'), onExportHtml: () => onExport('html'),
1250
1185
  rangeActive: rangeActive === true, onOpenRange: () => setRangeOpen(true), onRangeReset: () => onRangeReset?.(),
1251
1186
  }),
1252
- // 八向手柄(增量3):四边先渲染、四角后渲染(角盖过相邻边 2px overlap);双击复位统一走 resetDlgSize
1253
- React.createElement(Grip, { mode: 'n', onDragStart: startResize, onReset: resetDlgSize }),
1254
- React.createElement(Grip, { mode: 's', onDragStart: startResize, onReset: resetDlgSize }),
1255
- React.createElement(Grip, { mode: 'w', onDragStart: startResize, onReset: resetDlgSize }),
1256
- React.createElement(Grip, { mode: 'e', onDragStart: startResize, onReset: resetDlgSize }),
1257
- React.createElement(Grip, { mode: 'nw', onDragStart: startResize, onReset: resetDlgSize }),
1258
- React.createElement(Grip, { mode: 'ne', onDragStart: startResize, onReset: resetDlgSize }),
1259
- React.createElement(Grip, { mode: 'sw', onDragStart: startResize, onReset: resetDlgSize }),
1260
- React.createElement(Grip, { mode: 'se', onDragStart: startResize, onReset: resetDlgSize }),
1261
1187
  (menu ? React.createElement(ContextMenu, { x: menu.x, y: menu.y, entries: menu.entries, onClose: () => setMenu(null) }) : null),
1262
1188
  (statsOpen ? React.createElement(SvnLogStats, { key: 'edrv-svnlog-stats', entries: sorted, onClose: () => setStatsOpen(false) }) : null),
1263
1189
  (rangeOpen ? React.createElement(ModalShell, {
@@ -10,7 +10,7 @@
10
10
  * 作者 ddj 2026年09月17号
11
11
  */
12
12
  import React from 'react'
13
- import { ModalShell } from './ModalShell.js'
13
+ import { FloatingWindow } from './FloatingWindow.js'
14
14
 
15
15
  /** stacked 时间线展开的作者上限(其余并入「其他」)。 */
16
16
  const STACK_TOP = 5
@@ -205,11 +205,10 @@ export function SvnLogStats(props) {
205
205
  const [othersPct, setOthersPct] = React.useState(0)
206
206
  const [stacked, setStacked] = React.useState(false)
207
207
  const stats = React.useMemo(() => svnLogStatsOf(entries, { caseInsensitive: ci }), [entries, ci])
208
- return React.createElement(ModalShell, {
208
+ return React.createElement(FloatingWindow, {
209
+ title: 'SVN 日志统计', height: 600,
209
210
  dialogClass: 'edrv-svnlog-stats',
210
- width: 'min(680px, calc(100vw - 40px))',
211
- zIndex: 192,
212
- closeOnEsc: false,
211
+ width: 680,
213
212
  onClose,
214
213
  },
215
214
  React.createElement('div', { className: 'edrv-svnlog-stats-head' },
@@ -9,7 +9,7 @@
9
9
  * 作者 ddj 2026年09月20号
10
10
  */
11
11
  import React from 'react'
12
- import { ModalShell } from './ModalShell.js'
12
+ import { FloatingWindow } from './FloatingWindow.js'
13
13
  import { downloadText } from './svnExport.js'
14
14
 
15
15
  /**
@@ -40,10 +40,11 @@ export function SvnPatchDialog(props) {
40
40
  onNote?.(done ? '已保存 ' + fileName : '保存失败:浏览器下载能力不可用')
41
41
  }
42
42
 
43
- return React.createElement(ModalShell, {
43
+ return React.createElement(FloatingWindow, {
44
+ title: 'SVN 补丁预览', height: 560,
44
45
  key: 'edrv-svn-patch',
45
46
  dialogClass: 'edrv-svn-patch-dialog',
46
- width: 'min(760px, calc(100vw - 48px))',
47
+ width: 760,
47
48
  onClose,
48
49
  },
49
50
  React.createElement('div', { className: 'edrv-svn-patch-head' },
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import React from 'react'
11
11
  import { SVN_SUM_LETTER } from '../../shared/svn.js'
12
- import { ModalShell } from './ModalShell.js'
12
+ import { FloatingWindow } from './FloatingWindow.js'
13
13
  import { svnDiffSum } from '../svnStatus.js'
14
14
 
15
15
  /**
@@ -53,10 +53,11 @@ export function SvnSumDialog(props) {
53
53
  (entry.kind === 'dir' ? React.createElement('span', { className: 'edrv-svnlog-path-kind' }, '目录') : null)))
54
54
  }
55
55
 
56
- return React.createElement(ModalShell, {
56
+ return React.createElement(FloatingWindow, {
57
+ title: 'SVN 目录对比', height: 560,
57
58
  key: 'edrv-svn-sum',
58
59
  dialogClass: 'edrv-svn-sum-dialog',
59
- width: 'min(680px, calc(100vw - 48px))',
60
+ width: 680,
60
61
  onClose,
61
62
  },
62
63
  React.createElement('div', { className: 'edrv-svn-patch-head' },
@@ -9,7 +9,7 @@ import { rpc } from '../rpc.js'
9
9
  import { absoluteOf } from '../tabActions.js'
10
10
  import { ContextMenu } from './ContextMenu.js'
11
11
  import type { ContextMenuEntry } from './ContextMenu.js'
12
- import { ModalShell } from './ModalShell.js'
12
+ import { FloatingWindow } from './FloatingWindow.js'
13
13
  import { nextConflict, nextUpdateSort, rowConflict, sortUpdateRows, updateActs, updateCloseMode, updateDone, updateLocked, updateParent, updateRange, updateReady, updateType } from './svnUpdateModel.js'
14
14
  import type { UpdateColumn, UpdateSort } from './svnUpdateModel.js'
15
15
 
@@ -564,10 +564,9 @@ export function SvnUpdateDialog(props: UpdateProps): React.ReactElement {
564
564
  const phase = pendingRows && processFinished ? '正在加载更新明细…'
565
565
  : state?.phase === 'completed' ? '更新完成' : state?.phase === 'failed' ? '更新失败'
566
566
  : state?.phase === 'cancelled' ? '更新已停止' : state?.phase === 'cancelling' ? '正在停止…' : '正在更新…'
567
- return React.createElement(ModalShell, {
568
- dialogClass: 'edrv-update-dialog', width: 'min(1320px, calc(100vw - 48px))',
569
- cardStyle: { height: 'min(680px, calc(100vh - 48px))', boxSizing: 'border-box', maxHeight: 'none' },
570
- closeOnEsc: closeMode.passive, closeOnMask: closeMode.passive, onClose: dismiss,
567
+ return React.createElement(FloatingWindow, {
568
+ title: 'SVN 更新', dialogClass: 'edrv-update-dialog', width: 1320, height: 680,
569
+ closeOnEsc: closeMode.passive, onClose: dismiss,
571
570
  },
572
571
  updateHead(props, state, phase, closable, dismiss),
573
572
  updateTable(props, displayRows, view, selection, finished, sort, onSort, evidence.states),
package/src/rpc.ts CHANGED
@@ -1034,6 +1034,7 @@ export function buildHandlers(
1034
1034
  maxResults: args.maxResults,
1035
1035
  include: args.include,
1036
1036
  exclude: args.exclude,
1037
+ force: args.force,
1037
1038
  })
1038
1039
  return { ok: true, ...result }
1039
1040
  } catch (error) {
@@ -45,6 +45,8 @@ export interface ContentSearchRequest {
45
45
  include?: string[]
46
46
  /** 排除 glob(这些文件不参与搜索)。 */
47
47
  exclude?: string[]
48
+ /** 强制绕过短期缓存:文件变更后的重搜必须看到最新磁盘内容,每次都跑真实 rg。 */
49
+ force?: boolean
48
50
  }
49
51
 
50
52
  type ContentSearchResponse = { matches: ContentMatch[]; truncated: boolean; warning?: string }
@@ -257,7 +259,8 @@ export class ContentSearcher {
257
259
  const includeKey = (request.include ?? []).join(',')
258
260
  const excludeKey = (request.exclude ?? []).join(',')
259
261
  const key = [rootKey, query, request.matchCase ? 'mc' : '', request.wholeWord ? 'ww' : '', request.regex ? 'rx' : '', includeKey, excludeKey, PROVIDER_VERSION].join('|')
260
- const cached = this.cache.get(key)
262
+ // force(文件变更后的重搜)必须看到最新磁盘内容:跳过缓存读,见下方跳过缓存写。
263
+ const cached = request.force ? undefined : this.cache.get(key)
261
264
  if (cached) return { matches: cached.matches, truncated: cached.truncated, warning: cached.warning }
262
265
  this.inflight.get(root)?.abort()
263
266
  const controller = new AbortController()
@@ -278,7 +281,8 @@ export class ContentSearcher {
278
281
  root,
279
282
  })
280
283
  if (controller.signal.aborted) return { matches: [], truncated: false }
281
- this.cache.set(key, result)
284
+ // force 结果不回填缓存:本次是「读最新」,不代表该键的稳定内容。
285
+ if (!request.force) this.cache.set(key, result)
282
286
  return { matches: result.matches, truncated: result.truncated, warning: result.warning }
283
287
  } catch (error) {
284
288
  if (controller.signal.aborted) return { matches: [], truncated: false }
package/src/shared/rpc.ts CHANGED
@@ -377,7 +377,7 @@ export interface RpcRequestMap {
377
377
  'edrv.dlog.clear': { sessionId?: string; file?: string }
378
378
  'edrv.dlog.reveal': { sessionId?: string }
379
379
  'edrv.searchFiles': { sessionId?: string; query: string }
380
- 'edrv.searchContent': { sessionId?: string; query: string; matchCase?: boolean; wholeWord?: boolean; regex?: boolean; maxResults?: number; include?: string[]; exclude?: string[] }
380
+ 'edrv.searchContent': { sessionId?: string; query: string; matchCase?: boolean; wholeWord?: boolean; regex?: boolean; maxResults?: number; include?: string[]; exclude?: string[]; force?: boolean }
381
381
  'edrv.listDir': { sessionId?: string; path: string; force?: boolean }
382
382
  'edrv.revealInExplorer': { sessionId?: string; path: string }
383
383
  'edrv.fsCreateFile': { sessionId?: string; path: string }