aboutsummarylogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorAurélien Aptel2010-09-01 17:21:09 +0200
committerAurélien Aptel2010-09-01 17:21:09 +0200
commit925b7f977bd96eff967d4431d744fcc6a22a9034 (patch)
treeeb854b7444fb78fa4d724600944cedc6b6e1a56a /st.c
parentcc6f4e3ca696b1d6b09999e7858951474f99060b (diff)
downloadaur-925b7f977bd96eff967d4431d744fcc6a22a9034.tar.gz
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 6abdc3f8ab96..65829a824cff 100644
--- a/st.c
+++ b/st.c
@@ -392,8 +392,10 @@ ttyread(void) {
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 @@ tinsertblankline(int n) {
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 @@ tdeleteline(int n) {
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));
}
}