Forum Discussion
Why does Teams always strip indentation when pasting text?
- May 14, 2021
my-kl
So I got to the heart of the matter. I used the https://evercoder.github.io/clipboard-inspector/ to inspect the contents of clipboard when copying the same text from two different apps. Both have two entries. One of the entries is text/html and one is text/plain. The text/plain as you might guess is identical. The html is quite different. I then copied the html and rendered.
This is what I see from TextEditThis is what I see from Visual Studio Code
So this would appear to be an issue with my environment in Visual Studio Code (or even a defect in Code, I"m not sure)
This needs fixing ASAP. It's absolutely ridiculous not to be able to paste code in a chat app and have it strip out whitespace.
It's not even whitespace at the start of lines, it strips out consecutive whitespace within pasted text too. Spaces, tabs, anything.
I work in a team of software developers, it's outrageous such a simple thing doesn't work.
- dbompJan 12, 2022Copper Contributor...and the code snippet is not a substitute. It only displays five lines without expanding, and the entry is through a thought-interrupting popup. The "Monospaced" formatting was just fine for medium length pastes. (Actually, what is the point of monospaced formatting when the whitespace is collapsed? When is it even useful?)
- spinardFeb 08, 2022Copper Contributor
dbomp Agreed code snippet is not a workaround. Not only for the reasons you stated, but also because you can't apply any other text formatting to the code snippet. One thing I do quite a bit (or used to) is paste a bit of code, then highlight the part I want to draw attention to. This woks in a Monospaced paragraph (but now the spaces are stripped so that's now useless).
- rehorn9431Mar 04, 2022Copper ContributorThe workarounds also don't really work on the Linux client as well where Teams does this too.