Date: Thu, 14 Nov 2013 15:44:22 +0000 (UTC) From: Aleksandr Rybalko <ray@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r258136 - user/ed/newcons/sys/dev/vt Message-ID: <201311141544.rAEFiMFc080013@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311141544.rAEFiMFc080013>