Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Remove first argument of selsnap.
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
6f8d83f
..
87f3ed2
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-453,7
+453,7
@@
static inline bool selected(int, int);
static char *getsel(void);
static void selcopy(Time);
static void selscroll(int, int);
static char *getsel(void);
static void selcopy(Time);
static void selscroll(int, int);
-static void selsnap(int
, int
*, int *, int);
+static void selsnap(int *, int *, int);
static int x2col(int);
static int y2row(int);
static void getbuttoninfo(XEvent *);
static int x2col(int);
static int y2row(int);
static void getbuttoninfo(XEvent *);
@@
-695,8
+695,8
@@
selnormalize(void) {
sel.nb.y = MIN(sel.ob.y, sel.oe.y);
sel.ne.y = MAX(sel.ob.y, sel.oe.y);
sel.nb.y = MIN(sel.ob.y, sel.oe.y);
sel.ne.y = MAX(sel.ob.y, sel.oe.y);
- selsnap(
sel.snap,
&sel.nb.x, &sel.nb.y, -1);
- selsnap(
sel.snap,
&sel.ne.x, &sel.ne.y, +1);
+ selsnap(&sel.nb.x, &sel.nb.y, -1);
+ selsnap(&sel.ne.x, &sel.ne.y, +1);
/* expand selection over line breaks */
if (sel.type == SEL_RECTANGULAR)
/* expand selection over line breaks */
if (sel.type == SEL_RECTANGULAR)
@@
-720,12
+720,12
@@
selected(int x, int y) {
}
void
}
void
-selsnap(int
mode, int
*x, int *y, int direction) {
+selsnap(int *x, int *y, int direction) {
int newx, newy, xt, yt;
bool delim, prevdelim;
Glyph *gp, *prevgp;
int newx, newy, xt, yt;
bool delim, prevdelim;
Glyph *gp, *prevgp;
- switch(
mode
) {
+ switch(
sel.snap
) {
case SNAP_WORD:
/*
* Snap around if the word wraps around at the end or
case SNAP_WORD:
/*
* Snap around if the word wraps around at the end or
@@
-855,12
+855,11
@@
mousereport(XEvent *e) {
}
if(!IS_SET(MODE_MOUSEX10)) {
}
if(!IS_SET(MODE_MOUSEX10)) {
- button += (
state & ShiftMask
? 4 : 0)
- + (
state & Mod4Mask
? 8 : 0)
- + (
state & ControlMask
? 16 : 0);
+ button += (
(state & ShiftMask )
? 4 : 0)
+ + (
(state & Mod4Mask )
? 8 : 0)
+ + (
(state & ControlMask)
? 16 : 0);
}
}
- len = 0;
if(IS_SET(MODE_MOUSESGR)) {
len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c",
button, x+1, y+1,
if(IS_SET(MODE_MOUSESGR)) {
len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c",
button, x+1, y+1,
@@
-1239,10
+1238,14
@@
execsh(void) {
void
sigchld(int a) {
int stat, ret;
void
sigchld(int a) {
int stat, ret;
+ pid_t p;
- if(
waitpid(pid, &stat, 0
) < 0)
+ if(
(p = waitpid(pid, &stat, WNOHANG)
) < 0)
die("Waiting for pid %hd failed: %s\n", pid, strerror(errno));
die("Waiting for pid %hd failed: %s\n", pid, strerror(errno));
+ if(pid != p)
+ return;
+
ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE;
if (ret != EXIT_SUCCESS)
die("child finished with error '%d'\n", stat);
ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE;
if (ret != EXIT_SUCCESS)
die("child finished with error '%d'\n", stat);