Try putting a -n switch on that echo command and I predict this problem will go away. On Thu, 6 Sep 2018, Norbert Gruener wrote:
> Date: Thu, 6 Sep 2018 11:38:10 > From: Norbert Gruener <norb...@norbert-gruener.de> > To: debianUsers <debian-user@lists.debian.org> > Subject: Bash-Problem with cursor position after calling a function with > READLINE_LINE > Resent-Date: Thu, 6 Sep 2018 16:01:44 +0000 (UTC) > Resent-From: debian-user@lists.debian.org > > Hi all, > > In my Bash shell (?.bashrc?) I have ?bind? a command to the ?F1? key > bind -x '"\eOP":"_bash_man"' # F1 man <command> > > The script ?_bash_man? looks like (it is simplified only for test reasons) > > echo "${READLINE_LINE}" > > > When I type ?aaa? and then press ?F1?, I see a new line on the screen > containing the string ?aaa? and the cursor is positioned behind the > string. The ?Backspace? key is doing nothing, and pressing the four > ?arrow? keys just give that result > > bash^[[D^[[C^[[B^[[A > > but does not move the cursor in any direction. When I press > > aaa^Az?Enter? > > then the output on the screen is > > bash: zaaa: command not found > > Apparently the cursor position is not set correctly and the cursor > movements are not done on the screen. > > > Technical detail: > Debian: Debian GNU/Linux 9.5.0 _Stretch_ > Bash: GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu) > > > Any help or any information would be very much appreciated. > > Cheers, > Norbert > --