Skip to content
Snippets Groups Projects
Commit 1cc56f5e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

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.
parent 5fdf6bc5
No related branches found
No related tags found
No related merge requests found
Pipeline #6702 passed
...@@ -351,6 +351,10 @@ typedef struct { ...@@ -351,6 +351,10 @@ typedef struct {
/****************************************************************************/ /****************************************************************************/
BOOL insert_mode; BOOL insert_mode;
/****************************************************************************/ /****************************************************************************/
/* Set to TRUE to reverse the insert/overwrite cursor choice */
/****************************************************************************/
BOOL reverse_cursor;
/****************************************************************************/
/* The overlapped-window save buffer number. */ /* The overlapped-window save buffer number. */
/****************************************************************************/ /****************************************************************************/
uint savnum; uint savnum;
......
...@@ -2144,6 +2144,14 @@ void getstrupd(int left, int top, int width, char *outstr, int cursoffset, int * ...@@ -2144,6 +2144,14 @@ void getstrupd(int left, int top, int width, char *outstr, int cursoffset, int *
_setcursortype(cursor); _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 */ /* Gets a string of characters from the user. Turns cursor on. Allows */
/* Different modes - K_* macros. ESC aborts input. */ /* 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 ...@@ -2166,7 +2174,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
return(-1); return(-1);
} }
gotoxy(left,top); gotoxy(left,top);
_setcursortype(cursor = api->insert_mode ? _SOLIDCURSOR : _NORMALCURSOR); set_cursor_type(api);
str[0]=0; str[0]=0;
if(mode&K_EDIT && outstr[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 ...@@ -2380,7 +2388,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
continue; continue;
case CIO_KEY_IC: /* insert */ case CIO_KEY_IC: /* insert */
api->insert_mode = !api->insert_mode; api->insert_mode = !api->insert_mode;
_setcursortype(cursor = api->insert_mode ? _SOLIDCURSOR : _NORMALCURSOR); set_cursor_type(api);
continue; continue;
case BS: case BS:
if(i) if(i)
...@@ -2908,7 +2916,7 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons ...@@ -2908,7 +2916,7 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons
lines=0; lines=0;
k=0; k=0;
for(j=0;j<len;j++) { 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; continue;
if(hbuf[j]==CR) if(hbuf[j]==CR)
continue; continue;
...@@ -2947,11 +2955,11 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons ...@@ -2947,11 +2955,11 @@ void showbuf(uifc_winmode_t mode, int left, int top, int width, int height, cons
++i; ++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; inverse=!inverse;
i--; 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; high=!high;
i--; i--;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment