diff options
Diffstat (limited to 'include/visio.h')
-rw-r--r-- | include/visio.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/visio.h b/include/visio.h index f64a1e3d..626f12e5 100644 --- a/include/visio.h +++ b/include/visio.h @@ -83,7 +83,14 @@ typedef struct VCOL { #define VGETCB_END (2) // finish input #define VGETCB_ABORT (3) // clear buffer and finish -typedef int (*VGET_FCALLBACK)(int key, char *buf, int *picurr, int *piend, int len, void *param); +typedef struct { + char *buf; + const int len; // callbacks should not change this. + int icurr; // cursor position + int iend; // buffer tail (= strlen(buf)) +} VGET_RUNTIME; + +typedef int (*VGET_FCALLBACK)(int key, VGET_RUNTIME *prt, void *instance); typedef struct { VGET_FCALLBACK peek; // called immediately after key hit VGET_FCALLBACK data; // called before inserting character data @@ -122,7 +129,7 @@ void vshowmsg(const char *msg); /// draw standard pause/message int vgets (char *buf, int len, int flags); /// input with edit box control int vgetstr (char *buf, int len, int flags, const char *str);/// input with default value int vget (int y, int x, const char *prompt, char *buf, int len, int mode); -int vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBACKS *pcb, void *cbparam); +int vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBACKS *pcbs, void *instance); // vs_*: formatted and themed virtual screen layout // you cannot use ANSI escapes in these APIs. |