tmp = buf + strlen(buf);
while (*tmp != '/' && tmp != buf)
tmp--;
- strncpy(dirName, buf, tmp - buf);
- dirName[tmp - buf] = 0;
+
tmp++;
+ strncpy(dirName, buf, tmp - buf + 1);
+ dirName[tmp - buf] = 0;
+/* tmp++; */
+
} else {
if ((dirName = getcwd(NULL, 0)) == NULL)
return matches;
return (matches);
}
-/* This function now return an int which refers to how much the
+/* This function now has an arg which refers to how much the
* statusbar (place) should be advanced, i.e. the new cursor pos.
*/
-int input_tab(char *buf, int place, int lastWasTab)
+char *input_tab(char *buf, int place, int lastWasTab, int *newplace)
{
/* Do TAB completion */
static int num_matches = 0, match_matches = 0;
static char **matches = (char **) NULL;
- int pos = place, newplace = 0, i = 0, col = 0, editline = 0;
+ int pos = place, i = 0, col = 0, editline = 0;
int longestname = 0;
char *foo;
+ struct stat fileinfo;
if (lastWasTab == FALSE) {
- char *tmp, *matchBuf;
+ char *tmp, *copyto, *matchBuf;
/* For now, we will not bother with trying to distinguish
* whether the cursor is in/at a command extression -- we
/* Free up any memory already allocated */
if (matches != NULL) {
+ for (i = i; i < num_matches; i++)
+ free(matches[i]);
free(matches);
matches = (char **) NULL;
num_matches = 0;
/* Don't leak memory */
free(matchBuf);
+#ifdef DEBUG
+ fprintf(stderr, "%d matches found...\n", num_matches);
+#endif
/* Did we find exactly one match? */
switch(num_matches) {
case 0:
blank_edit();
break;
case 1:
- buf = nrealloc(buf, strlen(buf) + strlen(matches[0]) - pos + 1);
+
+ buf = nrealloc(buf, strlen(buf) + strlen(matches[0]) + 1);
+
+ if (strcmp(buf, "") && strstr(buf, "/")) {
+ for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf; tmp--)
+ ;
+ tmp++;
+ }
+ else
+ tmp = buf;
+
+ if (!strcmp(tmp, matches[0])) {
+
+ /* Is it a directory? */
+ if (stat(buf, &fileinfo) == -1)
+ break;
+ else if (S_ISDIR(fileinfo.st_mode)) {
+ strncat(buf, "/", 1);
+ *newplace += 1;
+ }
+ break;
+ }
+
+ copyto = tmp;
+ for (pos = 0; *tmp == matches[0][pos] &&
+ pos <= strlen(matches[0]); pos++)
+ tmp++;
+
+
+#ifdef DEBUG
+ fprintf(stderr, "buf = \'%s\'\n", buf);
+/* fprintf(stderr, "copyto = \'%s\'\n", copyto); */
+ fprintf(stderr, "matches[0] = \'%s\'\n", matches[0]);
+ fprintf(stderr, "pos = %d\n", pos);
+ fflush(stderr);
+#endif
+
/* write out the matched command */
- strncpy(buf + pos, matches[0] + pos,
- strlen(matches[0]) - pos);
- newplace += strlen(matches[0]) - pos;
+ strncpy(copyto, matches[0], strlen(matches[0]) + 1);
+ *newplace += strlen(matches[0]) - pos;
+
+ if (stat(buf, &fileinfo) == -1)
+ ;
+ else if (S_ISDIR(fileinfo.st_mode)) {
+ strncat(buf, "/", 1);
+ *newplace += 1;
+ }
+
break;
default:
/* Check to see if all matches share a beginning, and if so
tack it onto buf and then beep */
+ if (strcmp(buf, "") && strstr(buf, "/")) {
+ for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf; tmp--)
+ ;
+ tmp++;
+ }
+ else
+ tmp = buf;
+
+ for (pos = 0; *tmp == matches[0][pos] && *tmp != 0 &&
+ pos <= strlen(matches[0]); pos++)
+ tmp++;
+
while (1) {
match_matches = 0;
/* All the matches have the same character at pos+1,
so paste it into buf... */
buf = nrealloc(buf, strlen(buf) + 2);
- strncpy(buf + pos, matches[0] + pos, 1);
- newplace++;
+ strncat(buf, matches[0] + pos, 1);
+ *newplace += 1;
pos++;
} else {
beep();
strcat(foo, " ");
+ /* Disable el cursor */
+ curs_set(0);
/* now, put the match on the screen */
waddnstr(edit, foo, strlen(foo));
col += strlen(foo);
}
edit_refresh();
- return newplace;
+ curs_set(1);
+ return buf;
}
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-11-09 23:23-0500\n"
+"POT-Creation-Date: 2000-11-13 23:13-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "File exists, OVERWRITE ?"
msgstr ""
-#: files.c:741
+#: files.c:807
msgid "(more)"
msgstr ""
msgstr ""
#: global.c:344 global.c:364 global.c:375 global.c:385 global.c:401
-#: global.c:405 global.c:411 winio.c:1008
+#: global.c:405 global.c:411 winio.c:1011
msgid "Cancel"
msgstr ""
msgid "Replaced 1 occurence"
msgstr ""
-#: search.c:443 search.c:536 search.c:552
+#: search.c:443 search.c:538 search.c:554
msgid "Replace Cancelled"
msgstr ""
-#: search.c:486
+#: search.c:488
msgid "Replace this instance?"
msgstr ""
-#: search.c:494
+#: search.c:496
msgid "Replace failed: unknown subexpression!"
msgstr ""
-#: search.c:569
+#: search.c:571
#, c-format
msgid "Replace with [%s]"
msgstr ""
-#: search.c:573 search.c:577
+#: search.c:575 search.c:579
msgid "Replace with"
msgstr ""
#. Ask for it
-#: search.c:612
+#: search.c:614
msgid "Enter line number"
msgstr ""
-#: search.c:614
+#: search.c:616
msgid "Aborted"
msgstr ""
-#: search.c:634
+#: search.c:636
msgid "Come on, be reasonable"
msgstr ""
-#: search.c:639
+#: search.c:641
#, c-format
msgid "Only %d lines available, skipping to last line"
msgstr ""
msgid "actual_x_from_start for xplus=%d returned %d\n"
msgstr ""
-#: winio.c:421
+#: winio.c:424
#, c-format
msgid "input '%c' (%d)\n"
msgstr ""
-#: winio.c:459
+#: winio.c:462
msgid "New Buffer"
msgstr ""
-#: winio.c:462
+#: winio.c:465
msgid " File: ..."
msgstr ""
-#: winio.c:470
+#: winio.c:473
msgid "Modified"
msgstr ""
-#: winio.c:922
+#: winio.c:925
#, c-format
msgid "Moved to (%d, %d) in edit buffer\n"
msgstr ""
-#: winio.c:933
+#: winio.c:936
#, c-format
msgid "current->data = \"%s\"\n"
msgstr ""
-#: winio.c:978
+#: winio.c:981
#, c-format
msgid "I got \"%s\"\n"
msgstr ""
-#: winio.c:1003
+#: winio.c:1006
msgid "Yes"
msgstr ""
-#: winio.c:1005
+#: winio.c:1008
msgid "All"
msgstr ""
-#: winio.c:1007
+#: winio.c:1010
msgid "No"
msgstr ""
-#: winio.c:1144
+#: winio.c:1147
#, c-format
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
msgstr ""
-#: winio.c:1148
+#: winio.c:1151
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
msgstr ""
-#: winio.c:1276
+#: winio.c:1279
msgid "Dumping file buffer to stderr...\n"
msgstr ""
-#: winio.c:1278
+#: winio.c:1281
msgid "Dumping cutbuffer to stderr...\n"
msgstr ""
-#: winio.c:1280
+#: winio.c:1283
msgid "Dumping a buffer to stderr...\n"
msgstr ""