note 128978 added to function.readline-completion-function

From: Date: Mon, 23 Oct 2023 16:06:41 +0000
Subject: note 128978 added to function.readline-completion-function
Groups: php.notes 
Request: Send a blank email to php-notes+get-220935@lists.php.net to get a copy of this message
If you want to use autocomplete also for history, you can make it like this: readline_completion_function(function($input, $index) { $matches = []; foreach(readline_list_history() as $match) if (mb_strpos($match, readline_info("line_buffer")) !== false) $matches[] = mb_substr($match, $index); return (count($matches) > 1 && $index) ? [] : $matches; }); ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 188.255.10.206) ---- Manual Page -- https://php.net/manual/en/function.readline-completion-function.php Edit -- https://main.php.net/note/edit/128978 Del: integrated -- https://main.php.net/note/delete/128978/integrated Del: useless -- https://main.php.net/note/delete/128978/useless Del: bad code -- https://main.php.net/note/delete/128978/bad+code Del: spam -- https://main.php.net/note/delete/128978/spam Del: non-english -- https://main.php.net/note/delete/128978/non-english Del: in docs -- https://main.php.net/note/delete/128978/in+docs Del: other reasons-- https://main.php.net/note/delete/128978 Reject -- https://main.php.net/note/reject/128978 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220935) next »