dirName = malloc(strlen(buf) + 1);
tmp = buf + strlen(buf);
while (*tmp != '/' && tmp != buf)
- tmp--;
+ tmp--;
tmp++;
fprintf(stderr, "\nbuf = %s\n", buf);
fprintf(stderr, "\ntmp = %s\n", tmp);
#endif
-
+
dir = opendir(dirName);
if (!dir) {
/* Don't print an error, just shut up and return */
/* This function now has an arg which refers to how much the
* statusbar (place) should be advanced, i.e. the new cursor pos.
*/
-char *input_tab(char *buf, int place, int lastWasTab, int *newplace)
+char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
{
/* Do TAB completion */
static int num_matches = 0, match_matches = 0;
char *foo;
struct stat fileinfo;
- if (lastWasTab == FALSE) {
+ if (*lastWasTab == FALSE) {
char *tmp, *copyto, *matchBuf;
+ *lastWasTab = 1;
+
/* For now, we will not bother with trying to distinguish
* whether the cursor is in/at a command extression -- we
* will always try all possible matches. If you don't like
* then try completing this word as a username. */
/* FIXME -- this check is broken!
- if (*tmp == '~' && !strchr(tmp, '/'))
- matches = username_tab_completion(tmp, &num_matches); */
+ if (*tmp == '~' && !strchr(tmp, '/'))
+ matches = username_tab_completion(tmp, &num_matches); */
/* Try to match everything in the current working directory that
* matches. */
fprintf(stderr, "%d matches found...\n", num_matches);
#endif
/* Did we find exactly one match? */
- switch(num_matches) {
+ switch (num_matches) {
case 0:
blank_edit();
break;
buf = nrealloc(buf, strlen(buf) + strlen(matches[0]) + 1);
if (strcmp(buf, "") && strstr(buf, "/")) {
- for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf; tmp--)
- ;
+ for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf;
+ tmp--);
tmp++;
- }
- else
+ } else
tmp = buf;
if (!strcmp(tmp, matches[0])) {
/* Is it a directory? */
if (stat(buf, &fileinfo) == -1)
- break;
+ break;
else if (S_ISDIR(fileinfo.st_mode)) {
- strncat(buf, "/", 1);
- *newplace += 1;
+ strncat(buf, "/", 1);
+ *newplace += 1;
+ /* now we start over again with # of tabs so far */
+ *lastWasTab = 0;
}
break;
}
copyto = tmp;
- for (pos = 0; *tmp == matches[0][pos] &&
- pos <= strlen(matches[0]); pos++)
+ 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(copyto, matches[0], strlen(matches[0]) + 1);
+ 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;
- }
+ if (stat(buf, &fileinfo) == -1);
+ else if (S_ISDIR(fileinfo.st_mode)) {
+ strncat(buf, "/", 1);
+ *newplace += 1;
+ /* now we start over again with # of tabs so far */
+ *lastWasTab = 0;
+ }
break;
default:
/* Check to see if all matches share a beginning, and if so
- tack it onto buf and then beep */
+ tack it onto buf and then beep */
if (strcmp(buf, "") && strstr(buf, "/")) {
- for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf; tmp--)
- ;
+ for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf;
+ tmp--);
tmp++;
- }
- else
+ } else
tmp = buf;
for (pos = 0; *tmp == matches[0][pos] && *tmp != 0 &&
- pos <= strlen(matches[0]); pos++)
+ pos <= strlen(matches[0]); pos++)
tmp++;
while (1) {
else if (matches[i][pos] == matches[0][pos])
match_matches++;
}
- if (match_matches == num_matches &&
- (i == num_matches || matches[i] != 0)) {
+ if (match_matches == num_matches &&
+ (i == num_matches || matches[i] != 0)) {
/* All the matches have the same character at pos+1,
- so paste it into buf... */
+ so paste it into buf... */
buf = nrealloc(buf, strlen(buf) + 2);
strncat(buf, matches[0] + pos, 1);
- *newplace += 1;
+ *newplace += 1;
pos++;
} else {
beep();
/* Print the list of matches */
for (i = 0, col = 0; i < num_matches; i++) {
-
+
/* make each filename shown be the same length as the longest
- filename, with two spaces at the end */
+ filename, with two spaces at the end */
snprintf(foo, longestname + 1, matches[i]);
while (strlen(foo) < longestname)
strcat(foo, " ");
/* And if the next match isn't going to fit on the
line, move to the next one */
- if (col > (COLS - longestname) && matches[i + 1] != NULL) {
+ if (col > (COLS - longestname) && matches[i + 1] != NULL) {
editline++;
wmove(edit, editline, 0);
- if (editline == editwinrows - 1) {
- waddstr(edit, _("(more)"));
- break;
- }
+ if (editline == editwinrows - 1) {
+ waddstr(edit, _("(more)"));
+ break;
+ }
col = 0;
}
}
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-11-13 23:13-0500\n"
+"POT-Creation-Date: 2000-11-14 13:25-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:807
+#: files.c:801
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:1011
+#: global.c:405 global.c:411 winio.c:1012
msgid "Cancel"
msgstr ""
msgid "Replaced 1 occurence"
msgstr ""
-#: search.c:443 search.c:538 search.c:554
+#: search.c:443 search.c:536 search.c:552
msgid "Replace Cancelled"
msgstr ""
-#: search.c:488
+#: search.c:486
msgid "Replace this instance?"
msgstr ""
-#: search.c:496
+#: search.c:494
msgid "Replace failed: unknown subexpression!"
msgstr ""
-#: search.c:571
+#: search.c:569
#, c-format
msgid "Replace with [%s]"
msgstr ""
-#: search.c:575 search.c:579
+#: search.c:573 search.c:577
msgid "Replace with"
msgstr ""
#. Ask for it
-#: search.c:614
+#: search.c:612
msgid "Enter line number"
msgstr ""
-#: search.c:616
+#: search.c:614
msgid "Aborted"
msgstr ""
-#: search.c:636
+#: search.c:634
msgid "Come on, be reasonable"
msgstr ""
-#: search.c:641
+#: search.c:639
#, 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:424
+#: winio.c:425
#, c-format
msgid "input '%c' (%d)\n"
msgstr ""
-#: winio.c:462
+#: winio.c:463
msgid "New Buffer"
msgstr ""
-#: winio.c:465
+#: winio.c:466
msgid " File: ..."
msgstr ""
-#: winio.c:473
+#: winio.c:474
msgid "Modified"
msgstr ""
-#: winio.c:925
+#: winio.c:926
#, c-format
msgid "Moved to (%d, %d) in edit buffer\n"
msgstr ""
-#: winio.c:936
+#: winio.c:937
#, c-format
msgid "current->data = \"%s\"\n"
msgstr ""
-#: winio.c:981
+#: winio.c:982
#, c-format
msgid "I got \"%s\"\n"
msgstr ""
-#: winio.c:1006
+#: winio.c:1007
msgid "Yes"
msgstr ""
-#: winio.c:1008
+#: winio.c:1009
msgid "All"
msgstr ""
-#: winio.c:1010
+#: winio.c:1011
msgid "No"
msgstr ""
-#: winio.c:1147
+#: winio.c:1148
#, c-format
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
msgstr ""
-#: winio.c:1151
+#: winio.c:1152
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
msgstr ""
-#: winio.c:1279
+#: winio.c:1280
msgid "Dumping file buffer to stderr...\n"
msgstr ""
-#: winio.c:1281
+#: winio.c:1282
msgid "Dumping cutbuffer to stderr...\n"
msgstr ""
-#: winio.c:1283
+#: winio.c:1284
msgid "Dumping a buffer to stderr...\n"
msgstr ""