diff --git a/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts index 56616f1ac9..5a3ae6ae82 100644 --- a/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts +++ b/apps/remix-ide-e2e/src/commands/goToVMTraceStep.ts @@ -12,7 +12,10 @@ class GoToVmTraceStep extends EventEmitter { function goToVMtraceStep (browser: NightwatchBrowser, step: number, incr: number, done: VoidFunction) { browser.execute(function (step) { (document.getElementById('slider') as HTMLInputElement).value = (step - 1).toString() }, [step]) .setValue('*[data-id="slider"]', new Array(1).fill(browser.Keys.RIGHT_ARROW)) - .pause(1000) + .execute((step) => { + (document.querySelector('*[data-id="slider"]') as any).internal_onmouseup({ target: { value: step }}) + }, [step]) + .pause(10000) .perform(() => { done() }) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index 9c11b5863d..2ad2ea4aa9 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -608,9 +608,10 @@ class FileManager extends Plugin { this.events.emit('noFileSelected') } else { file = this.normalize(file) - await this.saveCurrentFile() const resolved = this.getPathFromUrl(file) file = resolved.file + await this.saveCurrentFile() + if (this.currentFile() === file) return const provider = resolved.provider this._deps.config.set('currentFile', file) this.openedFiles[file] = file diff --git a/libs/remix-debug/src/debugger/stepManager.ts b/libs/remix-debug/src/debugger/stepManager.ts index 6fd2e5fa22..07693ca62f 100644 --- a/libs/remix-debug/src/debugger/stepManager.ts +++ b/libs/remix-debug/src/debugger/stepManager.ts @@ -121,6 +121,7 @@ export class DebuggerStepManager { if (solidityMode) { step = this.resolveToReducedTrace(step, -1) } + if (this.currentStepIndex === step) return this.currentStepIndex = step this.triggerStepChanged(step) } @@ -136,6 +137,7 @@ export class DebuggerStepManager { if (solidityMode) { step = this.resolveToReducedTrace(step, 1) } + if (this.currentStepIndex === step) return this.currentStepIndex = step this.triggerStepChanged(step) } @@ -146,12 +148,14 @@ export class DebuggerStepManager { if (solidityMode) { step = this.resolveToReducedTrace(step, 0) } + if (this.currentStepIndex === step) return this.currentStepIndex = step this.triggerStepChanged(step) } jumpTo (step) { if (!this.traceManager.inRange(step)) return + if (this.currentStepIndex === step) return this.currentStepIndex = step this.triggerStepChanged(step) } diff --git a/libs/remix-debug/src/solidity-decoder/decodeInfo.ts b/libs/remix-debug/src/solidity-decoder/decodeInfo.ts index 44c620615a..f141a7e1f9 100644 --- a/libs/remix-debug/src/solidity-decoder/decodeInfo.ts +++ b/libs/remix-debug/src/solidity-decoder/decodeInfo.ts @@ -11,6 +11,7 @@ import { Struct as StructType } from './types/Struct' import { Int as IntType } from './types/Int' import { Uint as UintType } from './types/Uint' import { Mapping as MappingType } from './types/Mapping' +import { FunctionType } from './types/FunctionType' import { extractLocation, removeLocation } from './types/util' /** @@ -78,6 +79,10 @@ function bool (type) { return new BoolType() } +function functionType (type, stateDefinitions, contractName, location) { + return new FunctionType(type, stateDefinitions, contractName, location) +} + /** * DynamicByteArray decode the given @arg type * @@ -300,7 +305,8 @@ function parseType (type, stateDefinitions, contractName, location) { struct: struct, int: int, uint: uint, - mapping: mapping + mapping: mapping, + function: functionType } const currentType = typeClass(type) if (currentType === null) { diff --git a/libs/remix-debug/src/solidity-decoder/types/FunctionType.ts b/libs/remix-debug/src/solidity-decoder/types/FunctionType.ts new file mode 100644 index 0000000000..ffa4b9f1c6 --- /dev/null +++ b/libs/remix-debug/src/solidity-decoder/types/FunctionType.ts @@ -0,0 +1,12 @@ +'use strict' +import { ValueType } from './ValueType' + +export class FunctionType extends ValueType { + constructor (type, stateDefinitions, contractName, location) { + super(1, 8, 'function') + } + + decodeValue (value) { + return 'at program counter ' + value + } +} diff --git a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx index 06fe05e949..2d4c374770 100644 --- a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx @@ -1,47 +1,42 @@ import React, { useState, useEffect, useRef } from 'react' // eslint-disable-line export const Slider = ({ jumpTo, sliderValue, traceLength }) => { - const [state, setState] = useState({ - currentValue: 0 - }) - const onChangeId = useRef(null) + const slider = useRef(null) useEffect(() => { setValue(sliderValue) }, [sliderValue]) const setValue = (value) => { - if (value === state.currentValue) return - setState(prevState => { - return { ...prevState, currentValue: value } - }) - jumpTo && jumpTo(value) - } - - const handleChange = (e) => { + if (value === slider.current.value) return + slider.current.value = value if (onChangeId.current) { - window.clearTimeout(onChangeId.current) + clearTimeout(onChangeId.current) } ((value) => { onChangeId.current = setTimeout(() => { - console.log(value) - value = parseInt(value) - setValue(value) + jumpTo && jumpTo(value) }, 100) - })(e.target.value) + })(value) } + const handleChange = (e) => { + setValue(parseInt(e.target.value)) + } + + if (slider.current) slider.current.internal_onmouseup = handleChange + return (