mark-wiemer-org/ahkpp

Wrong indentation on copy-paste

Opened this issue ยท 6 comments

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.

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

Code_-_Insiders_g2mZYqbBFf

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

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?

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?

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.

Removing this lines may fix copy-paste behavior.