Leading tabs in pasted text can be interpreted as tab-completion instead of tab character (\t) #17322
Labels
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Resolution-External
For issues that are outside this codebase
Windows Terminal version
1.21.1272.0
Windows build number
10.0.26120.0
Other Software
Steps to reproduce
Paste the following text into a shell (pwsh, cmd, linux pwsh/ssh, NOT cygwin bash, linux bash/ssh):
Expected Behavior
The following text to appear in the shell:


(4 space characters were used in place of tabs when pasting for these examples)
Actual Behavior
Tab characters are interpreted (but the 1st one per line is ignored, running tab-completion, instead of pasting the real tab
(\t)

Note how the tabs in the class definition have dissapeared, turning the code from
into
The first tab is ignored in these lines, but the functionality does not change since only the whitespace was deleted.
However, with the second part,
becomes
Once again, the first tab is ignored, but now the functionality has changed: the second tab in line 2 was interpreted as tab-completion, turning the line
x = $_
intoyx = $_
and line 3's}
intox}
Instead of normal operation,

it instead errors out.

Powershell/linux over ssh also tab-completes in a similar way:

Similarly for cmd,

where .android/ and .cache./ are the 1st and 2nd directories in my ~; here, the 1st tab is not ignored and is used for tab-completion
--
cygwin bash works as expected:

, as does bash/linux over ssh:

The text was updated successfully, but these errors were encountered: