Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17037

Modified Files:
        mal_readline.mx 
Log Message:
Partly solved the readline problems, in particular <tab> on empty line
does not generate a lengthly signature list.
Currently the following works
>io.pri<tab> becoms >io.print whereafter you can continue with (1);

the double tab is still a problem
>io.pr<tab><tab>
It results in 
>io.prio.pr
io.print
io.printf
io.printft

whereafter you can continue with int(1);
Ideally we should be given the response
>io.pr<tab><tab>
io.print
io.printf
io.printft
>io.pr

Probably to be fixed in getConsoleInput.


Index: mal_readline.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_readline.mx,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- mal_readline.mx     28 Aug 2007 07:46:59 -0000      1.51
+++ mal_readline.mx     11 Sep 2007 19:36:16 -0000      1.52
@@ -154,28 +154,7 @@
        (void) msg; (void) a; (void) b;
        for(i=0;i<a; i++)
                stream_printf(GDKout,"%s\n",msg[i]);
-       stream_printf(GDKout,"%s",rl_line_buffer);
-}
-static int mal_help(int a, int b){
-    char **msg,*c;
-       int i;
-
-    (void) a;
-    (void) b;
-
-    c = rl_line_buffer + strlen(rl_line_buffer);
-    while( c > (rl_line_buffer+1) && isspace(*c))
-        c--;
-    while( c > (rl_line_buffer+1) && !isspace(*c))
-        c--;
-       msg= getHelp(MCgetClient()->nspace,c,0);
-       stream_printf(GDKout,"\n");
-       for(i=0; msg[i]; i++){
-               stream_printf(GDKout,"%s\n",msg[i]);
-               GDKfree(msg[i]);
-       }
-       GDKfree(msg);
-       return 0;
+       /* stream_printf(GDKout,"%s",rl_line_buffer); */
 }
 @-
 @= tst
@@ -192,18 +171,8 @@
        static int index, len, last;
        static char **msg =0;
        const char *name;
-       char buf[BUFSIZ];
        int i;
 
-       /* we pick our own portion of the linebuffer  */
-       text = rl_line_buffer + strlen(rl_line_buffer);
-       while( text > (rl_line_buffer+1) && ! isspace((int) *text))
-               text--;
-       if (strlen(text) < BUFSIZ) {
-               strcpy(buf,text);
-               text= buf;
-       }
-
 #ifdef _MAL_READLINE_DEBUG
        printf("expand:%d [%d] %s \n",state,(int)strlen(text),text);
 #endif
@@ -217,6 +186,10 @@
                        GDKfree(msg);
                }
                msg = 0;
+       } else
+       if( last >0){
+               mal_unquote(msg[--last]);
+               return strdup(msg[last]);
        }
        if( mdbSession() ){
                while ( (name = mdb_commands[index++]) ){
@@ -229,14 +202,21 @@
                        if( @:tst(name,text,len)@ ) 
                                return strdup(name);
        }
-       if( msg == 0){
-               msg= getHelp(MCgetClient()->nspace,(str)(text),1);
-               last =0;
+       if( msg == 0 && *text){
+               char cmd[BUFSIZ], *c;
+               c= strchr(text,'.');
+               if( c== NULL) {
+                       snprintf(cmd,BUFSIZ,"%s.*",text);
+                       c= cmd;
+               } else
+                       c= (char *) text;
+               msg= getHelp(MCgetClient()->nspace,(str)c,1);
+               for(last=0; msg[last]; last++) 
+                       ;
        }
-       if( msg[last]){
-               last++;
-               mal_unquote(msg[last-1]);
-               return strdup(msg[last-1]);
+       if(msg && last && msg[--last]){
+               mal_unquote(msg[last]);
+               return strdup(msg[last]);
        }
        return NULL;
 }
@@ -274,9 +254,6 @@
        /* Allow conditional parsing of the ~/.inputrc file. */
        rl_readline_name = "MonetDB";
 
-       /* recognize the help function, should react to <FCN-2> */
-       rl_bind_key('\033',mal_help);
-
        /* Tell the completer that we want to try our own completion before std 
completion (filename) kicks in. */
        rl_attempted_completion_function = mal_completion;
        rl_completion_display_matches_hook= mal_help_display;
@@ -338,7 +315,6 @@
        do {
 #ifdef HAVE_LIBREADLINE
                if (prompt) {
-                       /* rl_completion_func_t *func = NULL;*/
 
                        if (buf)
                                free(buf);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to