php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65191 "Delete", "ctrl"+ arrows don't work in interactive interpreter
Submitted: 2013-07-03 08:33 UTC Modified: 2013-07-03 17:58 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: azhdanov at terricone dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.16 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: azhdanov at terricone dot com
New email:
PHP Version: OS:

 

 [2013-07-03 08:33 UTC] azhdanov at terricone dot com
Description:
------------
When running PHP interactive interpreter with:
    
    php -a
    
"Delete" button doesn't work (produces `~` instead), jumping over words with 
"Ctrl"+"Left Arrow" and "Ctrl"+"Right Arrow" doesn't work either (`;5D` and 
`;5C`, respectively). It annoys me a lot - I use `php -a` every day. 
Worth noting, that other interpreters (irb, ipython, etc.) work good.

The problem occurs in each distro I tried - (K)Ubuntu (PHP 5.4.9-4ubuntu2.1 (cli) 
(built: Jun 11 2013 13:10:01)), Fedora (PHP 5.3.3 (cli) (built: Nov 29 2012 
04:12:23)), RHEL (PHP 5.3.3 (cli) (built: Nov 29 2012 04:12:23)). Works good on 
Mac though.

Expected result:
----------------
Ctrl+arrows should move the cursor by words, delete should delete current 
character.

Actual result:
--------------
Ctrl+left arrow produces ;5D
Ctrl+right arrow produces ;5C
Delete produces ~

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-03 17:58 UTC] cataphract@php.net
-Status: Open +Status: Not a bug
 [2013-07-03 17:58 UTC] cataphract@php.net
Not a PHP bug. Configure .editrc (for libedit) or .inputrc (for readline). For 
instance, I see that ubuntu compiles PHP against libedit, so for instance to 
have DEL to work you could edit your ~/.editrc and add:

bind "\e[3~" ed-delete-next-char

or just use default shortcuts here: http://www.bigsmoke.us/readline/shortcuts
Those are valid for both libedit and readline.

My guess is that irc, ipython etc. are compiled against readline and your 
distros provide a global /etc/inputrc where the bindings are defined.
 [2013-09-20 05:51 UTC] pippo at gmail dot com
@cataphract: Thanks, your tip - for DELETE key - run fine!
$ cat ~/.editrc
bind "\e[3~" ed-delete-next-char
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC