pinosaur
/
st.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
selsnap: simplify SNAP_LINE case
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
300cab6
..
789e795
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
@@
-772,15
+772,15
@@
selsnap(int mode, int *x, int *y, int direction) {
* previous line will be selected.
*/
*x = (direction < 0) ? 0 : term.col - 1;
* previous line will be selected.
*/
*x = (direction < 0) ? 0 : term.col - 1;
- if(direction < 0
&& *y > 0
) {
+ if(direction < 0) {
for(; *y > 0; *y += direction) {
if(!(term.line[*y-1][term.col-1].mode
& ATTR_WRAP)) {
break;
}
}
for(; *y > 0; *y += direction) {
if(!(term.line[*y-1][term.col-1].mode
& ATTR_WRAP)) {
break;
}
}
- } else if(direction > 0
&& *y < term.row-1
) {
- for(; *y < term.row; *y += direction) {
+ } else if(direction > 0) {
+ for(; *y < term.row
-1
; *y += direction) {
if(!(term.line[*y][term.col-1].mode
& ATTR_WRAP)) {
break;
if(!(term.line[*y][term.col-1].mode
& ATTR_WRAP)) {
break;