[erlang-patches] Shell history search
Fred Hebert
mononcqc@REDACTED
Sat Dec 22 23:41:29 CET 2012
Hi, the following patch adds functionality to group.erl and edlin.erl in
order to allow the user to search history.
Search mode can be entered by pressing ctrl-r. Enter terms and press
ctrl-r again to search backwards, or ctrl-s to then search forward (if
you terminal doesn't eat up that one). Press enter to execute the line,
or use tab, arrow keys, or other control sequences (^D, ^K, etc.) to
exit search mode while remaining on the last found line.
The search mode is a simpler version of the one available in bash or
zsh shells.
This adds a few modes to the shell (search, on top of none and meta) in
group.erl for history search, and a few more in edlin.erl to change the
meaning of control sequences while searching.
This patch has been tested on OSX and some linux variants and worked
fine.
I tested it on Windows, and neither do werl.exe, or erl.exe (under
PowerShell or cmd.exe) capture the ^R and ^S sequences -- it will not
work there, but will not break any existing functionality. As far as I'm
aware, this is more likely a driver issue than an issue with the patch
(^G is not captured in cmd.exe, ctrl+C works in none of the above, for
example).
git fetch git://github.com/ferd/otp.git shell_history_search
Compare at:
https://github.com/ferd/otp/compare/erlang:master...ferd:shell_history_search
https://github.com/ferd/otp/compare/erlang:master...ferd:shell_history_search.patch
Regards,
Fred.
More information about the erlang-patches
mailing list