Introduction
Introduction Statistics Contact Development Disclaimer Help
Add clean output for long lines. - irc - Unnamed repository; edit this file 'de…
git clone git://vernunftzentrum.de/irc.git
Log
Files
Refs
README
---
commit d29cd51fd4ed8c891bbe6efd7b4f9b5cf67e96e1
parent a10ff13d00eb7fa816a3771b2c4ae7265627a024
Author: Quentin Carbonneaux <[email protected]>
Date: Thu, 2 Apr 2015 22:47:31 +0000
Add clean output for long lines.
This might make some of the scrolling logic a little bit
inconsistent, but it pleases the eye a lot more!
Diffstat:
irc.c | 36 ++++++++++++++++++++++++++------
1 file changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/irc.c b/irc.c
@@ -23,9 +23,10 @@
#include <locale.h>
#define SCROLL 15
+#define INDENT 21
#define DATEFMT "%H:%M"
#define PFMT "%-12s < %s"
-#define SRV "chat.freenode.org"
+#define SRV "irc.oftc.net"
#define PORT 6667
enum { ChanLen = 64, LineLen = 512, MaxChans = 16, BufSz = 2048, LogSz = 4096 …
@@ -98,7 +99,7 @@ srd(void)
*s++ = 0;
if (*l==':') {
if (!(cmd=strchr(l, ' '))) goto lskip;
- *cmd++ = 0;
+ *cmd++ = 0;
usr = l+1;
} else {
usr = 0;
@@ -180,6 +181,30 @@ chdel(char *name)
return 1;
}
+static char *
+pushl(char *p, char *e)
+{
+ int x=0;
+ char *w;
+
+ if ((w=memchr(p, '\n', e-p))) e=w+1;
+ for (w=p;;) {
+ if (p>=e || *p==' ' || p-w+INDENT>=scr.x-1) {
+ for (; w<p; w++)
+ waddch(scr.mw, *w);
+ if (p>=e) return e;
+ }
+ p++;
+ if (++x>=scr.x) {
+ waddch(scr.mw, '\n');
+ for (x=0; x<INDENT; x++)
+ waddch(scr.mw, ' ');
+ if (*w==' ') w++;
+ x+=p-w;
+ }
+ }
+}
+
static void
pushf(int cn, const char *fmt, ...)
{
@@ -210,8 +235,7 @@ pushf(int cn, const char *fmt, ...)
if (cn==ch && c->n==0) {
char *p=c->eol-n-1;
if (p!=c->buf) waddch(scr.mw, '\n');
- for (; p<c->eol-1; p++)
- waddch(scr.mw, *p);
+ pushl(p, c->eol-1);
wrefresh(scr.mw);
}
}
@@ -404,8 +428,8 @@ tredraw(void)
}
wclear(scr.mw);
wmove(scr.mw, 0, 0);
- for (; q<p; q++)
- waddch(scr.mw, *q);
+ while (q<p)
+ q=pushl(q, p);
wrefresh(scr.mw);
}
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.