hoaproject/Console

Console bug with suppr and Autocompleter

Esysteme opened this issue · 9 comments

When we push 2 times tab to got the following list and push "suppr" we quit the list and the cursor don't move as expected.

bug reproduce :

require 'vendor/autoload.php';


 $read = new Hoa\Console\Readline\Readline();

 $read->setAutocompleter(new Hoa\Console\Readline\Autocompleter\Word(
     get_defined_functions()['internal']
 ));



 do {
     $line = $read->readLine('> ');
     echo $line.PHP_EOL;
 } while (false !== $line && 'quit' != $line);

We can even delete "> " with the keybord

Hello :-),

Are you able to reproduce the bug with another (regular) key?

problem with f1/f2~ f12, pause, touch that simulate right click on keyboard,

Is it related to #17?

no, the start of cursor are decreased with an ofset (tab back ?)

The bug appears because they are no printable characters. I am trying to fix it.

I don't know how to detect whether a character is printable or not. Do you have any idea? /cc @hoaproject/hoackers

wouldn't it be possible to do something like

  1. get current position
  2. print the character
  3. get position: if it is the same as in 1, non printable character

@CircleCode Very tricky and I am not sure if this will be deterministic on all platform :-/. No solution with the Unicode data table?

Now we can address this bug :-).