decomp.me
decomp.me copied to clipboard
Copy pasting asm out of the diff window is messy
As is, if you want to copy the asm out of the diff window it copies both, which results in this https://cdn.discordapp.com/attachments/897066363951128590/1128170199313559573/image.png Since the original asm can be gotten by exporting a scratch, a way to only copy paste the asm from your C code or a way to output the new asm using export would be nice.
cause discord snux
Splitting the divs for target and current should fix it. They are currently both in one <ul> element and the separation is on the line level.
If it wasn't infinite scrolling, something like this gets close (nth-child would change depending on the column you want):
navigator.clipboard.writeText([].slice.call(document.querySelectorAll('li[class^=Diff_row] div:nth-child(2)') || []).map(div => div.innerText.replace(/^\s*/, '')).join('\r\n'));
import json
with open('data.json', 'r') as file:
parsed_data = json.load(file)
target_lines = []
current_lines = []
for row in parsed_data.get('diff_output', {}).get('rows', []):
base_text = ""
current_text = ""
if 'base' in row:
base_text = ' '.join([t.get('text', '') for t in row['base'].get('text', [])])
if 'current' in row:
current_text = ' '.join([t.get('text', '') for t in row['current'].get('text', [])])
target_lines.append(base_text)
current_lines.append(current_text)
with open('target.txt', 'w') as target_file:
target_file.write('\n'.join(target_lines))
with open('current.txt', 'w') as current_file:
current_file.write('\n'.join(current_lines))
print("saved to 'target.txt' and 'current.txt'")
I temporary solved by coping the json response of the compile endpoint and parsing it with this script. Not perfect but for me is enough.
Working on #1357
Done in #1357