mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-01-16 11:30:10 +00:00
Fixed a screen update bug in EDIT when deleting char on last line of file
This commit is contained in:
parent
769be4a11a
commit
61c8763ff4
21
apps/edit.c
21
apps/edit.c
@ -6,7 +6,7 @@
|
|||||||
// Note use my fork of cc65 to get a flashing cursor!!
|
// Note use my fork of cc65 to get a flashing cursor!!
|
||||||
|
|
||||||
// TODO: Improve status line, refresh it properly
|
// TODO: Improve status line, refresh it properly
|
||||||
// TODO: Minor bug - can delete more chars from status line than should be able to
|
// TODO: Minor bug - can delete too many chars from status line
|
||||||
// TODO: Should be smarter about redrawing when updating selection!!!
|
// TODO: Should be smarter about redrawing when updating selection!!!
|
||||||
// TODO: Doesn't check for error cases when calling gap buffer functions
|
// TODO: Doesn't check for error cases when calling gap buffer functions
|
||||||
// TODO: Make use of aux mem
|
// TODO: Make use of aux mem
|
||||||
@ -41,7 +41,7 @@
|
|||||||
#define CLREOL 0x1d
|
#define CLREOL 0x1d
|
||||||
#define DELETE 0x7f
|
#define DELETE 0x7f
|
||||||
|
|
||||||
#define BUFSZ (20 * 1024)
|
#define BUFSZ (39 * 512)
|
||||||
char gapbuf[BUFSZ];
|
char gapbuf[BUFSZ];
|
||||||
char padding = 0; // To null terminate for strstr()
|
char padding = 0; // To null terminate for strstr()
|
||||||
uint16_t gapbegin = 0;
|
uint16_t gapbegin = 0;
|
||||||
@ -510,6 +510,19 @@ void scroll_down() {
|
|||||||
draw_screen();
|
draw_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns 1 if current position in gap buffer is on the last line of
|
||||||
|
* the file (ie: no following CR), 0 otherwise
|
||||||
|
*/
|
||||||
|
uint8_t is_last_line(void) {
|
||||||
|
uint16_t p = gapend + 1;
|
||||||
|
while (p < BUFSZ) {
|
||||||
|
if (gapbuf[p++] == '\r')
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update screen after delete_char_right()
|
* Update screen after delete_char_right()
|
||||||
*/
|
*/
|
||||||
@ -526,6 +539,8 @@ void update_after_delete_char_right(void) {
|
|||||||
i = col;
|
i = col;
|
||||||
eol = read_char_update_pos();
|
eol = read_char_update_pos();
|
||||||
}
|
}
|
||||||
|
if (is_last_line())
|
||||||
|
putchar(CLREOL);
|
||||||
|
|
||||||
// If necessary, print rest of screen
|
// If necessary, print rest of screen
|
||||||
if ((gapbuf[gapend] == EOL) || (i == NCOLS - 1)) {
|
if ((gapbuf[gapend] == EOL) || (i == NCOLS - 1)) {
|
||||||
@ -592,6 +607,8 @@ void update_after_delete_char(void) {
|
|||||||
i = col;
|
i = col;
|
||||||
eol = read_char_update_pos();
|
eol = read_char_update_pos();
|
||||||
}
|
}
|
||||||
|
if (is_last_line())
|
||||||
|
putchar(CLREOL);
|
||||||
|
|
||||||
// If necessary, print rest of screen
|
// If necessary, print rest of screen
|
||||||
if ((gapbuf[gapbegin] == EOL) || (i == NCOLS - 1)) {
|
if ((gapbuf[gapbegin] == EOL) || (i == NCOLS - 1)) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Bobbi June 2020
|
// Bobbi June 2020
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define PROGNAME "emai//er v0.91"
|
#define PROGNAME "emai//er v0.92"
|
||||||
|
|
||||||
// Configuration params from POP65.CFG
|
// Configuration params from POP65.CFG
|
||||||
char cfg_server[40]; // IP of POP3 server
|
char cfg_server[40]; // IP of POP3 server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user