Provide a layer of indirection between the readline compatibility functions
and our internal implementation, so that we have the freedom to change the
function signature.
The place to change the completion_append_character is
usually somewhere in the `rl_completion_entry_function'
callback which is where one usually can distinguish between
file- or dir-like entries to append a slash for dirs etc.
This does no longer work since `fn_complete()' takes the
`append_character' as argument before the callback is executed,
so that changes to the variable `rl_completion_append_character'
have in fact no effect for the current completion.
Fix by adding a function that returns the rl_completion_append_character,
when it gets passed in a filename in readline emulation.
+ the rl_callback_handler_install takes a pointer to a void function
which has one char * argument (it's called that way in the readline
emulation source, otherwise there's no way to pass the line buffer
to the function which processes the line when EOL is encountered)
+ provide a prototype for that function signature and use it
Makes the callback readline interface work now.
Pass in loads of parameters instead of relying on shed-loads of global
variables to modify the behaviour.
The filename completion code can now be enabled by code that uses el_gets().
(eg /bin/sh)
* Make tok_init(), tok_end(), tok_reset(), tok_line() and tok_str()
publically available in <histedit.h>
* Documented the public functions in editline(3)
* Renamed tok_line() -> tok_str()
* Added new tok_line() which takes a "const LineInfo *" instead of
"const char *" (the former has "cursor" information), and optionally
return the argv index ("int *cursorc") and offset within that index
("int *cursorv"). This means that completion routines can use the
tokenization code to crack the line and easily find which word the
cursor is at. (mmm, context sensitive completion :)
* Fixed TEST/test.c when using "continuation" lines (unmatched quote
or \ at EOL), and added some more DEBUG messages including highlighting
where the cursor is (with a `_').
1) File name completion should list the files in the current directory
if no text is entered. The previous version wouldn't list anything if
the text to complete was empty.
2) When listing directories, the entries "." and ".." shouldn't be
shown.
3) The filename completion should be used if the user's
rl_attempted_completion_function doesn't return any matches. The
previous version didn't do that.