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

Wrong indentation on copy-paste #412

Closed
helperman opened this issue Sep 24, 2023 · 7 comments
Closed

Wrong indentation on copy-paste #412

helperman opened this issue Sep 24, 2023 · 7 comments
Assignees
Labels
bug something isn't working formatter code formatter issues question needs more clarity in order to take action

Comments

@helperman
Copy link

Description

I like to indent code of each separate hotkey in AHK-script.
It makes code more readable and clean.
The issue is when after copy-pasting a code with indentation the pasted code looses this indentation.

Reproduction steps

0000000735

Expected behavior

Indentation is the same as in a copied text.

Actual behavior

There is no indentation in a copied text.

@helperman helperman added the bug something isn't working label Sep 24, 2023
@mark-wiemer
Copy link
Owner

What happens when you run Format Document (Shift+Alt+F)? The document should look nice and indented:

Code_-_Insiders_g2mZYqbBFf

@mark-wiemer mark-wiemer added question needs more clarity in order to take action formatter code formatter issues labels Sep 30, 2023
@helperman
Copy link
Author

helperman commented Sep 30, 2023

Yes, Shift+Alt+F fixes indentation.
Therefore, the issue is pasting, not formatting.
I suspect trim spaces makes place when copying/pasting.

@mark-wiemer
Copy link
Owner

mark-wiemer commented Oct 11, 2023

I think format-on-paste is out of scope of this extension, maybe you have some other setting messing things up? Does this issue occur when you disable this extension and try to reproduce the issue?

@fade2gray
Copy link

fade2gray commented Oct 11, 2023

I also find this frustrating, that the indentation, included in the copied code is removed when pasted after a hotkey or label, but I do find that if you perform an 'undo' Ctrl+Z immediately after pasting, the indentation will be restored.

Note: Indent Code After Label in the settings doesn't appear to work - is this related?

@kyklish
Copy link
Contributor

kyklish commented Oct 12, 2023

Note: Indent Code After Label in the settings doesn't appear to work - is this related?

This setting was introduced for old formatter (when you hit Alt+Shift+F hotkey), it will format whole file, it didn't work with selected or pasted text.

@kyklish
Copy link
Contributor

kyklish commented Oct 12, 2023

Removing this lines may fix copy-paste behavior.

@mark-wiemer mark-wiemer moved this to Todo in AHK++ Aug 10, 2024
@mark-wiemer
Copy link
Owner

Closing this as won't fix given how minor it is. I recommend using braces to automatically indent code:

F1::
{
    MsgBox % "Hello world"
    Return
}
F2::
{
    MsgBox % "Hello world"
    Return
}

@mark-wiemer mark-wiemer closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in AHK++ Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working formatter code formatter issues question needs more clarity in order to take action
Projects
None yet
Development

No branches or pull requests

4 participants