rlfe [1] is a wrapper that allows "any" program to use readline. At one point I hacked this so that I could get decent line editing in Matlab [2]. Matlab is particularly bad for inputs longer than a single line. The problem is that I then lost the native tab-completion support in Matlab and gave up.
[1] http://per.bothner.com/software/#rlfe — Debian package available, and presumably for some other distros too.