Guys who worked closely with readline help out. The task to implement context autocomplit. That is, if I enter numbers <space> and press the tab, then my context is all that to the last space, and all this can help give a specific contextual complement, in the case of the numbers context I for example return an array of numbers.

If I understand the documentation correctly, I can get the current context via readline_info ('line_buffer') (hereinafter LB), but in fact LB returns the previously entered command, that is, I typed something, clicked the enter and here's my input will fall into LB only next readout

Test Code

readline_completion_function(function($input) { // вот здесь ожидается увидеть весь текущий ввод, // а не предыдущую введеную комманду var_dump(readline_info('line_buffer')); return ['help', 'quit']; }); while(true) { readline('cmd: '); } 

    0