EDIT: Removed old selection mode. Remapped keys. Updated help.

This commit is contained in:
Bobbi Webber-Manners 2020-08-10 20:05:18 -04:00
parent 9d0ee7d7ab
commit 5df64e08c0
2 changed files with 71 additions and 52 deletions

View File

@ -4,7 +4,6 @@
// Bobbi July-Aug 2020 // Bobbi July-Aug 2020
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// TODO: Load or save is one char short!!! Obvious with cut/paste.
// TODO: Buffer list. Prompt unsaved buffers on exit. // TODO: Buffer list. Prompt unsaved buffers on exit.
// TODO: Load big files spanning multiple buffers (& keep track of it) // TODO: Load big files spanning multiple buffers (& keep track of it)
// TODO: Search options - ignore case, complete word. // TODO: Search options - ignore case, complete word.
@ -12,6 +11,7 @@
// Note: Use my fork of cc65 to get a flashing cursor!! // Note: Use my fork of cc65 to get a flashing cursor!!
#define AUXMEM // Still somewhat experimental #define AUXMEM // Still somewhat experimental
#undef OLD_SELMODE // Enable/disable Appleworks-style move/copy/del
#include <conio.h> #include <conio.h>
#include <ctype.h> #include <ctype.h>
@ -441,6 +441,7 @@ void update_status_line(void) {
l_auxbank, modified ? '*' : ' ', filename, (FREESPACE() + 512) / 1024); l_auxbank, modified ? '*' : ' ', filename, (FREESPACE() + 512) / 1024);
l = 44 - strlen(filename); l = 44 - strlen(filename);
break; break;
#ifdef OLD_SELMODE
case SEL_DEL: case SEL_DEL:
cprintf("Del%s", selmsg1); cprintf("Del%s", selmsg1);
l = 80 - 42; l = 80 - 42;
@ -453,10 +454,6 @@ void update_status_line(void) {
cprintf("Move%s", selmsg1); cprintf("Move%s", selmsg1);
l = 80 - 43; l = 80 - 43;
break; break;
case SEL_SEL:
cprintf("Select: OA-[Space] to end");
l = 80 - 25;
break;
case SEL_COPY2: case SEL_COPY2:
cprintf("Copy%scopy", selmsg2); cprintf("Copy%scopy", selmsg2);
l = 80 - 41; l = 80 - 41;
@ -465,6 +462,11 @@ void update_status_line(void) {
cprintf("Move%smove", selmsg2); cprintf("Move%smove", selmsg2);
l = 80 - 41; l = 80 - 41;
break; break;
#endif
case SEL_SEL:
cprintf("Select: OA-[Space] to end");
l = 80 - 25;
break;
case SRCH1: case SRCH1:
cprintf("Searching ..."); cprintf("Searching ...");
l = 80 - 13; l = 80 - 13;
@ -1387,7 +1389,7 @@ void help(void) {
c = p[i]; c = p[i];
if (c == '{') if (c == '{')
printf("%s", openapple); printf("%s", openapple);
if (c == '}') else if (c == '}')
printf("%s", closedapple); printf("%s", closedapple);
else if ((c != '\r') && (c != '\n')) else if ((c != '\r') && (c != '\n'))
putchar(c); putchar(c);
@ -1395,7 +1397,6 @@ void help(void) {
} while (cont); } while (cont);
done: done:
fclose(fp); fclose(fp);
printf("[Press Any Key]");
cgetc(); cgetc();
clrscr(); clrscr();
} }
@ -1430,7 +1431,7 @@ void load_attacher(void) {
*/ */
void save(void) { void save(void) {
if (strlen(filename) == 0) { if (strlen(filename) == 0) {
if (prompt_for_name("File to save", 1) == 255) if (prompt_for_name("*UNSAVED CHANGES* File to save", 1) == 255)
return; // If ESC pressed return; // If ESC pressed
if (strlen(userentry) == 0) if (strlen(userentry) == 0)
return; return;
@ -1754,22 +1755,6 @@ int edit(char *fname) {
case 0x8a: // OA-Down "Page Down" case 0x8a: // OA-Down "Page Down"
page_down(); page_down();
break; break;
#ifdef AUXMEM
case 0x80 + 'B': // OA-B "Buffer"
case 0x80 + 'b': // OA-b
sprintf(userentry, "Buffer # (1-%u)", banktbl[0]);
if (prompt_for_name(userentry, 0) == 255)
break;
if (strlen(userentry) == 0)
break;
tmp = atoi(userentry);
if ((tmp < 1) || (tmp >= banktbl[0])) {
beep();
break;
}
change_aux_bank(tmp);
break;
#endif
case 0x80 + ' ': // OA-SPACE start/end selection case 0x80 + ' ': // OA-SPACE start/end selection
tmp = (startsel == 65535U ? 0 : 1); // Prev selection active? tmp = (startsel == 65535U ? 0 : 1); // Prev selection active?
if (tmp) { if (tmp) {
@ -1782,11 +1767,16 @@ int edit(char *fname) {
update_status_line(); update_status_line();
} }
break; break;
case 0x03: // ^C "Copy" case 0x80 + 'X': // OA-X "Cut"
case 0x80 + 'x': // OA-x
case 0x18: // ^X "Cut" case 0x18: // ^X "Cut"
tmp = 65535U;
case 0x80 + 'C': // OA-C "Copy"
case 0x80 + 'c': // OA-c
case 0x03: // ^C "Copy"
++tmp;
mode = SEL_NONE; mode = SEL_NONE;
tmp = (startsel == 65535U ? 0 : 1); // Selection active? if (startsel == 65535U) { // No selection
if (!tmp) {
beep(); beep();
break; break;
} }
@ -1796,7 +1786,7 @@ int edit(char *fname) {
draw_screen(); draw_screen();
break; break;
} }
if (c == 0x18) { if (tmp == 0) {
jump_pos(startsel); jump_pos(startsel);
gapend += (endsel - startsel); gapend += (endsel - startsel);
set_modified(1); set_modified(1);
@ -1804,6 +1794,8 @@ int edit(char *fname) {
startsel = endsel = 65535U; startsel = endsel = 65535U;
draw_screen(); draw_screen();
break; break;
case 0x80 + 'V': // OA-V "Paste"
case 0x80 + 'v': // OA-v
case 0x16: // ^V "Paste" case 0x16: // ^V "Paste"
mode = SEL_NONE; mode = SEL_NONE;
if (load_file("CLIPBOARD", 0)) if (load_file("CLIPBOARD", 0))
@ -1811,6 +1803,7 @@ int edit(char *fname) {
startsel = endsel = 65535U; startsel = endsel = 65535U;
draw_screen(); draw_screen();
break; break;
#ifdef OLD_SELMODE
case 0x80 + 'C': // OA-C "Copy" case 0x80 + 'C': // OA-C "Copy"
case 0x80 + 'c': // OA-c case 0x80 + 'c': // OA-c
mode = SEL_COPY; mode = SEL_COPY;
@ -1821,6 +1814,8 @@ int edit(char *fname) {
else else
update_status_line(); update_status_line();
break; break;
#endif
#ifdef OLD_SELMODE
case 0x80 + 'D': // OA-D "Delete" case 0x80 + 'D': // OA-D "Delete"
case 0x80 + 'd': // OA-d case 0x80 + 'd': // OA-d
mode = SEL_DEL; mode = SEL_DEL;
@ -1831,6 +1826,7 @@ int edit(char *fname) {
else else
update_status_line(); update_status_line();
break; break;
#endif
case 0x80 + 'R': // OA-R "Replace" case 0x80 + 'R': // OA-R "Replace"
case 0x80 + 'r': // OA-r case 0x80 + 'r': // OA-r
tmp = 65535U; tmp = 65535U;
@ -1893,6 +1889,7 @@ int edit(char *fname) {
} }
draw_screen(); draw_screen();
break; break;
#ifdef OLD_SELMODE
case 0x80 + 'M': // OA-M "Move" case 0x80 + 'M': // OA-M "Move"
case 0x80 + 'm': // OA-m case 0x80 + 'm': // OA-m
mode = SEL_MOVE; mode = SEL_MOVE;
@ -1903,6 +1900,7 @@ int edit(char *fname) {
else else
update_status_line(); update_status_line();
break; break;
#endif
case 0x80 + 'N': // OA-N "Name" case 0x80 + 'N': // OA-N "Name"
case 0x80 + 'n': // OA-n case 0x80 + 'n': // OA-n
if (prompt_for_name("New filename", 1) == 255) if (prompt_for_name("New filename", 1) == 255)
@ -2010,7 +2008,9 @@ int edit(char *fname) {
insert_char(c); insert_char(c);
update_after_insert_char(); update_after_insert_char();
set_modified(1); set_modified(1);
} else { }
#ifdef OLD_SELMODE
else {
order_selection(); order_selection();
switch (mode) { switch (mode) {
case SEL_DEL: case SEL_DEL:
@ -2064,14 +2064,32 @@ copymove2_cleanup:
break; break;
} }
} }
#endif
break; break;
default: default:
#ifdef AUXMEM
if (*(uint8_t*)0xc062 & 0x80) { // Closed Apple depressed if (*(uint8_t*)0xc062 & 0x80) { // Closed Apple depressed
// CA-number (1-9) - quick jump to first 9 buffers // CA-number (1-9) - quick jump to first 9 buffers
if ((c >= '1') && (c <= '9')) { if ((c >= '1') && (c <= '9')) {
change_aux_bank(c - '0'); change_aux_bank(c - '0');
break; break;
} }
// CA-B "Buffer"
if ((c == 'B') || (c == 'b')) {
sprintf(userentry, "Buffer # (1-%u)", banktbl[0]);
if (prompt_for_name(userentry, 0) == 255)
break;
if (strlen(userentry) == 0)
break;
tmp = atoi(userentry);
if ((tmp < 1) || (tmp >= banktbl[0])) {
beep();
break;
}
change_aux_bank(tmp);
break;
}
#endif
} }
//printf("**%02x**", c); //printf("**%02x**", c);
if ((c >= 0x20) && (c < 0x80) && (mode == SEL_NONE)) { if ((c >= 0x20) && (c < 0x80) && (mode == SEL_NONE)) {

View File

@ -1,23 +1,24 @@
+------------------------------------------------------------------------------+ Navigation: | Editing:
| emai//er EDIT.SYSTEM HELP v1.01 Bobbi 2020 | Cursor keys Move the cursor | [Return] Split line
+-------------------------------------+----------------------------------------+ {-Up Page up | [Delete] Delete char left
|Navigation: | Editing: | {-Down Page down | {-[Delete] Delete char right
| Cursor keys Move the cursor | [Return] Split line | {-Left Word left | [Tab] Go to next tabstop
| @-Up Page up | [Delete] Delete char left | {-Right Word right +-----------------------------------------
| @-Down Page down | @-[Delete] Delete char right | {-< Beginning of line | Search and Replace:
| @-Left Word left | [Tab] Go to next tabstop | {-> End of line | {-F Find string
| @-Right Word right +----------------------------------------+ {-1 ... Beginning of file ... | {-R Find and replace string
| @-< Beginning of line | Search and Replace: | {-9 through end of file +-----------------------------------------
| @-> End of line | @-F Find string | --------------------------------------+ Block Commands:
| @-1 ... Beginning of file ... | @-R Find and replace string | File Management Commands | {-[Space] Mark start/end of selection
| @-9 through end of file +----------------------------------------+ {-I Insert file at cursor | {-X Cut selected text
+-------------------------------------+ Block Commands: | {-L Load file | {-C Copy selected text
|File Management Commands | @-C Copy block of text | {-N Set file name to save | {-P Paste previous cut or copy
| @-I Insert file at cursor | @-D Delete block of text | {-Q Quit | [Delete] Delete selected text
| @-L Load file | @-M Move block of text | {-S Save file | ESC Clear selection
| @-N Set file name to save +----------------------------------------+ --------------------------------------+-----------------------------------------
| @-Q Quit | Miscellaneous: | Buffer Management: | Paragraph Formatting:
| @-S Save file | @-W Word-wrap paragraph | }-1 ... Jump to buffer 1 ... | {-W Word-wrap paragrap
| ESC Cancel | @-U Unwrap paragraph | }-9 through buffer 9 | {-U Unwrap paragraph
| @-? This help | Ctrl-L Refresh screen | }-B Select any buffer 1-128 +-----------------------------------------
+-------------------------------------+----------------------------------------+ --------------------------------------+ {-? This help
EDIT.SYSTEM v1.02 | Ctrl-L Refresh screen