[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

redraw-current-line from a shell script?



Dear All,

Bash has a function called redraw-current-line. It's listed in the core html documentation along with instructions of how to set up a key binding to it. My question is: How can I execute it from within a script, preferably without monkeying about with the user's key bindings?

Documentation:

http://www.gnu.org/software/bash/manual/bashref.html.gz
(This will display in Firefox, having automagically gunzipped, however other formats are at:)
http://www.gnu.org/software/bash/manual/bash.html

Example:

bind Control-r:redraw-current-line

Now I can happily manually input Control-r, which will have no visible effect unless the command line has been monkeyed with, in my case because something was written to the terminal. What I'd like to do is to write something to the terminal (a hint, triggered by a programmable tab completion) and then redraw the command line so that the line that the person was typing appears again. At present I can end the script by telling the user the key binding for redraw-current- line, and they can press that and it works as expected. So the concept is right, I just need to find out how to automate it.

Btw, do you know whether this only works when bash is in e-macs mode? Will I have to find out what mode bash is running in, convert to e-macs, redraw-current-line, then convert back again? I suppose that's easy enough for me to find out...

Regards, Max



Reply to: