From 44b7ae5451109d4bf4d63f3ade2de3ffda20bd15 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Thu, 12 Oct 2017 06:44:38 +0000 Subject: [PATCH] Remove the F6 Paste option from the bottom-line (status bar) when not applicable. --- src/uifc/uifc32.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c index 340db9ac24..b095b97084 100644 --- a/src/uifc/uifc32.c +++ b/src/uifc/uifc32.c @@ -678,23 +678,32 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar tbrdrwidth=0; bbrdrwidth=0; } + /* Count the options */ + while (option != NULL && opts < MAX_OPTS) { + if (option[opts] == NULL || option[opts][0] == 0) + break; + else opts++; + } + if (mode&WIN_XTR && opts<MAX_OPTS) + opts++; + /* Sanity-check the savnum */ if(mode&WIN_SAV && api->savnum>=MAX_BUFS-1) putch(7); + + /* Create the status bar/bottom-line */ if(api->helpbuf!=NULL || api->helpixbfile[0]!=0) bline|=BL_HELP; if(mode&WIN_INS) bline|=BL_INS; if(mode&WIN_DEL) bline|=BL_DEL; if(mode&WIN_GET) bline|=BL_GET; if(mode&WIN_PUT) bline|=BL_PUT; if(mode&WIN_EDIT) bline|=BL_EDIT; - if(api->bottomline != NULL) - api->bottomline(bline); - while(option!=NULL && opts<MAX_OPTS) - if(option[opts]==NULL || option[opts][0]==0) - break; - else opts++; - if(mode&WIN_XTR && opts<MAX_OPTS) - opts++; + if (api->bottomline != NULL) { + if ((mode&(WIN_XTR | WIN_PASTEXTR)) == WIN_XTR && (*cur) == opts - 1) + api->bottomline(bline & ~BL_PUT); + else + api->bottomline(bline); + } optheight=opts+vbrdrsize; height=optheight; if(mode&WIN_FIXEDHEIGHT) { @@ -714,7 +723,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar } } } - /* Determine minimum widths here to accomodate mouse "icons" in border */ + /* Determine minimum widths here to accommodate mouse "icons" in border */ if(!(mode&WIN_NOBRDR) && api->mode&UIFC_MOUSE) { if(bline&BL_HELP && width<8) width=8; @@ -1596,7 +1605,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar return((*cur) | MSK_PASTE_INSERT); break; case CIO_KEY_F(6): /* F6 - Paste-Over */ - if(mode&WIN_PUT && (mode&WIN_PASTEXTR || !(mode&WIN_PASTEXTR && (*cur)==opts-1))) + if(mode&WIN_PUT && (mode&WIN_PASTEXTR || !(mode&WIN_XTR && (*cur)==opts-1))) return((*cur)|MSK_PASTE_OVER); break; case CIO_KEY_IC: /* insert */ @@ -1815,6 +1824,13 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar return(-2-gotkey); } } + /* Update the status bar to reflect the Put/Paste option applicability */ + if (bline&BL_PUT && api->bottomline != NULL) { + if ((mode&(WIN_XTR | WIN_PASTEXTR)) == WIN_XTR && (*cur) == opts - 1) + api->bottomline(bline & ~BL_PUT); + else + api->bottomline(bline); + } } else mswait(1); -- GitLab