Hi!
----
Attached is a small patch ("ksh93_tab_completion_choice.diff.txt" ;
relative to the current Solaris OS/Net tree, but it should apply to
ksh93r cleanly, too) which may be usefull for integration into ksh93r+.
The patch changes the behaviour of the TAB completion in emacs mode to
preview a list of choices (e.g. equilavent to ESC-'=') instead of doing
the completion itself which may be much more usefull when many file name
are matching the given pattern (it also contains a comment how to make
it slightly "better", however I am not sure (yet) how this can be done
easily).
Little bit testing with our students showed that they like it more than
the current TAB completion... :-)
Basically the patch is equivalent to
-- snip --
function emacs_completion
{
if [[ ${.sh.edchar} == "$(printf "\t")" ]] then
.sh.edchar="$(printf "\E=")"
true
fi
}
trap emacs_completion KEYBD
-- snip --
Comments/suggestions/etc. welcome...
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)
-------------- next part --------------
Index: lib/libshell/common/edit/emacs.c
===================================================================
--- lib/libshell/common/edit/emacs.c (revision 222)
+++ lib/libshell/common/edit/emacs.c (working copy)
@@ -327,11 +327,15 @@
continue;
#endif /* u370 */
case '\t':
+ /* View list of choices like bash3's TAB-TAB
+ * ToDo: Write a helper function based on |ed_expand()|
which counts
+ * the number of available choices. If the count is 1
just operate like ESC-ESC,
+ * if there are more choices operate like ESC-'=' (e.g.
see below)
+ */
if(cur>0 && cur>=eol && out[cur-1]!='\t' &&
out[cur-1]!=' ' && ep->ed->sh->nextprompt)
{
- ed_ungetchar(ep->ed,ESC);
- ed_ungetchar(ep->ed,ESC);
- continue;
+ ed_ungetchar(ep->ed,'=');
+ goto esc_;
}
default:
if ((eol+1) >= (scend)) /* will not fit on line */
@@ -578,6 +582,7 @@
draw(ep,REFRESH);
continue;
case cntl('[') :
+esc_:
adjust = escape(ep,out,oadjust);
continue;
case cntl('R') :