From 1cc56f5e6c1f2e4fd9286a6262b6374ade75ac32 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Thu, 26 Sep 2024 14:47:51 -0700 Subject: [PATCH] Add uifcapi_t.reverse_cursor (BOOL), default is FALSE Setting this to TRUE reverses the type of cursor used to indicate insert versus overwrite mode (solid/block cursor veruss underline/normal cursor). Deuce probably wants to set this to TRUE for SyncTERM. --- src/uifc/uifc.h | 4 ++++ src/uifc/uifc32.c | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/uifc/uifc.h b/src/uifc/uifc.h index 4e048f1f0e..e95139c053 100644 --- a/src/uifc/uifc.h +++ b/src/uifc/uifc.h @@ -351,6 +351,10 @@ typedef struct { /****************************************************************************/ BOOL insert_mode; /****************************************************************************/ +/* Set to TRUE to reverse the insert/overwrite cursor choice */ +/****************************************************************************/ + BOOL reverse_cursor; +/****************************************************************************/ /* The overlapped-window save buffer number. */ /****************************************************************************/ uint savnum; diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c index 459b0d3e68..782f27fa3d 100644 --- a/src/uifc/uifc32.c +++ b/src/uifc/uifc32.c @@ -2144,6 +2144,14 @@ void getstrupd(int left, int top, int width, char *outstr, int cursoffset, int * _setcursortype(cursor); } +static void set_cursor_type(uifcapi_t* api) +{ + BOOL block_cursor = api->insert_mode; + if(api->reverse_cursor) + block_cursor = !block_cursor; + _setcursortype(cursor = (block_cursor ? _SOLIDCURSOR : _NORMALCURSOR)); +} + /****************************************************************************/ /* Gets a string of characters from the user. Turns cursor on. Allows */ /* Different modes - K_* macros. ESC aborts input. */ @@ -2166,7 +2174,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int return(-1); } gotoxy(left,top); - _setcursortype(cursor = api->insert_mode ? _SOLIDCURSOR : _NORMALCURSOR); + set_cursor_type(api); str[0]=0; if(mode&K_EDIT && outstr[0]) { /*** @@ -2380,7 +2388,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int continue; case CIO_KEY_IC: /* insert */ api->insert_mode = !api->insert_mode; - _setcursortype(cursor = api->insert_mode ? _SOLIDCURSOR : _NORMALCURSOR); + set_cursor_type(api); continue; case BS: if(i) @@ -2908,7 +2916,7 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons lines=0; k=0; for(j=0;j<len;j++) { - if(mode&WIN_HLP && (hbuf[j]==2 || hbuf[j]=='~' || hbuf[j]==1 || hbuf[j]=='`')) + if((mode&WIN_HLP) && (hbuf[j]==2 || hbuf[j]=='~' || hbuf[j]==1 || hbuf[j]=='`')) continue; if(hbuf[j]==CR) continue; @@ -2947,11 +2955,11 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons ++i; } } - else if(mode&WIN_HLP && (hbuf[j]==2 || hbuf[j]=='~')) { /* Ctrl-b toggles inverse */ + else if((mode&WIN_HLP) && (hbuf[j]==2 || hbuf[j]=='~')) { inverse=!inverse; i--; } - else if(mode&WIN_HLP && (hbuf[j]==1 || hbuf[j]=='`')) { /* Ctrl-a toggles high intensity */ + else if((mode&WIN_HLP) && (hbuf[j]==1 || hbuf[j]=='`')) { high=!high; i--; } -- GitLab