mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-09-30 14:57:08 +00:00
Added OA-U 'unwrap paragraph' function
This commit is contained in:
parent
0239a03923
commit
04b4d29eef
13
apps/edit.c
13
apps/edit.c
@ -893,8 +893,10 @@ void page_up(void) {
|
||||
|
||||
/*
|
||||
* Perform word-wrapping on current paragraph
|
||||
* addbreaks - if 1, add breaks to do word wrap, otherwise it 'unwraps'
|
||||
* (ie: removes all carriage returns in paragraph)
|
||||
*/
|
||||
void word_wrap_para() {
|
||||
void word_wrap_para(uint8_t addbreaks) {
|
||||
uint16_t i = gapbegin;
|
||||
uint8_t rets = 0, col = 0;
|
||||
uint16_t startpara = 0;
|
||||
@ -916,7 +918,7 @@ void word_wrap_para() {
|
||||
if (gapbuf[i] == '\r')
|
||||
gapbuf[i] = ' ';
|
||||
++col;
|
||||
if (col == 76) {
|
||||
if (addbreaks && (col == 76)) {
|
||||
// Backtrack to find a space
|
||||
while ((gapbuf[i] != ' ') && (i > startpara))
|
||||
--i;
|
||||
@ -1256,9 +1258,14 @@ int edit(char *fname) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x80 + 'U': // OA-U "Unwrap"
|
||||
case 0x80 + 'u': // OA-w
|
||||
word_wrap_para(0);
|
||||
draw_screen();
|
||||
break;
|
||||
case 0x80 + 'W': // OA-W "Wrap"
|
||||
case 0x80 + 'w': // OA-w
|
||||
word_wrap_para();
|
||||
word_wrap_para(1);
|
||||
draw_screen();
|
||||
break;
|
||||
case 0x80 + 'S': // OA-S "Save"
|
||||
|
@ -18,6 +18,6 @@
|
||||
| @-N Set file name to save +----------------------------------------+
|
||||
| @-Q Quit | Miscellaneous: |
|
||||
| @-S Save file | @-W Word-wrap paragraph |
|
||||
| | @-? This help |
|
||||
| | Ctrl-L Refresh screen |
|
||||
| | @-U Unwrap paragraph |
|
||||
| @-? This help | Ctrl-L Refresh screen |
|
||||
+-------------------------------------+----------------------------------------+
|
||||
|
Loading…
Reference in New Issue
Block a user