--- usearch.c.orig 2008-11-02 20:16:31.000000000 +0100 +++ usearch.c 2011-02-02 22:05:25.000000000 +0100 @@ -416,15 +416,15 @@ { int x; - prm(markb); - prm(markk); prm(srch->wrap_p); if (srch->markb) { + prm(markb); markb = srch->markb; markb->owner = &markb; markb->xcol = piscol(markb); } if (srch->markk) { + prm(markk); markk = srch->markk; markk->owner = &markk; markk->xcol = piscol(markk); @@ -515,14 +515,14 @@ srch->repeat = -1; srch->flg = 0; - prm(markb); - prm(markk); if (srch->markb) { + prm(markb); markb = srch->markb; markb->owner = &markb; markb->xcol = piscol(markb); } if (srch->markk) { + prm(markk); markk = srch->markk; markk->owner = &markk; markk->xcol = piscol(markk); --- mouse.h.orig 2011-02-06 19:40:36.000000000 +0100 +++ mouse.h 2011-02-07 07:22:31.000000000 +0100 @@ -34,6 +34,9 @@ /* mousedn(int x, int y) - handle a mouse-down event */ void mousedn PARAMS((int x, int y)); +/* mousednmiddle(BW *bw, int x, int y) - handle a mouse-middlebutton-down event */ +void mousednmiddle PARAMS((BW *bw, int x, int y)); + /* mouseup(int x, int y) - handle a mouse-up event */ void mouseup PARAMS((int x, int y)); @@ -63,5 +66,6 @@ extern int auto_scroll; /* Set for autoscroll */ extern int auto_trig_time; /* Time of next scroll */ extern int joexterm; /* Set if xterm can do base64 paste */ +extern int mousecopy; /* if copy block is activated by mouse middle-button */ #endif --- mouse.c.orig 2011-02-05 13:23:41.000000000 +0100 +++ mouse.c 2011-02-07 07:24:26.000000000 +0100 @@ -29,6 +29,7 @@ int rtbutton=0; /* use button 3 instead of 1 */ int floatmouse=0; /* don't fix xcol after tomouse */ int joexterm=0; /* set if we're using Joe's modified xterm */ +int mousecopy=0; static int selecting = 0; /* Set if we did any selecting */ @@ -96,6 +97,7 @@ else /* drag */ mousedrag(Cx,Cy); + else if ((Cb & 3) == 1 && (Cb & 32) == 0) mousednmiddle(bw,Cx,Cy); /* middle button */ else if ((maint->curwin->watom->what & TYPETW || maint->curwin->watom->what & TYPEPW) && joexterm && (Cb & 3) == 1) /* Paste */ @@ -132,6 +134,16 @@ } } +void mousednmiddle(BW *bw, int x, int y) +{ + Cx = x, Cy = y; + clicks=1; + fake_key(KEY_MDOWN); + mousecopy = 1; + ublkcpy (bw); + mousecopy = 0; +} + /* Return base64 code character given 6-bit number */ char base64_code[]="\ --- ublock.c.orig 2011-02-07 07:25:31.000000000 +0100 +++ ublock.c 2011-02-07 07:22:56.000000000 +0100 @@ -11,7 +11,7 @@ #include #endif -int nowmarking; +int nowmarking, mousecopy; /* Global options */ @@ -546,12 +546,14 @@ } binsb(bw->cursor, tmp); - if (lightoff) - unmark(bw); - else { - umarkb(bw); - umarkk(bw); - pfwrd(markk, size); + if (!mousecopy) { + if (lightoff) + unmark(bw); + else { + umarkb(bw); + umarkk(bw); + pfwrd(markk, size); + } } updall(); return 0;