Zach Gelnett <zachg99 <at> gmail.com> writes: > > > > > > Basically, when I hit [ESC] then fwd slash (/) to search through the > > > history, it throws my cursor back to get beginning of the line (on top > > > of the prompt) and acts weird. This is in mrxvt, now if I do the same > > > in the basic cygwin bash shell i get this: > > > > > > v468929 <at> TRD-CAX40JXD ~> / > > > ☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺☺ > > > > Here is my PS1: > > echo $PS1 > \[\e]61;\u <at> \H\007\]\u <at> \H \W>
I reproduced this with readline-5.1-1, using a command.com window ($TERM=cygwin), so it might be an upstream bug or a cygwin terminal display bug. It looks like the readline command vi-search is displaying an uninitialized buffer, whose width seems to track the prompt string length. Once you have a command, the contents of the buffer are now initialized by a previous command: $ PS1='\[\e]61;[EMAIL PROTECTED]@\H \W> ' [EMAIL PROTECTED] ~> echo 01234567890123456789 01234567890123456789 [EMAIL PROTECTED] ~> [ESC]/ # Displays: [EMAIL PROTECTED] ~> / ho 01234567890123456 # with cursor after / [EMAIL PROTECTED] ~> PS1='\[\e]61;a\a\]123> ' 123> echo 01234567890123456789 01234567890123456789 123> [ESC]/ # Displays: 123> / 1='\[\ # with cursor after / 123> PS1='\[\e]61;a\a\]1234> ' 1234> [ESC]/ # Displays: 1234> / ='\[\e 1234> PS1='\[\e]61;ab\a\]123> ' 123> [ESC]/ # Displays 123> / 1='\[\e Whether or not the extra characters are visible, making the one-line prompt with invisible characters one character larger makes the buffer displayed one character wider. I'm trying to build a debugging version of readline to isolate the problem before releasing readline-5.1-3. > Basically, when using VI as the command line editor the [ESC] puts the > line into command mode (just like pressing [ESC] within VI) then the / > says search (again it's the same command within VI) for whatever you > type next. So, "/ls" would return the latest command line that > included the letters "ls" and i can then press "n" to get the next > occurrence and "N" to move the opposite direction through the history, > it's quite handy. emacs mode also has history searching commands; I am familiar with the concept, it's just that I don't use vi mode. Thanks for the extra hints on how to test this. -- Eric Blake -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/