aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2018-02-24 16:32:20 -0600
committerDevin J. Pohly <djpohly@gmail.com>2018-02-25 21:56:26 -0600
commite0215d53770a9b6bc6e5d7b9a603ecd34dbd7100 (patch)
treeb696b3fa2c69270a198c3bcc1e0a289b12b3538c /st.c
parent30683c70ab62fd37b5921cf72077b9aef2cb842e (diff)
downloadst-e0215d53770a9b6bc6e5d7b9a603ecd34dbd7100.tar.gz
st-e0215d53770a9b6bc6e5d7b9a603ecd34dbd7100.tar.bz2
Reduce visibility wherever possible
When possible, declare functions/variables static and move struct definitions out of headers. In order to allow utf8decode to become internal, use codepoint for DECSCUSR extension directly. Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
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 @@
/* Arbitrary sizes */
#define UTF_INVALID 0xFFFD
+#define UTF_SIZ 4
#define ESC_BUF_SIZ (128*UTF_SIZ)
#define ESC_ARG_SIZ 16
#define STR_BUF_SIZ ESC_BUF_SIZ
@@ -95,6 +96,31 @@ enum escape_state {
ESC_DCS =128,
};
+typedef struct {
+ Glyph attr; /* current char attributes */
+ int x;
+ int y;
+ char state;
+} TCursor;
+
+typedef struct {
+ int mode;
+ int type;
+ int snap;
+ /*
+ * Selection variables:
+ * nb – normalized coordinates of the beginning of the selection
+ * ne – normalized coordinates of the end of the selection
+ * ob – original coordinates of the beginning of the selection
+ * oe – original coordinates of the end of the selection
+ */
+ struct {
+ int x, y;
+ } nb, ne, ob, oe;
+
+ int alt;
+} Selection;
+
/* Internal representation of the screen */
typedef struct {
int row; /* nb row */
@@ -187,15 +213,18 @@ static void tstrsequence(uchar);
static void drawregion(int, int, int, int);
+static void selnormalize(void);
static void selscroll(int, int);
static void selsnap(int *, int *, int);
+static size_t utf8decode(const char *, Rune *, size_t);
static Rune utf8decodebyte(char, size_t *);
static char utf8encodebyte(Rune, size_t);
-static char *utf8strchr(char *s, Rune u);
+static char *utf8strchr(char *, Rune);
static size_t utf8validate(Rune *, size_t);
static char *base64dec(const char *);
+static char base64dec_getc(const char **);
static ssize_t xwrite(int, const char *, size_t);