summaryrefslogtreecommitdiff
path: root/lineset.c
diff options
context:
space:
mode:
Diffstat (limited to 'lineset.c')
-rw-r--r--lineset.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/lineset.c b/lineset.c
index faabb30..f672798 100644
--- a/lineset.c
+++ b/lineset.c
@@ -102,16 +102,25 @@ void yank_region(int x1, int y1, int x2, int y2){
void paste_region(int x1, int y1){
- int i, curlen;
+ int i, curlen, pastelen;
i = y1;
while( i < HEIGHT && i < y1 + cutbuf.num){
- memcpy(screen.l[i].s + x1, cutbuf.l[i-y1].s, strlen(cutbuf.l[i-y1].s));
+ pastelen = strlen(cutbuf.l[i-y1].s);
curlen = strlen(screen.l[i].s);
+ memcpy(screen.l[i].s + x1, cutbuf.l[i-y1].s, pastelen);
if (curlen <= x1)
/* double-check this line below */
- pad_line_to_length(screen.l[i].s+curlen, x1 - curlen);
+ pad_line_to_length(screen.l[i].s + curlen, x1 - curlen);
+ if (curlen <= x1 + pastelen)
+ screen.l[i].s[x1 + pastelen] = '\0';
+
+ screen.l[i].lst = strlen(screen.l[i].s) - 1;
+#ifdef DEBUG
+ fprintf(stderr, "%d.lst: %d\n", i, screen.l[i].lst);
+#endif
i += 1;
modified = 1;
}
+ redraw();
}