From f6519aa1448e62a757d43e57cabd081ab594dfb1 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 17 Apr 2021 20:26:24 -0600 Subject: * Add new hidden feature "Enable Delete Before Writing" that makes Alpine delete a line before overwriting it. It is meant to work around bugs in terminals that need it. Work in collaboration with professor Martin Trusler. --- alpine/addrbook.c | 4 ++++ alpine/mailindx.c | 2 ++ alpine/mailpart.c | 4 +++- alpine/mailview.c | 12 ++++++++++++ alpine/osdep/termin.gen.c | 2 ++ 5 files changed, 23 insertions(+), 1 deletion(-) (limited to 'alpine') diff --git a/alpine/addrbook.c b/alpine/addrbook.c index 2b13ba0b..2860e885 100644 --- a/alpine/addrbook.c +++ b/alpine/addrbook.c @@ -374,11 +374,15 @@ display_book(int start_disp, int cur_line, int old_line, int redraw, Pos *start_ if(cur_line != old_line){ /*--- Repaint old position to erase "cursor" ---*/ + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(old_line + HEADER_ROWS(ps_global)); paint_line(old_line + HEADER_ROWS(ps_global), as.top_ent + old_line, 0, &sp); } /*--- paint the position with the cursor ---*/ + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(cur_line + HEADER_ROWS(ps_global)); paint_line(cur_line + HEADER_ROWS(ps_global), as.top_ent + cur_line, 1, &sp); if(start_pos) diff --git a/alpine/mailindx.c b/alpine/mailindx.c index 6e6feeb1..63f92772 100644 --- a/alpine/mailindx.c +++ b/alpine/mailindx.c @@ -1846,6 +1846,8 @@ paint_index_line(ICE_S *argice, int line, long int msgno, IndexColType sfld, do_arrow = (afld != iNothing); MoveCursor(HEADER_ROWS(ps_global) + line, 0); + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + CleartoEOLN(); /* find the base color for the whole line */ if(cur && !ac && !do_arrow){ diff --git a/alpine/mailpart.c b/alpine/mailpart.c index c5947652..3261c63a 100644 --- a/alpine/mailpart.c +++ b/alpine/mailpart.c @@ -1006,6 +1006,8 @@ attachment_screen_updater(struct pine *ps, ATDISP_S *current, ATT_SCREEN_S *scre if(!(!screen->current || ctmp == screen->current || ctmp == current)) continue; + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(dline + HEADER_ROWS(ps)); if(ctmp && ctmp->dstring){ char *p = tmp_20k_buf; int i, col, x = 0, totlen; @@ -1061,7 +1063,7 @@ attachment_screen_updater(struct pine *ps, ATDISP_S *current, ATT_SCREEN_S *scre && !(F_ON(F_FORCE_LOW_SPEED,ps) || ps->low_speed)) EndInverse(); } - else + else if(F_OFF(F_ENABLE_DEL_WHEN_WRITING, ps_global)) ClearLine(dline + HEADER_ROWS(ps)); } diff --git a/alpine/mailview.c b/alpine/mailview.c index dd4c6a38..1265b051 100644 --- a/alpine/mailview.c +++ b/alpine/mailview.c @@ -4431,6 +4431,8 @@ scroll_scroll_text(long int new_top_line, HANDLE_S *handle, int redraw) if(st->parms->text.src == FileStar) l -= new_top_line; + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(top + lp->where.row); PutLine0n8b(top + lp->where.row, 0, st->text_lines[l], st->line_lengths[l], handle); } @@ -4448,6 +4450,8 @@ scroll_scroll_text(long int new_top_line, HANDLE_S *handle, int redraw) if(st->parms->text.src == FileStar) l -= new_top_line; + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(top + lp->where.row); PutLine0n8b(top + lp->where.row, 0, st->text_lines[l], st->line_lengths[l], handle); } @@ -4507,6 +4511,8 @@ scroll_scroll_text(long int new_top_line, HANDLE_S *handle, int redraw) if(st->parms->text.src == FileStar) l -= new_top_line; + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(top + lp->where.row); PutLine0n8b(top + lp->where.row, 0, st->text_lines[l], st->line_lengths[l], handle); } @@ -4521,6 +4527,8 @@ scroll_scroll_text(long int new_top_line, HANDLE_S *handle, int redraw) : st->top_text_line + num_display_lines; if(l < st->num_lines){ + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(st->screen.start_line + num_display_lines - 1); PutLine0n8b(st->screen.start_line + num_display_lines - 1, 0, st->text_lines[l], st->line_lengths[l], handle ? handle : st->parms->text.handles); @@ -4549,6 +4557,8 @@ scroll_scroll_text(long int new_top_line, HANDLE_S *handle, int redraw) l = (st->parms->text.src == FileStar) ? st->top_text_line - new_top_line : st->top_text_line; + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(st->screen.start_line); PutLine0n8b(st->screen.start_line, 0, st->text_lines[l], st->line_lengths[l], handle ? handle : st->parms->text.handles); @@ -4574,6 +4584,8 @@ scroll_scroll_text(long int new_top_line, HANDLE_S *handle, int redraw) for(lp = handle->loc; lp; lp = lp->next) if(lp->where.row >= st->top_text_line && lp->where.row < st->top_text_line + st->screen.length){ + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(st->screen.start_line + (lp->where.row - st->top_text_line)); PutLine0n8b(st->screen.start_line + (lp->where.row - st->top_text_line), 0, st->text_lines[lp->where.row], diff --git a/alpine/osdep/termin.gen.c b/alpine/osdep/termin.gen.c index 99cdb4ce..b8d01b15 100644 --- a/alpine/osdep/termin.gen.c +++ b/alpine/osdep/termin.gen.c @@ -432,6 +432,8 @@ optionally_enter(char *utf8string, int y_base, int x_base, int utf8string_size, draw_keymenu(km, bitmap, cols, 1-FOOTER_ROWS(ps_global), 0, FirstMenu); } + if(F_ON(F_ENABLE_DEL_WHEN_WRITING, ps_global)) + ClearLine(real_y_base); if(pico_usingcolor() && VAR_PROMPT_FORE_COLOR && VAR_PROMPT_BACK_COLOR && pico_is_good_color(VAR_PROMPT_FORE_COLOR) && -- cgit v1.2.3-54-g00ecf