[hackers] [st] fixed IL and DL. || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Wed, 1 Sep 2010 15:21:38 +0000 (UTC)

changeset: 129:f271b74eda5f
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Wed Sep 01 17:21:09 2010 +0200
files: st.c
description:
fixed IL and DL.

diff -r 10b8e415d688 -r f271b74eda5f st.c
--- a/st.c Wed Sep 01 16:26:12 2010 +0200
+++ b/st.c Wed Sep 01 17:21:09 2010 +0200
@@ -392,8 +392,10 @@
 
         if((ret = read(cmdfd, buf, LEN(buf))) < 0)
                 die("Couldn't read from shell: %s\n", SERRNO);
- else
+ else {
+ printf("ttyread %d\n", ret);
                 tputs(buf, ret);
+ }
 }
 
 void
@@ -589,21 +591,16 @@
         Line blank;
         int bot = term.bot;
 
- if(term.c.y > term.bot)
- bot = term.row - 1;
- else if(term.c.y < term.top)
- bot = term.top - 1;
- if(term.c.y + n >= bot) {
- tclearregion(0, term.c.y, term.col-1, bot);
+ if(term.c.y < term.top || term.c.y > term.bot)
                 return;
- }
+
+ LIMIT(n, 0, bot-term.c.y+1);
+ tclearregion(0, bot-n+1, term.col-1, bot);
         for(i = bot; i >= term.c.y+n; i--) {
                 /* swap deleted line <-> blanked line */
                 blank = term.line[i];
                 term.line[i] = term.line[i-n];
                 term.line[i-n] = blank;
- /* blank it */
- memset(blank, 0, term.col * sizeof(Glyph));
         }
 }
 
@@ -613,21 +610,16 @@
         Line blank;
         int bot = term.bot;
 
- if(term.c.y > term.bot)
- bot = term.row - 1;
- else if(term.c.y < term.top)
- bot = term.top - 1;
- if(term.c.y + n >= bot) {
- tclearregion(0, term.c.y, term.col-1, bot);
+ if(term.c.y < term.top || term.c.y > term.bot)
                 return;
- }
+
+ LIMIT(n, 0, bot-term.c.y+1);
+ tclearregion(0, term.c.y, term.col-1, term.c.y+n-1);
         for(i = term.c.y; i <= bot-n; i++) {
                 /* swap deleted line <-> blanked line */
                 blank = term.line[i];
                 term.line[i] = term.line[i+n];
                 term.line[i+n] = blank;
- /* blank it */
- memset(blank, 0, term.col * sizeof(Glyph));
         }
 }
 
Received on Wed Sep 01 2010 - 17:21:38 CEST

This archive was generated by hypermail 2.2.0 : Wed Sep 01 2010 - 17:24:04 CEST