From owner-svn-src-user@FreeBSD.ORG Thu Nov 14 15:44:22 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0C946E7; Thu, 14 Nov 2013 15:44:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CFE9D258E; Thu, 14 Nov 2013 15:44:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAEFiMPH080014; Thu, 14 Nov 2013 15:44:22 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAEFiMFc080013; Thu, 14 Nov 2013 15:44:22 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201311141544.rAEFiMFc080013@svn.freebsd.org> From: Aleksandr Rybalko Date: Thu, 14 Nov 2013 15:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r258136 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2013 15:44:22 -0000 Author: ray Date: Thu Nov 14 15:44:22 2013 New Revision: 258136 URL: http://svnweb.freebsd.org/changeset/base/258136 Log: Done cut/paste "word" selection mode support. It still selects everything which is not space around. Sponsored by: The FreeBSD Foundation Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt_buf.c Modified: user/ed/newcons/sys/dev/vt/vt_buf.c ============================================================================== --- user/ed/newcons/sys/dev/vt/vt_buf.c Thu Nov 14 15:37:20 2013 (r258135) +++ user/ed/newcons/sys/dev/vt/vt_buf.c Thu Nov 14 15:44:22 2013 (r258136) @@ -629,6 +629,8 @@ vtbuf_extract_marked(struct vt_buf *vb, int vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row) { + term_char_t *r; + int i; switch (type) { case VTB_MARK_END: /* B1 UP */ @@ -651,10 +653,23 @@ vtbuf_set_mark(struct vt_buf *vb, int ty break; case VTB_MARK_WORD: vtbuf_flush_mark(vb); /* Clean old mark. */ - vb->vb_mark_start.tp_col = 0; /* XXX */ - vb->vb_mark_end.tp_col = 10; /* XXX */ vb->vb_mark_start.tp_row = vb->vb_mark_end.tp_row = vtbuf_wth(vb, row); + r = vb->vb_rows[vb->vb_mark_start.tp_row]; + for (i = col; i >= 0; i --) { + if (TCHAR_CHARACTER(r[i]) == ' ') { + vb->vb_mark_start.tp_col = i + 1; + break; + } + } + for (i = col; i < vb->vb_scr_size.tp_col; i ++) { + if (TCHAR_CHARACTER(r[i]) == ' ') { + vb->vb_mark_end.tp_col = i; + break; + } + } + if (vb->vb_mark_start.tp_col > vb->vb_mark_end.tp_col) + vb->vb_mark_start.tp_col = vb->vb_mark_end.tp_col; break; case VTB_MARK_ROW: vtbuf_flush_mark(vb); /* Clean old mark. */