Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Add missing function prototypes.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
9a979ea
..
7afff39
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-394,10
+394,12
@@
static void tsetmode(bool, bool, int *, int);
static void tfulldirt(void);
static void techo(char *, int);
static bool tcontrolcode(uchar );
static void tfulldirt(void);
static void techo(char *, int);
static bool tcontrolcode(uchar );
+static void tdectest(char );
static int32_t tdefcolor(int *, int *, int);
static void tselcs(void);
static void tdeftran(char);
static inline bool match(uint, uint);
static int32_t tdefcolor(int *, int *, int);
static void tselcs(void);
static void tdeftran(char);
static inline bool match(uint, uint);
+static void dump(char c);
static void ttynew(void);
static void ttyread(void);
static void ttyresize(void);
static void ttynew(void);
static void ttyread(void);
static void ttyresize(void);
@@
-448,6
+450,8
@@
static char *getsel(void);
static void selcopy(void);
static void selscroll(int, int);
static void selsnap(int, int *, int *, int);
static void selcopy(void);
static void selscroll(int, int);
static void selsnap(int, int *, int *, int);
+static void getbuttoninfo(XEvent *);
+static void mousereport(XEvent *);
static size_t utf8decode(char *, long *, size_t);
static long utf8decodebyte(char, size_t *);
static size_t utf8decode(char *, long *, size_t);
static long utf8decodebyte(char, size_t *);
@@
-461,6
+465,8
@@
static void *xmalloc(size_t);
static void *xrealloc(void *, size_t);
static char *xstrdup(char *);
static void *xrealloc(void *, size_t);
static char *xstrdup(char *);
+static void usage(void);
+
static void (*handler[LASTEvent])(XEvent *) = {
[KeyPress] = kpress,
[ClientMessage] = cmessage,
static void (*handler[LASTEvent])(XEvent *) = {
[KeyPress] = kpress,
[ClientMessage] = cmessage,
@@
-2086,8
+2092,8
@@
csihandle(void) {
len = snprintf(buf, sizeof(buf),"\033[%i;%iR",
term.c.y+1, term.c.x+1);
ttywrite(buf, len);
len = snprintf(buf, sizeof(buf),"\033[%i;%iR",
term.c.y+1, term.c.x+1);
ttywrite(buf, len);
- break;
}
}
+ break;
case 'r': /* DECSTBM -- Set Scrolling Region */
if(csiescseq.priv) {
goto unknown;
case 'r': /* DECSTBM -- Set Scrolling Region */
if(csiescseq.priv) {
goto unknown;
@@
-2425,12
+2431,26
@@
tcontrolcode(uchar ascii) {
return 1;
}
return 1;
}
+void
+tdectest(char c) {
+ static char E[UTF_SIZ] = "E";
+ int x, y;
+
+ if(c == '8') { /* DEC screen alignment test. */
+ for(x = 0; x < term.col; ++x) {
+ for(y = 0; y < term.row; ++y)
+ tsetchar(E, &term.c.attr, x, y);
+ }
+ }
+}
+
void
tputc(char *c, int len) {
uchar ascii;
bool control;
long unicodep;
int width;
void
tputc(char *c, int len) {
uchar ascii;
bool control;
long unicodep;
int width;
+ Glyph *gp;
if(len == 1) {
width = 1;
if(len == 1) {
width = 1;
@@
-2504,15
+2524,7
@@
tputc(char *c, int len) {
tdeftran(ascii);
tselcs();
} else if(term.esc & ESC_TEST) {
tdeftran(ascii);
tselcs();
} else if(term.esc & ESC_TEST) {
- if(ascii == '8') { /* DEC screen alignment test. */
- char E[UTF_SIZ] = "E";
- int x, y;
-
- for(x = 0; x < term.col; ++x) {
- for(y = 0; y < term.row; ++y)
- tsetchar(E, &term.c.attr, x, y);
- }
- }
+ tdectest(ascii);
} else {
switch(ascii) {
case '[':
} else {
switch(ascii) {
case '[':
@@
-2601,16
+2613,15
@@
tputc(char *c, int len) {
return;
if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
selclear(NULL);
return;
if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
selclear(NULL);
+
+ gp = &term.line[term.c.y][term.c.x];
if(IS_SET(MODE_WRAP) && (term.c.state & CURSOR_WRAPNEXT)) {
if(IS_SET(MODE_WRAP) && (term.c.state & CURSOR_WRAPNEXT)) {
-
term.line[term.c.y][term.c.x].
mode |= ATTR_WRAP;
+
gp->
mode |= ATTR_WRAP;
tnewline(1);
}
tnewline(1);
}
- if(IS_SET(MODE_INSERT) && term.c.x+1 < term.col) {
- memmove(&term.line[term.c.y][term.c.x+1],
- &term.line[term.c.y][term.c.x],
- (term.col - term.c.x - 1) * sizeof(Glyph));
- }
+ if(IS_SET(MODE_INSERT) && term.c.x+1 < term.col)
+ memmove(gp+1, gp, (term.col - term.c.x - 1) * sizeof(Glyph));
if(term.c.x+width > term.col)
tnewline(1);
if(term.c.x+width > term.col)
tnewline(1);
@@
-2618,10
+2629,10
@@
tputc(char *c, int len) {
tsetchar(c, &term.c.attr, term.c.x, term.c.y);
if(width == 2) {
tsetchar(c, &term.c.attr, term.c.x, term.c.y);
if(width == 2) {
-
term.line[term.c.y][term.c.x].
mode |= ATTR_WIDE;
+
gp->
mode |= ATTR_WIDE;
if(term.c.x+1 < term.col) {
if(term.c.x+1 < term.col) {
-
term.line[term.c.y][term.c.x+
1].c[0] = '\0';
-
term.line[term.c.y][term.c.x+
1].mode = ATTR_WDUMMY;
+
gp[
1].c[0] = '\0';
+
gp[
1].mode = ATTR_WDUMMY;
}
}
if(term.c.x+width < term.col) {
}
}
if(term.c.x+width < term.col) {
@@
-3485,12
+3496,9
@@
drawregion(int x1, int y1, int x2, int y2) {
int ic, ib, x, y, ox, sl;
Glyph base, new;
char buf[DRAW_BUF_SIZ];
int ic, ib, x, y, ox, sl;
Glyph base, new;
char buf[DRAW_BUF_SIZ];
- bool ena_sel = sel.ob.x != -1;
+ bool ena_sel = sel.ob.x != -1
&& sel.alt == IS_SET(MODE_ALTSCREEN)
;
long unicodep;
long unicodep;
- if(sel.alt != IS_SET(MODE_ALTSCREEN))
- ena_sel = 0;
-
if(!(xw.state & WIN_VISIBLE))
return;
if(!(xw.state & WIN_VISIBLE))
return;
@@
-3567,7
+3575,7
@@
void
xseturgency(int add) {
XWMHints *h = XGetWMHints(xw.dpy, xw.win);
xseturgency(int add) {
XWMHints *h = XGetWMHints(xw.dpy, xw.win);
-
h->flags = add ? (h->flags | XUrgencyHint) : (h->flags & ~
XUrgencyHint);
+
MODBIT(h->flags, add,
XUrgencyHint);
XSetWMHints(xw.dpy, xw.win, h);
XFree(h);
}
XSetWMHints(xw.dpy, xw.win, h);
XFree(h);
}