Open stdedos opened 3 years ago
Confirmed in 4109. But I don't think it can be fixed easily... since "pasted as-is" causes bad UX in other scenarios.
I have read the PR.
Have you tried my example with the PR applied though? I am not sure how much exactly those two are related.
Have you tried my example with the PR applied though? I am not sure how much exactly those two are related.
"translate_tabs_to_spaces"
will translate tabs to spaces when pasting.
For my understanding, OP's issue is pasting patch into another file (for example, a PHP file). If that's the case, setting translate_tabs_to_spaces
in Diff doesn't help. It should be set in PHP but that makes no sense.
OP's issue is pasting patch into another file (for example, a PHP file)
Considering that the highlighting is clearly for diffs I don't think this is a given without the actual steps to reproduce filled out. @stdedos can you please complete the issue template, specifically the steps to reproduce (including using safe mode). Thanks.
"translate_tabs_to_spaces"
will translate tabs to spaces when pasting.
Every tab, no matter where it is? 😕
Shouldn't settings like that affect only indentation?
That's not generally the desired effect, tab can be used to align things using spaces.
OP's issue is pasting patch into another file (for example, a PHP file)
Considering that the highlighting is clearly for diffs I don't think this is a given without the actual steps to reproduce filled out. @stdedos can you please complete the issue template, specifically the steps to reproduce (including using safe mode). Thanks.
Please try to read the whole issue:
After copy-pasting it in a file delimited as "Spaces: 2"
and
Start Sublime Text in safe mode
Emphasis mine
I am not going to type things twice, just because you cannot see 2 feet to your left and right.
Sorry, but that doesn't clear anything up. Is it a new file that you have set the indentation level manually to 2 spaces on? Is it a new file with the indentation level defaulted to 2 from your settings? Does it happen in safe mode?
This is why I asked for steps to reproduce using safe mode and why it's in the issue template.
Sorry, but that doesn't clear anything up. Is it a new file that you have set the indentation level manually to 2 spaces on? Is it a new file with the indentation level defaulted to 2 from your settings?
It is a file that exists, which is a different file that the one its code is presented, that patch is pasted verbatim into, with detected indentation as "Spaces: 2"
Does it happen in safe mode?
YES, and it's literally in the issue text!
Then I think my guess is correct.
It is a file that exists, which is a different file that the one its code is presented, that patch is pasted verbatim into, with detected indentation as "Spaces: 2"
Is the file you're pasting into empty and is it saved? Sublime Text doesn't detect an indentation level for the snippet you posted, do you have the default set to 2 perhaps?
YES, and it's literally in the issue text!
Since you didn't fill out the steps to reproduce, it was not clear whether you were reproducing this issue in safe mode or just ignored that section of the template.
It is a file that exists, has data, it is saved as valid XML prior to this process, and with its automatically detected indentation being "Spaces: 2", which is a different file that the one its code is presented, that in the process of editing it, the patch is pasted verbatim into.
Thanks for clarifying. This is currently expected behavior as indentation detection turns on "translate_tabs_to_spaces"
which also applies when pasting. A workable solution may be to add another option to that setting for only translating tabs used for indentation.
It wasn't on versions 3xxx IIRC, so that sounds like a bug.
I am not sure how much I appreciate mangling my pasted text unless some translate_any_tab_to_space
setting is globally set i.e. I don't want to work with tabs throughout this program/project.
This behavior hasn't changed since ST3 and I can reproduce it there.
Description
For mock patch
After copy-pasting it in a file delimited as "Spaces: 2", it becomes:
Steps to reproduce
Expected behavior
File is pasted as-is
Actual behavior
File has its whitespace modified
Environment