cli-menu icon indicating copy to clipboard operation
cli-menu copied to clipboard

Text is being cutted when pasting.

Open ptykamikaze opened this issue 7 years ago • 3 comments

Hello! I'm trying to use your cli which is very nice tool but I'm having a problem. When I'm pasting a text, it is being reduced. For example if I paste CSLAD00000334, the cli return CSLAD0000033. The weird thing is that if I press space, the last character appears. Can anyone help me with this issue?

ptykamikaze avatar Aug 03 '18 03:08 ptykamikaze

Hey there,

Where exactly are you pasting the text ? Is it in an input ? If so, which one ? Are you experiencing the same issue if you try pasting something shorter ?

Lynesth avatar Aug 03 '18 03:08 Lynesth

Hello. I'm using this method to generate an input

        $result = $menu->askText()
                    ->setPromptText('Enter the number)
                    ->setValidationFailedText('Invalid number')
                    ->setPlaceholderText('#')
                    ->ask();

Temporally, I have modified this file "NonCanonicalReader.php", line 64, to allow up to 30 characters and for the moment it is working...

$char = $this->terminal->read(30);

Thanks for your quick response...

ptykamikaze avatar Aug 03 '18 14:08 ptykamikaze

hey @ptykamikaze sorry for the very late reply. This is an interesting problem and I'm not sure what the solution should be. I never considered pasting in to the field when building this. I think the best way to solve this might be to PR a failing test case highlighting the issue and then we can discuss and figure out a solution.

While your solution does work for your use case, any pasted string over 30 chars would still result in trimming.

AydinHassan avatar Sep 04 '18 10:09 AydinHassan