~solene/clic

76ff5f0a91d9fbf3b2c0ef87d437c7243ecff59a — Solene Rapenne 5 years ago 4878ed4
Add non split mode
3 files changed, 19 insertions(+), 3 deletions(-)

M README.md
M clic.1
M clic.lisp
M README.md => README.md +5 -1
@@ 72,7 72,11 @@ permitting to use clic with the numpad with only one hand :
Command line usage
==================

clic [-k] [url|file]
clic [-t] [-k] [url|file]

If you start clic with -t parameter, then menus will be displayed in
one operation, instead of asking to display next page once it reach
your terminal size.

If you start clic with -k parameter, then kiosk mode is enabled, which
mean it won't call any external program or save any data on the

M clic.1 => clic.1 +5 -1
@@ 6,7 6,7 @@
.Nd a text based gopher client
.Sh SYNOPSIS
.Nm clic
.Op Fl k
.Op Fl t k
.Op URL
.Sh DESCRIPTION
.Nm


@@ 22,6 22,10 @@ will save it using its filename under
.Sh OPTIONS
.Bl -tag -width Ds
.It Op Fl k
activate the non split mode.
This prevent clic to break menu display when the display reach the
terminal size. This is useful when you want to scroll using your terminal.
.It Op Fl k
activate the kiosk mode. (Disable running external applications, temp files,
downloading etc.)
.It Op URL

M clic.lisp => clic.lisp +9 -1
@@ 46,6 46,9 @@
;;;; kiosk mode 
(defparameter *kiosk-mode* nil)

;;;; no split mode
(defparameter *no-split* nil)

(defmacro kiosk-mode(&body code)
  "prevent code if kiosk mode is enabled"
  `(progn


@@ 435,6 438,9 @@
         (c-kiosk-pledge)
         (setf *kiosk-mode* t))

        ((string= "-t" url)
         (setf *no-split* t))

        ((= 0 (or (search "file://" url) 1))
         (load-file-menu (subseq url 7))
         (make-location :host 'local-file


@@ 581,7 587,9 @@
  ;; so if the user doesn't want to scroll
  ;; we break the loop and then execute the command
  (let ((input nil))
    (let ((rows (- (c-termsize) 1))) ; -1 for command bar
    (let ((rows (if *no-split*
                    -1
                    (* (- (c-termsize) 1))))) ; -1 for command bar

      (loop for line across *buffer*
         counting line into row