Recently Written · git

clic

MIRROR ONLY Gopher client with pretty colours in Common Lisp

git clone https://github.com/equwal/clic

Log | Files | Refs


commit 76ff5f0a91d9fbf3b2c0ef87d437c7243ecff59a
Solene Rapenne <solene@perso.pw>
2019-04-02 15:13:16 +0200

Add non split mode

 README.md |  6 +++++-
 clic.1    |  6 +++++-
 clic.lisp | 10 +++++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index a430a99..e9780a8 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/clic.1 b/clic.1
index f75fab7..760c35e 100644
--- a/clic.1
+++ b/clic.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
diff --git a/clic.lisp b/clic.lisp
index b905b3a..9402351 100644
--- a/clic.lisp
+++ b/clic.lisp
@@ -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