aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/st.c b/st.c
index ce32cc0..f46aab6 100644
--- a/st.c
+++ b/st.c
@@ -36,6 +36,7 @@
36 36
37/* Arbitrary sizes */ 37/* Arbitrary sizes */
38#define UTF_INVALID 0xFFFD 38#define UTF_INVALID 0xFFFD
39#define UTF_SIZ 4
39#define ESC_BUF_SIZ (128*UTF_SIZ) 40#define ESC_BUF_SIZ (128*UTF_SIZ)
40#define ESC_ARG_SIZ 16 41#define ESC_ARG_SIZ 16
41#define STR_BUF_SIZ ESC_BUF_SIZ 42#define STR_BUF_SIZ ESC_BUF_SIZ
@@ -95,6 +96,31 @@ enum escape_state {
95 ESC_DCS =128, 96 ESC_DCS =128,
96}; 97};
97 98
99typedef struct {
100 Glyph attr; /* current char attributes */
101 int x;
102 int y;
103 char state;
104} TCursor;
105
106typedef struct {
107 int mode;
108 int type;
109 int snap;
110 /*
111 * Selection variables:
112 * nb – normalized coordinates of the beginning of the selection
113 * ne – normalized coordinates of the end of the selection
114 * ob – original coordinates of the beginning of the selection
115 * oe – original coordinates of the end of the selection
116 */
117 struct {
118 int x, y;
119 } nb, ne, ob, oe;
120
121 int alt;
122} Selection;
123
98/* Internal representation of the screen */ 124/* Internal representation of the screen */
99typedef struct { 125typedef struct {
100 int row; /* nb row */ 126 int row; /* nb row */
@@ -187,15 +213,18 @@ static void tstrsequence(uchar);
187 213
188static void drawregion(int, int, int, int); 214static void drawregion(int, int, int, int);
189 215
216static void selnormalize(void);
190static void selscroll(int, int); 217static void selscroll(int, int);
191static void selsnap(int *, int *, int); 218static void selsnap(int *, int *, int);
192 219
220static size_t utf8decode(const char *, Rune *, size_t);
193static Rune utf8decodebyte(char, size_t *); 221static Rune utf8decodebyte(char, size_t *);
194static char utf8encodebyte(Rune, size_t); 222static char utf8encodebyte(Rune, size_t);
195static char *utf8strchr(char *s, Rune u); 223static char *utf8strchr(char *, Rune);
196static size_t utf8validate(Rune *, size_t); 224static size_t utf8validate(Rune *, size_t);
197 225
198static char *base64dec(const char *); 226static char *base64dec(const char *);
227static char base64dec_getc(const char **);
199 228
200static ssize_t xwrite(int, const char *, size_t); 229static ssize_t xwrite(int, const char *, size_t);
201 230