shibayan / Sharprompt

Interactive command-line based application framework for C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

IbexPeak opened this issue · comments

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.

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.

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

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 "�".

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;

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.

That property is the only change between versions.

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

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