mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-02-20 10:29:01 +00:00
Fixed bug in block highlight. Start of word_wrap_para() function WIP.
This commit is contained in:
parent
28e2b8d020
commit
06657eaa94
33
apps/edit.c
33
apps/edit.c
@ -31,14 +31,8 @@
|
||||
|
||||
#define BELL 0x07
|
||||
#define BACKSPACE 0x08
|
||||
#define CURDOWN 0x0a
|
||||
#define RETURN 0x0d
|
||||
#define NOMOUSETXT 0x1b
|
||||
#define HOME 0x19
|
||||
#define CLRLINE 0x1a
|
||||
#define ESC 0x1b
|
||||
#define MOUSETXT 0x1b
|
||||
#define CLREOL 0x1d
|
||||
#define DELETE 0x7f
|
||||
|
||||
#define BUFSZ (41 * 512) // 20.5KB
|
||||
@ -459,10 +453,9 @@ uint8_t read_char_update_pos(void) {
|
||||
col = 0;
|
||||
return 1;
|
||||
}
|
||||
if (do_print) {
|
||||
if (do_print)
|
||||
cputc(c);
|
||||
revers(0);
|
||||
}
|
||||
revers(0);
|
||||
++col;
|
||||
if (do_print)
|
||||
rowlen[row] = col;
|
||||
@ -901,6 +894,23 @@ void page_up(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform word-wrapping on current paragraph
|
||||
*/
|
||||
void word_wrap_para() {
|
||||
uint8_t col = 0;
|
||||
while ((gapbuf[gapbegin] != EOL) && (gapbegin > 0)) {
|
||||
gapbuf[gapend--] = gapbuf[--gapbegin];
|
||||
}
|
||||
if (gapbuf[gapbegin] == EOL)
|
||||
gapbuf[gapbegin++] = gapbuf[++gapend];
|
||||
while ((gapbuf[gapbegin] != EOL) && (gapend < BUFSZ - 1)) {
|
||||
++col;
|
||||
/// TODO FINISH THIS
|
||||
gapbuf[gapbegin++] = gapbuf[++gapend];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Help screen
|
||||
* EDITHELP.TXT is expected to contain lines of exactly 80 chars
|
||||
@ -1220,6 +1230,11 @@ int edit(char *fname) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x80 + 'W': // OA-W "Wrap"
|
||||
case 0x80 + 'w': // OA-w
|
||||
word_wrap_para();
|
||||
draw_screen();
|
||||
break;
|
||||
case 0x80 + 'S': // OA-S "Save"
|
||||
case 0x80 + 's': // OA-s
|
||||
save();
|
||||
|
@ -17,6 +17,7 @@
|
||||
| @-L Load file | @-M Move block of text |
|
||||
| @-N Set file name to save +----------------------------------------+
|
||||
| @-Q Quit | Miscellaneous: |
|
||||
| @-S Save file | @-? This help |
|
||||
| @-S Save file | @-W Word-wrap paragraph |
|
||||
| | @-? This help |
|
||||
| | Ctrl-L Refresh screen |
|
||||
+-------------------------------------+----------------------------------------+
|
||||
|
Loading…
x
Reference in New Issue
Block a user