Index: sys/dev/vt/vt.h =================================================================== --- sys/dev/vt/vt.h +++ sys/dev/vt/vt.h @@ -238,7 +238,7 @@ #ifndef SC_NO_CUTPASTE int vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row); int vtbuf_get_marked_len(struct vt_buf *vb); -void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz); +void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz, int mark); #endif #define VTB_MARK_NONE 0 Index: sys/dev/vt/vt_buf.c =================================================================== --- sys/dev/vt/vt_buf.c +++ sys/dev/vt/vt_buf.c @@ -771,7 +771,7 @@ } void -vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz) +vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz, int mark) { int i, j, r, c, cs, ce; term_pos_t s, e; @@ -799,7 +799,7 @@ buf[i++] = vb->vb_rows[r][c]; /* For all rows, but the last one. */ - if (r != e.tp_row) { + if (r != e.tp_row || mark == VTB_MARK_ROW) { /* Trim trailing word separators, if any. */ for (; i != j; i--) { if (!tchar_is_word_separator(buf[i - 1])) Index: sys/dev/vt/vt_core.c =================================================================== --- sys/dev/vt/vt_core.c +++ sys/dev/vt/vt_core.c @@ -2228,23 +2228,25 @@ case 0: /* up */ break; default: + mark = VTB_MARK_START; vt_mouse_paste(); break; } - return; /* Done */ + case VT_MOUSE_EXTENDBUTTON: switch (cnt) { - case 0: /* up */ + case 0: if (!(vd->vd_mstate & MOUSE_BUTTON1DOWN)) - mark = VTB_MARK_EXTEND; + mark = VTB_MARK_START; else mark = 0; break; default: - mark = VTB_MARK_EXTEND; + mark = VTB_MARK_START; break; } break; + default: return; /* Done */ } @@ -2287,7 +2289,7 @@ VD_PASTEBUFSZ(vd) = len; } /* Request copy/paste buffer data, no more than `len' */ - vtbuf_extract_marked(&vw->vw_buf, VD_PASTEBUF(vd), len); + vtbuf_extract_marked(&vw->vw_buf, VD_PASTEBUF(vd), len, mark); VD_PASTEBUFLEN(vd) = len;