diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx index 3abd08fcbb..4b196b9796 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx @@ -7,7 +7,7 @@ import './styles/dropdown-panel.css' export const DropdownPanel = (props: DropdownPanelProps) => { const [calldataObj, dispatch] = useReducer(reducer, initialState) - const { dropdownName, dropdownMessage, calldata, header, loading, extractFunc, formatSelfFunc, registerEvent, triggerEvent, loadMoreEvent, loadMoreCompletedEvent, headStyle, bodyStyle } = props + const { dropdownName, dropdownMessage, calldata, header, loading, extractFunc, formatSelfFunc, registerEvent, triggerEvent, loadMoreEvent, loadMoreCompletedEvent, headStyle, bodyStyle, hexHighlight } = props const extractDataDefault: ExtractFunc = (item, parent?) => { const ret: ExtractData = {} @@ -34,15 +34,17 @@ export const DropdownPanel = (props: DropdownPanelProps) => { return ret } const formatSelfDefault = (key: string | number, data: ExtractData) => { - let value - if (typeof(data.self) === 'string') { - let regex = /^(0+)(.*)/g - let split = regex.exec(data.self.replace('0x', '')) - if (split && split[1] && split[2]) { - split[1] = data.self.indexOf('0x') === 0 ? '0x' + split[1] : split[1] - value = ({split[1]}{split[2]}) - } - } else value = data.self + let value + if (hexHighlight && typeof(data.self) === 'string') { + const isHex = data.self.startsWith('0x') || hexHighlight + if (isHex) { + let regex = /^(0+)(.*)/g + let split = regex.exec(data.self.replace('0x', '')) + if (split && split[1]) { + value = (0x{split[1]}{ split[2] && {split[2]} }) + } else value = (0x{data.self.replace('0x', '')}) + } else value = {data.self} + } else value = {data.self} return (
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx index 75358e9c07..8e6cd8b3be 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx @@ -3,7 +3,7 @@ import DropdownPanel from './dropdown-panel' // eslint-disable-line export const MemoryPanel = ({ calldata }) => { return ( - + ) } diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx index 1824a55477..0864ec035f 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx @@ -4,7 +4,7 @@ import DropdownPanel from './dropdown-panel' // eslint-disable-line export const StackPanel = ({ calldata }) => { return (
- +
) } diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx index 15d17a7792..f4669baebc 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx @@ -4,7 +4,7 @@ import DropdownPanel from './dropdown-panel' // eslint-disable-line export const StepDetail = ({ stepDetail }) => { return (
- +
) } diff --git a/libs/remix-ui/debugger-ui/src/types/index.ts b/libs/remix-ui/debugger-ui/src/types/index.ts index b968815242..9d13aab883 100644 --- a/libs/remix-ui/debugger-ui/src/types/index.ts +++ b/libs/remix-ui/debugger-ui/src/types/index.ts @@ -28,8 +28,9 @@ export interface DropdownPanelProps { triggerEvent?: Function, loadMoreEvent?: string, loadMoreCompletedEvent?: string, - bodyStyle?: React.CSSProperties - headStyle?: React.CSSProperties + bodyStyle?: React.CSSProperties, + headStyle?: React.CSSProperties, + hexHighlight?: boolean // highlight non zero value of hex value } export type FormatSelfFunc = (key: string | number, data: ExtractData) => JSX.Element