From 102fab23fa021267ed3a7f9996cfd8ddeaacdde5 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 23 Dec 2025 12:54:33 -0700 Subject: [PATCH] Update to objdiff 3.5.1 --- package.json | 6 +++--- pnpm-lock.yaml | 10 +++++----- webview/common/ContextMenu.tsx | 10 ++++++---- webview/views/FunctionView.tsx | 28 +++++++++++++++++++++++++--- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 4db300c..f467cb7 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "objdiff", "description": "A local diffing tool for decompilation projects", "publisher": "decomp-dev", - "version": "3.4.4", + "version": "3.5.1", "repository": { "type": "git", "url": "https://github.com/encounter/objdiff-web" @@ -24,7 +24,7 @@ "@vscode/codicons": "^0.0.36", "clsx": "^2.1.1", "memoize-one": "^6.0.0", - "objdiff-wasm": "=3.4.4", + "objdiff-wasm": "=3.5.1", "picomatch": "^4.0.2", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -65,7 +65,7 @@ "node": ">=20.0.0", "vscode": "^1.96.0" }, - "packageManager": "pnpm@10.6.1", + "packageManager": "pnpm@10.26.2", "browserslist": [ "chrome 128" ], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 91b10a8..1d1c40a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^6.0.0 version: 6.0.0 objdiff-wasm: - specifier: '=3.4.4' - version: 3.4.4 + specifier: '=3.5.1' + version: 3.5.1 picomatch: specifier: ^4.0.2 version: 4.0.2 @@ -1613,8 +1613,8 @@ packages: nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} - objdiff-wasm@3.4.4: - resolution: {integrity: sha512-v1/HVA36yQcPlIuAg/H0GAW1fHixba5m5CL9i/baxIjbJY/Ob3SCUtJlDDqalybT9JCl1AlfPM4un9gndAX+4w==} + objdiff-wasm@3.5.1: + resolution: {integrity: sha512-2KSWQeaKMs1hbjEcLtRavNsKhoNM1xa1ChaOC1RAFyUPDPRUqr+g5r34ANK47/c4roJbU3MKIS0fH+VITBorzA==} object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} @@ -3795,7 +3795,7 @@ snapshots: dependencies: boolbase: 1.0.0 - objdiff-wasm@3.4.4: {} + objdiff-wasm@3.5.1: {} object-inspect@1.13.4: {} diff --git a/webview/common/ContextMenu.tsx b/webview/common/ContextMenu.tsx index b5fe8a3..b83b498 100644 --- a/webview/common/ContextMenu.tsx +++ b/webview/common/ContextMenu.tsx @@ -189,10 +189,12 @@ export function renderContextItems( key={key} className={styles.contextMenuItem} onClick={() => { - navigator.clipboard.writeText(item.val.value).then( - () => close(), - (e) => console.warn('Failed to copy:', e), - ); + navigator.clipboard + .writeText(item.val.copyString || item.val.value) + .then( + () => close(), + (e) => console.warn('Failed to copy:', e), + ); }} > Copy " diff --git a/webview/views/FunctionView.tsx b/webview/views/FunctionView.tsx index 3fcb89d..00d4a11 100644 --- a/webview/views/FunctionView.tsx +++ b/webview/views/FunctionView.tsx @@ -2,7 +2,7 @@ import styles from './FunctionView.module.css'; import clsx from 'clsx'; import { type diff, display } from 'objdiff-wasm'; -import { memo, useCallback, useMemo } from 'react'; +import { memo, useCallback, useMemo, useRef } from 'react'; import { FixedSizeList, areEqual } from 'react-window'; import type { ListChildComponentProps, ListOnScrollProps } from 'react-window'; import { useShallow } from 'zustand/react/shallow'; @@ -52,6 +52,7 @@ const AsmCell = ({ column, highlight: highlightState, setHighlight, + listRef, }: { obj: diff.ObjectDiff | undefined; config: diff.DiffConfig; @@ -60,6 +61,7 @@ const AsmCell = ({ column: number; highlight: HighlightState; setHighlight: (highlight: HighlightState) => void; + listRef: React.RefObject>; }) => { const onContextMenu = useInstructionContextMenu(); const tooltipContent: InstructionTooltipContent = useMemo( @@ -152,6 +154,10 @@ const AsmCell = ({ text = t.val.toString(16); isToken = true; break; + case 'branch-arrow': + text = ' ~> '; + isToken = true; + break; case 'symbol': text = t.val.demangledName || t.val.name; isToken = true; @@ -180,7 +186,9 @@ const AsmCell = ({ [styles.highlighted]: highlightMatches(highlight, t), })} onClick={(e) => { - if (isToken) { + if (t.tag === 'branch-arrow') { + listRef.current?.scrollToItem(t.val, 'center'); + } else if (isToken) { setHighlight(updateHighlight(highlightState, t, column)); e.stopPropagation(); } @@ -234,13 +242,22 @@ type ItemData = { rightSymbol: display.SymbolDisplay | null; highlight: HighlightState; setHighlight: (highlight: HighlightState) => void; + listRef: React.RefObject>; }; const AsmRow = memo( ({ index, style, - data: { result, config, leftSymbol, rightSymbol, highlight, setHighlight }, + data: { + result, + config, + leftSymbol, + rightSymbol, + highlight, + setHighlight, + listRef, + }, }: ListChildComponentProps) => { return (
); @@ -294,6 +313,7 @@ export const InstructionList = ({ leftSymbol: display.SymbolDisplay | null; rightSymbol: display.SymbolDisplay | null; }) => { + const listRef = useRef>(null); const { configProperties, currentUnit } = useExtensionStore( useShallow((state) => ({ configProperties: state.configProperties, @@ -325,6 +345,7 @@ export const InstructionList = ({ rightSymbol, highlight, setHighlight, + listRef, }; }, [ diff, @@ -355,6 +376,7 @@ export const InstructionList = ({ ); return (