aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2010-09-01 17:21:09 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2010-09-01 17:21:09 +0200
commit5ce6c5c0324ef3b7d0f5b9e6e2ba4d87ae0d3bb1 (patch)
tree2cfa099cb73f60e0011f63ddc3ff742040ab9c2e /st.c
parentef69118028afad1938951a1f7dff8db2aa557879 (diff)
downloadst-5ce6c5c0324ef3b7d0f5b9e6e2ba4d87ae0d3bb1.tar.gz
st-5ce6c5c0324ef3b7d0f5b9e6e2ba4d87ae0d3bb1.zip
fixed IL and DL.
Diffstat (limited to 'st.c')
-rw-r--r--st.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/st.c b/st.c
index 6abdc3f..65829a8 100644
--- a/st.c
+++ b/st.c
@@ -392,8 +392,10 @@ ttyread(void) {
392 392
393 if((ret = read(cmdfd, buf, LEN(buf))) < 0) 393 if((ret = read(cmdfd, buf, LEN(buf))) < 0)
394 die("Couldn't read from shell: %s\n", SERRNO); 394 die("Couldn't read from shell: %s\n", SERRNO);
395 else 395 else {
396 printf("ttyread %d\n", ret);
396 tputs(buf, ret); 397 tputs(buf, ret);
398 }
397} 399}
398 400
399void 401void
@@ -589,21 +591,16 @@ tinsertblankline(int n) {
589 Line blank; 591 Line blank;
590 int bot = term.bot; 592 int bot = term.bot;
591 593
592 if(term.c.y > term.bot) 594 if(term.c.y < term.top || term.c.y > term.bot)
593 bot = term.row - 1;
594 else if(term.c.y < term.top)
595 bot = term.top - 1;
596 if(term.c.y + n >= bot) {
597 tclearregion(0, term.c.y, term.col-1, bot);
598 return; 595 return;
599 } 596
597 LIMIT(n, 0, bot-term.c.y+1);
598 tclearregion(0, bot-n+1, term.col-1, bot);
600 for(i = bot; i >= term.c.y+n; i--) { 599 for(i = bot; i >= term.c.y+n; i--) {
601 /* swap deleted line <-> blanked line */ 600 /* swap deleted line <-> blanked line */
602 blank = term.line[i]; 601 blank = term.line[i];
603 term.line[i] = term.line[i-n]; 602 term.line[i] = term.line[i-n];
604 term.line[i-n] = blank; 603 term.line[i-n] = blank;
605 /* blank it */
606 memset(blank, 0, term.col * sizeof(Glyph));
607 } 604 }
608} 605}
609 606
@@ -613,21 +610,16 @@ tdeleteline(int n) {
613 Line blank; 610 Line blank;
614 int bot = term.bot; 611 int bot = term.bot;
615 612
616 if(term.c.y > term.bot) 613 if(term.c.y < term.top || term.c.y > term.bot)
617 bot = term.row - 1;
618 else if(term.c.y < term.top)
619 bot = term.top - 1;
620 if(term.c.y + n >= bot) {
621 tclearregion(0, term.c.y, term.col-1, bot);
622 return; 614 return;
623 } 615
616 LIMIT(n, 0, bot-term.c.y+1);
617 tclearregion(0, term.c.y, term.col-1, term.c.y+n-1);
624 for(i = term.c.y; i <= bot-n; i++) { 618 for(i = term.c.y; i <= bot-n; i++) {
625 /* swap deleted line <-> blanked line */ 619 /* swap deleted line <-> blanked line */
626 blank = term.line[i]; 620 blank = term.line[i];
627 term.line[i] = term.line[i+n]; 621 term.line[i] = term.line[i+n];
628 term.line[i+n] = blank; 622 term.line[i+n] = blank;
629 /* blank it */
630 memset(blank, 0, term.col * sizeof(Glyph));
631 } 623 }
632} 624}
633 625