--- xterm/button.c- Wed Jun 18 11:38:27 2003 +++ xterm/button.c Wed Jun 18 13:06:35 2003 @@ -152,6 +152,7 @@ #define SELECTLINE 2 #define NSELECTUNITS 3 static SelectUnit selectUnit; +int andPasteToo; /* Send emacs escape code when done selecting or extending? */ static int replyToEmacs; @@ -1468,8 +1469,9 @@ } static SelectUnit -EvalSelectUnit(Time buttonDownTime, SelectUnit defaultUnit) +EvalSelectUnit(XButtonEvent *event, SelectUnit defaultUnit) { + Time buttonDownTime = event->time; int delta; if (lastButtonUpTime == (Time) 0) /* first time and once in a blue moon */ @@ -1479,7 +1481,11 @@ else /* time has rolled over since lastButtonUpTime */ delta = (((Time) ~ 0) - lastButtonUpTime) + buttonDownTime; - if (delta > term->screen.multiClickTime) { + if ((event->state & ShiftMask)) { + numberOfClicks = 1; + andPasteToo = !(event->state & ControlMask); + return SELECTWORD; + } else if (delta > term->screen.multiClickTime) { numberOfClicks = 1; return defaultUnit; } else { @@ -1496,7 +1502,7 @@ { if (SendMousePosition(w, event)) return; - selectUnit = EvalSelectUnit(event->xbutton.time, SELECTCHAR); + selectUnit = EvalSelectUnit(&event->xbutton, SELECTCHAR); replyToEmacs = FALSE; #if OPT_READLINE @@ -1552,7 +1558,7 @@ { int startrow, startcol; - selectUnit = EvalSelectUnit(event->time, SELECTCHAR); + selectUnit = EvalSelectUnit(event, SELECTCHAR); if (numberOfClicks > 1) { PointToRowCol(event->y, event->x, &startrow, &startcol); replyToEmacs = TRUE; @@ -1669,6 +1675,10 @@ } } SelectSet(w, event, params, num_params); + if (andPasteToo) { + _GetSelection(w, event->xbutton.time, params, num_params, NULL); + andPasteToo = 0; + } eventMode = NORMAL; } @@ -1722,7 +1732,7 @@ || event->xbutton.button != Button3 || !(SCREEN_FLAG(screen, dclick3_deletes))) #endif - selectUnit = EvalSelectUnit(event->xbutton.time, selectUnit); + selectUnit = EvalSelectUnit(&event->xbutton, selectUnit); replyToEmacs = FALSE; #if OPT_READLINE