@@ -220,7 +220,7 @@ public function setAutocomplete(AutocompleteInterface $autocomplete = null)
220220 /**
221221 * redraw the current input prompt
222222 *
223- * Usually, there should be no need to to call this method manually. It will
223+ * Usually, there should be no need to call this method manually. It will
224224 * be invoked automatically whenever we detect the readline input needs to
225225 * be (re)written to the output.
226226 *
@@ -229,6 +229,7 @@ public function setAutocomplete(AutocompleteInterface $autocomplete = null)
229229 * input buffer position.
230230 *
231231 * @return self
232+ * @internal
232233 */
233234 public function redraw ()
234235 {
@@ -254,44 +255,62 @@ public function redraw()
254255 return $ this ;
255256 }
256257
258+ /**
259+ * Clears the current input prompt (if any)
260+ *
261+ * Usually, there should be no need to call this method manually. It will
262+ * be invoked automatically whenever we detect that output needs to be
263+ * written in place of the current prompt. The prompt will be rewritten
264+ * after clearing the prompt and writing the output.
265+ *
266+ * @return self
267+ * @see Stdio::write() which is responsible for invoking this method
268+ * @internal
269+ */
257270 public function clear ()
258271 {
259272 if ($ this ->prompt !== '' || ($ this ->echo !== false && $ this ->linebuffer !== '' )) {
260273 $ this ->write ("\r\033[K " );
261274 }
262- // $output = str_repeat("\x09 \x09", strlen($this->prompt . $this->linebuffer));
263- // $this->write($output) ;
275+
276+ return $ this ;
264277 }
265278
279+ /** @internal */
266280 public function onChar ($ char )
267281 {
268282 $ this ->sequencer ->push ($ char );
269283 }
270284
285+ /** @internal */
271286 public function onKeyBackspace ()
272287 {
273288 // left delete only if not at the beginning
274289 $ this ->deleteChar ($ this ->linepos - 1 );
275290 }
276291
292+ /** @internal */
277293 public function onKeyDelete ()
278294 {
279295 // right delete only if not at the end
280296 $ this ->deleteChar ($ this ->linepos );
281297 }
282298
299+ /** @internal */
283300 public function onKeyInsert ()
284301 {
285302 // TODO: toggle insert mode
286303 }
287304
305+ /** @internal */
288306 public function onKeyTab ()
289307 {
290308 if ($ this ->autocomplete !== null ) {
291309 $ this ->autocomplete ->run ();
292310 }
293311 }
294312
313+ /** @internal */
295314 public function onKeyEnter ()
296315 {
297316 if ($ this ->echo !== false ) {
@@ -300,35 +319,43 @@ public function onKeyEnter()
300319 $ this ->processLine ();
301320 }
302321
322+ /** @internal */
303323 public function onKeyLeft ()
304324 {
305325 if ($ this ->move ) {
306326 $ this ->moveCursorBy (-1 );
307327 }
308328 }
309329
330+ /** @internal */
310331 public function onKeyRight ()
311332 {
312333 if ($ this ->move ) {
313334 $ this ->moveCursorBy (1 );
314335 }
315336 }
316337
338+ /** @internal */
317339 public function onKeyUp ()
318340 {
319341 if ($ this ->history !== null ) {
320342 $ this ->history ->up ();
321343 }
322344 }
323345
346+ /** @internal */
324347 public function onKeyDown ()
325348 {
326349 if ($ this ->history !== null ) {
327350 $ this ->history ->down ();
328351 }
329352 }
330353
331- // character(s) that could not be processed by the sequencer
354+ /**
355+ * Will be invoked for character(s) that could not otherwise be processed by the sequencer
356+ *
357+ * @internal
358+ */
332359 public function onFallback ($ chars )
333360 {
334361 $ pre = $ this ->substr ($ this ->linebuffer , 0 , $ this ->linepos ); // read everything up until before backspace
@@ -354,6 +381,7 @@ public function onFallback($chars)
354381 * indices out of range (exceeding current input buffer) are simply ignored
355382 *
356383 * @param int $n
384+ * @internal
357385 */
358386 public function deleteChar ($ n )
359387 {
0 commit comments