From f665f597ad50120cab1a32908e76755c4f33bc6e Mon Sep 17 00:00:00 2001 From: Bobbi Webber-Manners Date: Wed, 2 Sep 2020 18:42:00 -0400 Subject: [PATCH] EDIT: Help now works even after change of directory in file_ui --- apps/edit.c | 15 +++++++++------ apps/edithelp1.txt | 4 ++-- apps/edithelp2.txt | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/edit.c b/apps/edit.c index a34e9a6..b5c6cec 100644 --- a/apps/edit.c +++ b/apps/edit.c @@ -66,6 +66,7 @@ uint16_t oldgapend = BUFSZ - 1; // ditto char userentry[82] = ""; // Couple extra chars so we can store 80 col line char search[80] = ""; char replace[80] = ""; +char startdir[80] = ""; uint8_t rowlen[NROWS]; // Number of chars on each row of screen @@ -1587,7 +1588,7 @@ void help(uint8_t num) { revers(0); cursor(0); clrscr(); - snprintf(iobuf, 80, "EDITHELP%u.TXT", num); + snprintf(iobuf, 80, "%s/EDITHELP%u.TXT", startdir, num); fp = fopen(iobuf, "rb"); if (!fp) { printf("Can't open help file\n\n"); @@ -2081,7 +2082,7 @@ restart: revers(0); gotoxy(0,1); cprintf("%s", msg2); - getcwd(userentry, 74); + getcwd(userentry, 80); gotoxy(0,3); revers(1); cprintf("%s", (toplevel ? "Volumes" : userentry)); @@ -2141,7 +2142,7 @@ redraw: entry = (struct tabent*)iobuf + current; switch (entry->type) { case 0x0f: // Directory - getcwd(userentry, 74); + getcwd(userentry, 80); if (strcmp(entry->name, "..") == 0) { for (c = strlen(userentry); c > 0; --c) if (userentry[c] == '/') { @@ -2158,7 +2159,7 @@ redraw: strcpy(userentry, entry->name); chdir(userentry); } else { - getcwd(userentry, 74); + getcwd(userentry, 80); strcat(userentry, "/"); strcat(userentry, entry->name); chdir(userentry); @@ -2172,7 +2173,7 @@ redraw: goto done; break; default: - if (prompt_okay("Not a text file") != 0) { + if (prompt_okay("Not a text file, open anyhow") != 0) { strcpy(userentry, ""); goto done; } @@ -2189,7 +2190,7 @@ redraw: goto restart; // ESC pressed if (userentry[0] == '/') // Absolute path goto done; - getcwd(replace, 74); // Otherwise relative path + getcwd(replace, 80); // Otherwise relative path strcat(replace, "/"); strcat(replace, userentry); strcpy(userentry, replace); @@ -2502,6 +2503,7 @@ help1: help(1); c = cgetc(); switch (c) { + case ESC: case 'q': case 'Q': goto donehelp; @@ -2681,6 +2683,7 @@ void main(int argc, char *argv[]) { disconnect_ramdisk(); avail_aux_banks(); init_aux_banks(); + getcwd(startdir, 80); #endif if (argc == 2) { quit_to_email = 1; diff --git a/apps/edithelp1.txt b/apps/edithelp1.txt index e6a6002..5f7475a 100644 --- a/apps/edithelp1.txt +++ b/apps/edithelp1.txt @@ -1,5 +1,5 @@ -------------------------------------------------------------------------------- - v1.22 }}} EDIT.SYSTEM HELP }}} Page One + v1.23 }}} EDIT.SYSTEM HELP }}} Page One --------------------------------------+----------------------------------------- Navigation: | Editing: Cursor keys Move the cursor | [Return] Split line @@ -20,5 +20,5 @@ {-Q Quit | [Delete] Delete selected text | ESC Clear selection --------------+-----------------------| {-Z Undo block operation - [Q]uit help | [Any Other Key] next | + [ESC] exit | [Any Other Key] next | --------------+-----------------------+---------------------------------------- diff --git a/apps/edithelp2.txt b/apps/edithelp2.txt index 5046fee..3ba24d4 100644 --- a/apps/edithelp2.txt +++ b/apps/edithelp2.txt @@ -18,7 +18,7 @@ Buffer Management: Paragraph Formatting | Miscellaneous: {-W Word-wrap paragraph | {-? This help {-U Unwrap paragraph | [CTRL]-L Refresh screen - | + | [ESC] Cancel operation --------------+-----------+------------+---------------------------------------- - [Q]uit help | [Cursor Up] Previous | + [ESC] exit | [Cursor Up] Previous | --------------+------------------------+---------------------------------------