Introduction
Introduction Statistics Contact Development Disclaimer Help
remove meaningless logic, handle tiny screens - irc - Unnamed repository; edit …
git clone git://vernunftzentrum.de/irc.git
Log
Files
Refs
README
---
commit 1c4a83b81f92884d7add4962151f16b74637a0c5
parent 01cb7d3ebee300dac6af2e8d835af425ec66e6e4
Author: Quentin Carbonneaux <[email protected]>
Date: Tue, 3 May 2016 21:54:34 -0400
remove meaningless logic, handle tiny screens
Diffstat:
irc.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/irc.c b/irc.c
@@ -440,6 +440,8 @@ tresize(void)
winchg = 0;
if (ioctl(0, TIOCGWINSZ, &ws) < 0)
panic("Ioctl (TIOCGWINSZ) failed.");
+ if (ws.ws_row <= 2)
+ return;
resizeterm(scr.y = ws.ws_row, scr.x = ws.ws_col);
wresize(scr.mw, scr.y - 2, scr.x);
wresize(scr.iw, 1, scr.x);
@@ -454,7 +456,7 @@ tredraw(void)
{
struct Chan *const c = &chl[ch];
char *q, *p;
- int llen = 0, nl = -1;
+ int nl = -1;
if (c->eol == c->buf) {
wclear(scr.mw);
@@ -464,7 +466,6 @@ tredraw(void)
p = c->eol - 1;
if (c->n) {
int i = c->n;
-
for (; p > c->buf; p--)
if (*p == '\n' && !i--)
break;
@@ -473,24 +474,15 @@ tredraw(void)
}
q = p;
while (nl < scr.y - 2) {
- llen = 0;
while (*q != '\n' && q > c->buf)
- q--, llen++;
- nl += 1 + llen / scr.x;
+ q--;
+ nl++;
if (q == c->buf)
break;
q--;
}
if (q != c->buf)
q += 2;
- for (llen = 0; nl > scr.y - 2;) { /* Maybe we must split the top line.…
- if (q[llen] == '\n' || llen >= scr.x) {
- q += llen + (q[llen] == '\n');
- llen = 0;
- nl--;
- } else
- llen++;
- }
wclear(scr.mw);
wmove(scr.mw, 0, 0);
while (q < p)
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.