svn commit: r258136 - user/ed/newcons/sys/dev/vt
Aleksandr Rybalko
ray at FreeBSD.org
Thu Nov 14 15:44:22 UTC 2013
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. */
More information about the svn-src-user
mailing list