diff options
Diffstat (limited to '')
| -rw-r--r-- | st.c | 31 |
1 files changed, 30 insertions, 1 deletions
| @@ -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 | ||
| 99 | typedef struct { | ||
| 100 | Glyph attr; /* current char attributes */ | ||
| 101 | int x; | ||
| 102 | int y; | ||
| 103 | char state; | ||
| 104 | } TCursor; | ||
| 105 | |||
| 106 | typedef 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 */ |
| 99 | typedef struct { | 125 | typedef struct { |
| 100 | int row; /* nb row */ | 126 | int row; /* nb row */ |
| @@ -187,15 +213,18 @@ static void tstrsequence(uchar); | |||
| 187 | 213 | ||
| 188 | static void drawregion(int, int, int, int); | 214 | static void drawregion(int, int, int, int); |
| 189 | 215 | ||
| 216 | static void selnormalize(void); | ||
| 190 | static void selscroll(int, int); | 217 | static void selscroll(int, int); |
| 191 | static void selsnap(int *, int *, int); | 218 | static void selsnap(int *, int *, int); |
| 192 | 219 | ||
| 220 | static size_t utf8decode(const char *, Rune *, size_t); | ||
| 193 | static Rune utf8decodebyte(char, size_t *); | 221 | static Rune utf8decodebyte(char, size_t *); |
| 194 | static char utf8encodebyte(Rune, size_t); | 222 | static char utf8encodebyte(Rune, size_t); |
| 195 | static char *utf8strchr(char *s, Rune u); | 223 | static char *utf8strchr(char *, Rune); |
| 196 | static size_t utf8validate(Rune *, size_t); | 224 | static size_t utf8validate(Rune *, size_t); |
| 197 | 225 | ||
| 198 | static char *base64dec(const char *); | 226 | static char *base64dec(const char *); |
| 227 | static char base64dec_getc(const char **); | ||
| 199 | 228 | ||
| 200 | static ssize_t xwrite(int, const char *, size_t); | 229 | static ssize_t xwrite(int, const char *, size_t); |
| 201 | 230 | ||
