Closed nlebedenco closed 3 years ago
Can you explain precisely how Ctrl+S should work?
replxx
es Ctrl+S works just like readline
s as far as I can tell.
Build master (I used the same machine and binary from issue #89 for simplicity) In the open terminal type in
echo 1 [enter] echo 2 [enter] echo 3 [enter] echo 4 [enter]
Now if I type in Ctrl+R followed by the prefix 'ech' I see this: Which as expected displays "echo 4" as the last match Now open another terminal and repeat the process doing Ctrl+S in place of Ctrl+R. I see this: But I expected to see 'echo 1' as a match. Curiously if I hit backspace and leave the prefix 'ec' the terminal finds the expected match as shown below:
Hmm. Do you expect for search to wrap around in history?
Well I don't really know if there are variations to how libreadline handles Ctrl+S but I'd expect it to either always respect the current position in history if this is intended or always search from the beginning. However what appears to be happening is that it respects the current position except when bksp is pressed when it suddenly reverts to searching from the beginning which is odd.
Current (ee9b47bc018444652c1d37f7d5258ebd1c97ad1f) master should have more consistent behavior.
This seems fixed now, thx.
Btw, for the record, I was surprised to realize that Ctrl-S/R are not strict prefix searches. But this is according to libreadline's behaviour from what I've checked on a bash terminal so this is all good.
Although reverse history search (Ctrl+R) works as expected, Ctrl+S does not print. No history entry matched is printed. Only after Backspace is pressed (and the resulting string still matches) that the prompt will be updated properly.