@@ -1,10 +1,10 @@ /* ================================================================== FILE: "/home/joze/src/tclreadline/tclreadline.c" - LAST MODIFICATION: "Sun Aug 29 15:04:07 1999 (joze)" + LAST MODIFICATION: "Tue Aug 31 03:22:55 1999 (joze)" (C) 1998, 1999 by Johannes Zellner, $Id$ --- tclreadline -- gnu readline for tcl @@ -222,11 +222,11 @@ */ if (expansion && *expansion) add_history(expansion); - Tcl_AppendResult(interp, expansion, (char*) NULL); + Tcl_SetResult(interp, expansion, TCL_VOLATILE); FREE(tclrl_line); FREE(expansion); return tclrl_state; } else if (c == 'i' && strncmp(argv[1], "initialize", length) == 0) { @@ -465,10 +465,11 @@ char** TclReadlineCompletion(char* text, int start, int end) { char** matches = (char**) NULL; + rl_attempted_completion_over = 0; #if 0 fprintf(stderr, "DEBUG> TclReadlineCompletion: text=|%s|\n", text); fprintf(stderr, "DEBUG> TclReadlineCompletion: start=|%d|\n", start); fprintf(stderr, "DEBUG> TclReadlineCompletion: end=|%d|\n", end); @@ -549,17 +550,23 @@ } obj = Tcl_GetObjResult(tclrl_interp); Tcl_ListObjGetElements(tclrl_interp, obj, &objc, &objv); /* fprintf (stderr, "(TclReadlineCompletion) objc = %d\n", objc); */ if (objc) { - int i, length /* not used */; + int i, length; matches = (char**) MALLOC(sizeof(char*) * (objc + 1)); for (i = 0; i < objc; i++) { matches[i] = strdup(Tcl_GetStringFromObj(objv[i], &length)); + if (1 == objc && !strlen(matches[i])) { + rl_attempted_completion_over = 1; + FREE(matches[i]); + FREE(matches); + return (char**) NULL; + } /* - fprintf (stderr, "(TclReadlineCompletion) matches[%d] = |%s|\n", - i, matches[i]); + fprintf (stderr, "(TclReadlineCompletion) len[%s]=%d\n", + matches[i], strlen(matches[i])); */ } matches[i] = (char*) NULL; /* terminate */ } Tcl_ResetResult(tclrl_interp); /* clear result space */