diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2008-06-12 21:36:48 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2008-06-12 21:36:48 +0000 |
commit | ff1b7aeb9e536822c04d42745e009d4d5aa57750 (patch) | |
tree | 97275c9cb952cf30328c78d0132f7dcbc2a6c936 /usr.bin/mg | |
parent | 9be045ee248e56e236b64c75e2bfcd3722d7f1e4 (diff) |
Make set-fill-column interactive (and scriptable in a startup file)
This replaces the ridiculous "move cursor to where you want to wrap things
and invoke this comment" behavior of before.
Note, this makes auto-fill-mode the moral equivalent of mail-mode.
(and set-fill-column the moral equivalent of mail-set-margin)
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/paragraph.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c index 31e8facfeb1..a4378977a22 100644 --- a/usr.bin/mg/paragraph.c +++ b/usr.bin/mg/paragraph.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paragraph.c,v 1.15 2006/11/17 08:45:31 kjell Exp $ */ +/* $OpenBSD: paragraph.c,v 1.16 2008/06/12 21:36:47 kjell Exp $ */ /* This file is in the public domain. */ @@ -336,7 +336,21 @@ fillword(int f, int n) int setfillcol(int f, int n) { - fillcol = ((f & FFARG) ? n : getcolpos()); - ewprintf("Fill column set to %d", fillcol); + char buf[32], *rep; + const char *es; + + if ((f & FFARG) != 0) { + fillcol = n; + } else { + if ((rep = eread("Set fill-column: ", buf, sizeof(buf), + EFNEW | EFCR)) == NULL) + return (ABORT); + else if (rep[0] == '\0') + return (FALSE); + fillcol = strtonum(rep, 0, INT_MAX, &es); + if (es != NULL) + return (FALSE); + ewprintf("Fill column set to %d", fillcol); + } return (TRUE); } |