Skip to content
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

Ctrl + V (insert) does not work anymore since 2.3.3 #237

Open
IbexPeak opened this issue Oct 14, 2022 · 8 comments
Open

Ctrl + V (insert) does not work anymore since 2.3.3 #237

IbexPeak opened this issue Oct 14, 2022 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@IbexPeak
Copy link
Contributor

IbexPeak commented Oct 14, 2022

Hi Shibayan,

I recently updated from 2.3.2 to 2.4.5 and had the problem, that a clipboard-copied text can't be pasted using CTRL + V anymore.

I found out it doesn't work anymore since 2.3.3. In 2.3.2 it is working perfectly.

Can you please have a look? Thanks!

Edit: I found this issue here: #161, but in my case it only affects CTRL + V pasting, right click pasting is still working.

@IbexPeak
Copy link
Contributor Author

IbexPeak commented Nov 10, 2022

@shibayan Push

@shibayan
Copy link
Owner

I have not been able to reproduce this problem. In my development environment, I can paste by Ctrl+V (or Ctrl+Shift+V) or right click.

@IbexPeak
Copy link
Contributor Author

IbexPeak commented Nov 11, 2022

Unfortunatly, this is still reproducable, I don't think I have to place a minimal example here, but I do it anyway:

internal class Program
{
    public static void Main(string[] args)
    {
        Prompt.Input<string>("Please insert");
    }
}

This works with 2.3.2, with 2.3.3/2.4.5 the cursor of the console is just flickering when I press CTRL + V.
SharpromptPasting

I have testet Prompt.Input, Prompt.Select and Prompt.Confirm. It works for none of them since 2.3.3.

These are my console settings (they are all the same for each Sharprompt version):
image

@IbexPeak
Copy link
Contributor Author

IbexPeak commented Nov 11, 2022

I have debugged into your code inside my example, and I found out that the ConsoleKeyInfo.KeyChar differs, when beeing handled inside the ConfirmForm:

2.3.2:
image
image

2.3.3
image
image

In both tries I tried to insert "CopyText".
In 2.3.2 the do while loop default switch ist called for each char of the inserted text, and the first char is a "C" as expected.
In 2.3.3 the do while loop default switch is called only once and is a "�".

@shibayan
Copy link
Owner

Probably due to the TreatControlCAsInput setting, but this could be a bug on the .NET Runtime side. I have not been able to reproduce this in my development environment, even with minimal code.

Console.TreatControlCAsInput = true;

@IbexPeak
Copy link
Contributor Author

IbexPeak commented Nov 11, 2022

Interesting, what .NET Runtime do you use? In my example I used .NET Framework 4.8, I tried it with Sharprompt 2.3.3 with .NET6, but it is still not working.
Setting TreatControlCAsInput does not has any effect on the pasting.

I found out when I enable "Use CTRL+SHIFT+C/V" in the console window settings, pasting using CTRL+SHIFT+V works.

@shibayan
Copy link
Owner

That property is the only change between versions.

I have not been able to reproduce this behavior, so further investigation is difficult.

@shibayan shibayan added the help wanted Extra attention is needed label Nov 11, 2022
@Badabunga
Copy link

I had the same issue with inserting a secret into a secret prompt. But I could resolve the Issue when I build the project in Debug instead of Release mode.

If I build the project in the release mode the insert wouldn't work. (.NET 7) Maybe this helps you with the reproducing issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants