Use tiocgwinsz for printing the info table.
This commit is contained in:
parent
fd05ecda88
commit
b34770269e
3 changed files with 108 additions and 104 deletions
|
@ -206,7 +206,8 @@ MEMBERS-PRINT-SOURCES=members-print.scm util-bst-ldict.import.scm \
|
|||
bank-account.import.scm members-fees.import.scm \
|
||||
members-payments.import.scm brmember-format.import.scm \
|
||||
specification.import.scm cal-format.import.scm \
|
||||
util-git.import.scm racket-kwargs.import.scm
|
||||
util-git.import.scm racket-kwargs.import.scm \
|
||||
tiocgwinsz.import.scm
|
||||
|
||||
members-print.o: members-print.import.scm
|
||||
members-print.import.scm: $(MEMBERS-PRINT-SOURCES)
|
||||
|
@ -545,7 +546,7 @@ MAILMAN3-SQL-SOURCES=mailman3-sql.scm configuration.import.scm
|
|||
mailman3-sql.o: mailman3-sql.import.scm
|
||||
mailman3-sql.import.scm: $(MAILMAN3-SQL-SOURCES)
|
||||
|
||||
TIOCGWINSZ-SOURCES=tiocgwinsz.scm
|
||||
TIOCGWINSZ-SOURCES=tiocgwinsz.scm duck.import.scm
|
||||
|
||||
tiocgwinsz.o: tiocgwinsz.import.scm
|
||||
tiocgwinsz.import.scm: $(TIOCGWINSZ-SOURCES)
|
||||
|
|
|
@ -67,7 +67,8 @@
|
|||
cal-format
|
||||
util-git
|
||||
cal-day
|
||||
racket-kwargs)
|
||||
racket-kwargs
|
||||
tiocgwinsz)
|
||||
|
||||
(define *show-payments-count* (make-parameter 36))
|
||||
|
||||
|
@ -301,6 +302,7 @@
|
|||
|
||||
;; Prints nicely aligned members base info
|
||||
(define (print-members-base-table mb)
|
||||
(let-values (((rows columns) (term-size)))
|
||||
(let* ((total-count (length
|
||||
(find-members-by-predicate mb brmember-usable?)))
|
||||
(invalid-mrs (find-members-by-predicate
|
||||
|
@ -395,8 +397,8 @@
|
|||
#:border '(((#:bottom #:right light) ... (#:bottom light))
|
||||
...
|
||||
((#:right light) ... none))
|
||||
#:width 70
|
||||
#:ansi-reset? #t)))
|
||||
#:width (- columns 10)
|
||||
#:ansi-reset? #t))))
|
||||
(let ((pmrs (find-members-by-predicate mb brmember-file-has-problems?)))
|
||||
(when (not (null? pmrs))
|
||||
(newline)
|
||||
|
|
|
@ -27,19 +27,19 @@
|
|||
|
||||
(import duck)
|
||||
|
||||
(foreign-declare "#include <sys/ioctl.h>")
|
||||
|
||||
(module*
|
||||
tiocgwinsz
|
||||
#:doc ("TTY terminal size support.")
|
||||
(
|
||||
tiocgwinsz
|
||||
term-size
|
||||
)
|
||||
|
||||
(import scheme
|
||||
(chicken foreign)
|
||||
(chicken bitwise))
|
||||
|
||||
(foreign-declare "#include <sys/ioctl.h>")
|
||||
|
||||
(define tiocgwinsz-ioctl
|
||||
(foreign-lambda*
|
||||
int ()
|
||||
|
@ -53,10 +53,11 @@ if (ioctl(0, TIOCGWINSZ, &wss) == 0) {
|
|||
"
|
||||
))
|
||||
|
||||
(define/doc (tiocgwinsz)
|
||||
(define/doc (term-size)
|
||||
("Returns the number of terminal rows and columns.")
|
||||
(let ((res (tiocgwinsz-ioctl)))
|
||||
(values (bitwise-and res #xffff)
|
||||
(arithmetic-shift res -16))))
|
||||
(values
|
||||
(arithmetic-shift res -16)
|
||||
(bitwise-and res #xffff))))
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue