Skip to content

Pasting creation of non-custom objects from hashtable #3306

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

Closed
3 tasks done
peombwa opened this issue May 10, 2022 · 2 comments
Closed
3 tasks done

Pasting creation of non-custom objects from hashtable #3306

peombwa opened this issue May 10, 2022 · 2 comments

Comments

@peombwa
Copy link

peombwa commented May 10, 2022

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

N/A

Screenshot

Inspect the pasted snippet. You'll notice that Conditions is being prefixed to the DisplayName property.
image

Environment data

PS Version: 7.2.3
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.2.5
PSReadLine EditMode: Windows
OS: 10.0.22598.1 (WinBuild.160101.0800)
BufferWidth: 286
BufferHeight: 70

Steps to reproduce

  1. Install and import module:
Install-Module Microsoft.Graph.Identity.SignIns
Import-Module Microsoft.Graph.Identity.SignIns
  1. Copy and paste the following to a new PowerShell session:
$params = [Microsoft.Graph.PowerShell.Models.IMicrosoftGraphConditionalAccessPolicy]@{
	DisplayName = "Access to EXO requires MFA"
	State = "enabled"
	# Add more properties.
}
  1. Inspect the pasted snippet. You'll notice that Conditions is being prefixed to the DisplayName property.
    image

Expected behavior

The pasted snippet should match the copied one i.e.,

$params = [Microsoft.Graph.PowerShell.Models.IMicrosoftGraphConditionalAccessPolicy]@{
	DisplayName = "Access to EXO requires MFA"
	State = "enabled"
	# Add more properties.
}

Actual behavior

Conditions is being prefixed to the DisplayName property.
image

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 10, 2022
@jspern
Copy link

jspern commented May 10, 2022

@peombwa I'm unable to repro this in my environment -- same version of PS and PSReadLine that you are using.

image

@daxian-dbw
Copy link
Member

daxian-dbw commented May 11, 2022

The issue reproduces when you paste using Right Click instead of Ctrl+v.
The "spaces" before DisplayName = is actually Tab. When using Right Click, the terminal sends the text character by character, and it's the same as an interactive user typing those characters from the console application's perspective, and thus the Tab will trigger a tab-completion, and the tab-completion result is Conditions. That's why it looks like Conditions gets prepended from nowhere.

Technically, this is the by-design behavior, but we want to fix the Right Click behavior in general and that is tracked by #579.

@ghost ghost removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants