Skip to content

Dedenting copied code for checkpoint_paste#2432

Open
negvoss wants to merge 1 commit into3b1b:masterfrom
negvoss:checkpoint_paste_indendation_fix
Open

Dedenting copied code for checkpoint_paste#2432
negvoss wants to merge 1 commit into3b1b:masterfrom
negvoss:checkpoint_paste_indendation_fix

Conversation

@negvoss
Copy link

@negvoss negvoss commented Feb 27, 2026

For some reason, it seems like this may only cause an issue for certain users (potentially Windows users in particular).

For some reason, it seems like this may only cause an issue for certain users (potentially Windows users in particular).
Copy link

@YusufErdemK YusufErdemK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! The rstrip before dedent is key — textwrap.dedent bails if lines have inconsistent trailing whitespace, which Windows clipboard is notorious for adding. Makes sense this was Windows-specific.
One minor thing: could simplify to a one-liner if you want:

pythoncode_string = textwrap.dedent("\n".join(line.rstrip() for line in code_string.splitlines()))

But honestly the current version reads fine too. Either way, LGTM.

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

Successfully merging this pull request may close these issues.

2 participants