Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109859309
D35552.id107256.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D35552.id107256.diff
View Options
diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c
--- a/sys/dev/vt/vt_buf.c
+++ b/sys/dev/vt/vt_buf.c
@@ -41,6 +41,7 @@
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/reboot.h>
+#include <sys/ctype.h>
#include <dev/vt/vt.h>
@@ -742,7 +743,7 @@
ei = e.tp_row * vb->vb_scr_size.tp_col + e.tp_col;
/* Number symbols and number of rows to inject \n */
- sz = ei - si + ((e.tp_row - s.tp_row) * 2);
+ sz = ei - si + (e.tp_row - s.tp_row);
return (sz * sizeof(term_char_t));
}
@@ -750,7 +751,7 @@
void
vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz)
{
- int i, r, c, cs, ce;
+ int i, j, r, c, cs, ce;
term_pos_t s, e;
/* Swap according to window coordinates. */
@@ -769,15 +770,25 @@
for (r = s.tp_row; r <= e.tp_row; r++) {
cs = (r == s.tp_row)?s.tp_col:0;
ce = (r == e.tp_row)?e.tp_col:vb->vb_scr_size.tp_col;
- for (c = cs; c < ce; c++) {
+
+ /* Copy characters from terminal window. */
+ j = i;
+ for (c = cs; c < ce; c++)
buf[i++] = vb->vb_rows[r][c];
+
+ /* Trim trailing whitespace from each line. */
+ for (; i != j; i--) {
+ if (isspace((unsigned char)buf[i - 1]))
+ buf[i - 1] = '\0';
+ else
+ break;
}
+
/* Add new line for all rows, but not for last one. */
- if (r != e.tp_row) {
- buf[i++] = '\r';
+ if (r != e.tp_row)
buf[i++] = '\n';
- }
}
+ MPASS(i <= sz);
}
int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 11, 10:50 AM (9 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16593720
Default Alt Text
D35552.id107256.diff (1 KB)
Attached To
Mode
D35552: vt: Fix contents of paste buffer for newcons.
Attached
Detach File
Event Timeline
Log In to Comment