Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy pasting asm out of the diff window is messy #805

Open
Rainchus opened this issue Jul 14, 2023 · 5 comments
Open

Copy pasting asm out of the diff window is messy #805

Rainchus opened this issue Jul 14, 2023 · 5 comments

Comments

@Rainchus
Copy link
Contributor

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.

@ethteck
Copy link
Member

ethteck commented Mar 10, 2024

image
cause discord snux

@dbalatoni13
Copy link

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.

@jtl3d
Copy link

jtl3d commented Aug 22, 2024

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'));

@teopiaz
Copy link

teopiaz commented Aug 22, 2024

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.

@PerikiyoXD
Copy link
Contributor

Working on #1357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants