history search quirks

Peter Hercek phercek at gmail.com
Mon Sep 28 06:33:01 EDT 2009


I have two comments to the history search feature in haskeline. I 
actually think they are bugs but others may think otherwise so I'm 
checking it out here.

1) When I type something in the command prompt and then call history 
search back (reverse-i-search) then the string already typed is not used 
as the initial value for the history search back argument. The only 
effect the text typed before calling history search back is that it 
preserves cursor position in the string found. For example, starting in 
normal mode and typing ": m a ctrl-r" should have the same effect as 
typing "ctrl-r : m a" (i.e. it should switch to the search mode with the 
initial argument of ":ma".

2) When I find the wanted string in history and confirm it with enter 
then getInputLine returns without restoring the user defined prompt  
followed with the string found. For example, when I type "ctrl-r : m a 
enter" the text on the terminal will be "(reverse-i-search)`:ma': :main" 
instead of "*Main> :main". So the user defined prompt is not there. Now, 
I know I can work around this easily using "bind: return right return" 
in .haskeline but it looks fishy to me.

If the workaround would not be possible then point 2 would be annoying 
when users use some kind of highlighting to easily identify beginnings 
of user typed commands because in the case of directly confirmed history 
search result the highlighting is not there.


More information about the Haskeline mailing list