Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Remove duplicated code in strhandle
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
4d543d1
..
c59bf1d
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-2152,20
+2152,21
@@
csireset(void) {
void
strhandle(void) {
char *p = NULL;
void
strhandle(void) {
char *p = NULL;
- int
i, j, narg
;
+ int
j, narg, par
;
strparse();
narg = strescseq.narg;
strparse();
narg = strescseq.narg;
+ par = atoi(strescseq.args[0]);
switch(strescseq.type) {
case ']': /* OSC -- Operating System Command */
switch(strescseq.type) {
case ']': /* OSC -- Operating System Command */
- switch(
i = atoi(strescseq.args[0])
) {
+ switch(
par
) {
case 0:
case 1:
case 2:
if(narg > 1)
xsettitle(strescseq.args[1]);
case 0:
case 1:
case 2:
if(narg > 1)
xsettitle(strescseq.args[1]);
-
break
;
+
return
;
case 4: /* color set */
if(narg < 3)
break;
case 4: /* color set */
if(narg < 3)
break;
@@
-2182,25
+2183,20
@@
strhandle(void) {
*/
redraw(0);
}
*/
redraw(0);
}
- break;
- default:
- fprintf(stderr, "erresc: unknown str ");
- strdump();
- break;
+ return;
}
break;
case 'k': /* old title set compatibility */
xsettitle(strescseq.args[0]);
}
break;
case 'k': /* old title set compatibility */
xsettitle(strescseq.args[0]);
-
break
;
+
return
;
case 'P': /* DSC -- Device Control String */
case '_': /* APC -- Application Program Command */
case '^': /* PM -- Privacy Message */
case 'P': /* DSC -- Device Control String */
case '_': /* APC -- Application Program Command */
case '^': /* PM -- Privacy Message */
- default:
- fprintf(stderr, "erresc: unknown str ");
- strdump();
- /* die(""); */
- break;
+ return;
}
}
+
+ fprintf(stderr, "erresc: unknown str ");
+ strdump();
}
void
}
void
@@
-3301,6
+3297,8
@@
xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
XftDrawRect(xw.draw, fg, winx, winy + font->ascent + 1,
width, 1);
}
XftDrawRect(xw.draw, fg, winx, winy + font->ascent + 1,
width, 1);
}
+ XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, winx, winy, width,
+ CEIL((font->ascent + font->descent) * chscale), winx, winy);
/* Reset clip to none. */
XftDrawSetClip(xw.draw, 0);
/* Reset clip to none. */
XftDrawSetClip(xw.draw, 0);
@@
-3399,8
+3397,6
@@
redraw(int timeout) {
void
draw(void) {
drawregion(0, 0, term.col, term.row);
void
draw(void) {
drawregion(0, 0, term.col, term.row);
- XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, xw.w,
- xw.h, 0, 0);
XSetForeground(xw.dpy, dc.gc,
dc.col[IS_SET(MODE_REVERSE)?
defaultfg : defaultbg].pixel);
XSetForeground(xw.dpy, dc.gc,
dc.col[IS_SET(MODE_REVERSE)?
defaultfg : defaultbg].pixel);