aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/st.c b/st.c
index c408ca9..b2e5e22 100644
--- a/st.c
+++ b/st.c
@@ -596,14 +596,17 @@ selcopy(void) {
596 /* append every set & selected glyph to the selection */ 596 /* append every set & selected glyph to the selection */
597 for(y = 0; y < term.row; y++) { 597 for(y = 0; y < term.row; y++) {
598 for(x = 0; x < term.col; x++) { 598 for(x = 0; x < term.col; x++) {
599 is_selected = selected(x, y); 599 int size;
600 if((term.line[y][x].state & GLYPH_SET) && is_selected) { 600 char *p;
601 int size = utf8size(term.line[y][x].c); 601 Glyph *gp = &term.line[y][x];
602 memcpy(ptr, term.line[y][x].c, size); 602
603 ptr += size; 603 if(!(is_selected = selected(x, y)))
604 } 604 continue;
605 p = (gp->state & GLYPH_SET) ? gp->c : " ";
606 size = utf8size(p);
607 memcpy(ptr, p, size);
608 ptr += size;
605 } 609 }
606
607 /* \n at the end of every selected line except for the last one */ 610 /* \n at the end of every selected line except for the last one */
608 if(is_selected && y < sel.e.y) 611 if(is_selected && y < sel.e.y)
609 *ptr++ = '\n'; 612 *ptr++ = '\n';