Open stew opened 2 years ago
convert this to runInputTWithPrefs and pass the appropriate Prefs value
What would the appropriate Prefs
value be? It wouldn't override the settings that I have in my ~/.haskeline
file, would it? Don't you take my historyDuplicates: IgnoreAll
or editMode: Vi
from me! 😛. But seriously though.
If anyone wants an easy contribution I think you just need to convert this to
runInputTWithPrefs
and pass the appropriatePrefs
value:
You can't build this Prefs
value programmatically though because Haskeline's Prefs
is not an exported module and not only Prefs
is not reexported, which results in the only way to build a Prefs
value you need is to readPrefs :: FilePath -> IO Prefs
(sic!).
What would the appropriate
Prefs
value be?
It's the one returned from readPrefs <path_of_the_file_with_these_lines>
It wouldn't override the settings that I have in my ~/.haskeline file, would it?
It seems it would, because https://github.com/judah/haskeline/blob/30aafaf7171ba1f42236eea1d69a3c60af99284d/System/Console/Haskeline/InputT.hs#L175 doesn't fall back to readPrefsFromHome
, unless we have appended our custom prefs to the existing user's ~/.haskeline
content.
To sum this up: in order to get custom prefs taking into account user's custom prefs we need to create a (temporary?) plaintext prefs file, copy ~/.haskeline
content there, add Home & End bindings and supply a path to this file to readPrefs
.
IMO this issue should be resolved by reporting appropriate issues against haskeline. Thoughts?
To sum this up: in order to get custom prefs taking into account user's custom prefs we need to create a (temporary?) plaintext prefs file, copy ~/.haskeline content there, add Home & End bindings and supply a path to this file to readPrefs.
Hrmm, yeah that's definitely regrettable.
IMO this issue should be resolved by reporting appropriate issues against haskeline. Thoughts?
Agreed, it does seem like we should be able to set reasonable defaults for our own application.
Agreed, it does seem like we should be able to set reasonable defaults for our own application.
It's true in general, but IMO this particular issue is out of scope of UCM: the Home & End moving caret to the begin and end of the current line respectively is a default behavior of readline (just checked it by running rltest.c
of readline
s examples), and therefore haskeline should act same way.
in fact this issue is a exact duplicate of https://github.com/judah/haskeline/issues/30 which is closed at the moment but it apparently shouldn't
we had a user asking how to get their and keys doing expected things at the ucm prompt.
By following this page I was able to get these working by putting the following in my
~/.haskeline
:This accomplishes the desired behaviour, but we should set this up for users by default.
@ChrisPenner says:
If anyone wants an easy contribution I think you just need to convert this to
runInputTWithPrefs
and pass the appropriatePrefs
value:Main.hs lines 60-62