mirror of
https://github.com/alrayyes/st.git
synced 2024-11-22 19:26:22 +00:00
add selinit() and renamed clipboard_* to sel*.
This commit is contained in:
parent
f211bc2eed
commit
c4225bdcc9
1 changed files with 13 additions and 5 deletions
18
st.c
18
st.c
|
@ -185,9 +185,9 @@ static char* kmap(KeySym);
|
||||||
static void kpress(XEvent *);
|
static void kpress(XEvent *);
|
||||||
static void resize(XEvent *);
|
static void resize(XEvent *);
|
||||||
static void focus(XEvent *);
|
static void focus(XEvent *);
|
||||||
static void brelease(XEvent *e);
|
static void brelease(XEvent *);
|
||||||
static void bpress(XEvent *e);
|
static void bpress(XEvent *);
|
||||||
static void bmotion(XEvent *e);
|
static void bmotion(XEvent *);
|
||||||
|
|
||||||
|
|
||||||
static void (*handler[LASTEvent])(XEvent *) = {
|
static void (*handler[LASTEvent])(XEvent *) = {
|
||||||
|
@ -210,6 +210,13 @@ static int cmdfd;
|
||||||
static pid_t pid;
|
static pid_t pid;
|
||||||
static Selection sel;
|
static Selection sel;
|
||||||
|
|
||||||
|
void
|
||||||
|
selinit(void) {
|
||||||
|
sel.mode = 0;
|
||||||
|
sel.bx = -1;
|
||||||
|
sel.clip = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int selected(int x, int y) {
|
static inline int selected(int x, int y) {
|
||||||
if ((sel.ey==y && sel.by==y)) {
|
if ((sel.ey==y && sel.by==y)) {
|
||||||
int bx = MIN(sel.bx, sel.ex);
|
int bx = MIN(sel.bx, sel.ex);
|
||||||
|
@ -261,12 +268,12 @@ static char *getseltext() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: use X11 clipboard */
|
/* TODO: use X11 clipboard */
|
||||||
static void clipboard_copy(char *str) {
|
static void selcopy(char *str) {
|
||||||
free(sel.clip);
|
free(sel.clip);
|
||||||
sel.clip = str;
|
sel.clip = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clipboard_paste() {
|
static void selpaste() {
|
||||||
if(sel.clip)
|
if(sel.clip)
|
||||||
ttywrite(sel.clip, strlen(sel.clip));
|
ttywrite(sel.clip, strlen(sel.clip));
|
||||||
}
|
}
|
||||||
|
@ -1471,6 +1478,7 @@ main(int argc, char *argv[]) {
|
||||||
tnew(80, 24);
|
tnew(80, 24);
|
||||||
ttynew();
|
ttynew();
|
||||||
xinit();
|
xinit();
|
||||||
|
selinit();
|
||||||
run();
|
run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue