[Linedit-cvs] CVS update: src/command-keys.lisp src/main.lisp src/terminal.lisp

Nikodemus Siivola nsiivola at common-lisp.net
Mon Oct 20 17:49:05 UTC 2003


Update of /project/linedit/cvsroot/src
In directory common-lisp.net:/tmp/cvs-serv22148

Modified Files:
	command-keys.lisp main.lisp terminal.lisp 
Log Message:
Prettier help thanks to reordering of DEFCOMMANDS and fixed DISPLAY.
Date: Mon Oct 20 13:49:05 2003
Author: nsiivola

Index: src/command-keys.lisp
diff -u src/command-keys.lisp:1.4 src/command-keys.lisp:1.5
--- src/command-keys.lisp:1.4	Thu Oct 16 11:52:20 2003
+++ src/command-keys.lisp	Mon Oct 20 13:49:05 2003
@@ -27,7 +27,6 @@
   (when action
     `(setf (gethash ,command *commands*) ,action)))
 
-(defcommand "C-Space" 'set-mark)
 (defcommand "C-A" 'move-to-bol)
 (defcommand "C-B" 'move-char-left)
 (defcommand "C-C" 'interrupt-lisp)
@@ -35,12 +34,9 @@
 (defcommand "C-E" 'move-to-eol)
 (defcommand "C-F" 'move-char-right)
 (defcommand "C-G")
-(defcommand "C-Backspace" 'delete-word-backwards)
-(defcommand "Tab" 'complete)
 (defcommand "C-J")
 (defcommand "C-K" 'kill-to-eol)
 (defcommand "C-L")
-(defcommand "Return" 'finish-input)
 (defcommand "C-N" 'history-next)
 (defcommand "C-O")
 (defcommand "C-P" 'history-previous)
@@ -55,7 +51,6 @@
 (defcommand "C-Y" 'yank)
 (defcommand "C-Z" 'stop-lisp)
 (defcommand "C--" 'undo)
-(defcommand "Backspace" 'delete-char-backwards)
 
 (defcommand "M-A" 'apropos-word)
 (defcommand "M-B" 'move-word-backwards)
@@ -93,6 +88,13 @@
 (defcommand "M-8")
 (defcommand "M-9")
 (defcommand "M-0")
+
+(defcommand "C-Space" 'set-mark)
+(defcommand "C-Backspace" 'delete-word-backwards)
+
+(defcommand "Tab" 'complete)
+(defcommand "Backspace" 'delete-char-backwards)
+(defcommand "Return" 'finish-input)
 
 (defcommand "Up-arrow" 'history-previous)
 (defcommand "Down-arrow" 'history-next)


Index: src/main.lisp
diff -u src/main.lisp:1.6 src/main.lisp:1.7
--- src/main.lisp:1.6	Mon Oct 20 11:34:03 2003
+++ src/main.lisp	Mon Oct 20 13:49:05 2003
@@ -22,6 +22,7 @@
 (in-package :linedit)
 
 (defun linedit (&rest keyword-args)
+  "Reads a single line of input with line-editing."
   (let ((editor (apply 'make-editor keyword-args)))
     (with-backend editor
       (catch 'linedit-done
@@ -32,6 +33,9 @@
 
 (defun formedit (&rest args &key (prompt1 "") (prompt2 "")
 		 &allow-other-keys)
+  "Reads a single form of input with line-editing. Returns the form as
+a string.  Not realiable in the presense of customized readtable
+functinality."
   (let ((args (copy-list args)))
     (dolist (key '(:prompt1 :prompt2))
       (remf args key))


Index: src/terminal.lisp
diff -u src/terminal.lisp:1.3 src/terminal.lisp:1.4
--- src/terminal.lisp:1.3	Mon Oct 20 11:34:03 2003
+++ src/terminal.lisp	Mon Oct 20 13:49:05 2003
@@ -97,32 +97,33 @@
     (not (equal #\q q))))
 
 (defmethod print-in-columns ((backend terminal) list &key width)
-  (unwind-protect
-       (let ((max-col (truncate (backend-columns backend) width))
-	     (col 0)
-	     (line 0)
-	     (pad ""))
-	 (dolist (item list)
-	   ;; Ensure new line
-	   (when (= 1 (incf col)) ; you remember C ? ;)
-	     (newline backend))
-	   ;; Pad after previsous
-	   (write-string pad)
-	   (setf pad "")
-	   ;; Item
-	   (write-string item)
-	   ;; Maybe newline
-	   (cond ((= col max-col)
-		  (setf col 0)
-		  (when (= (1+ (incf line)) (backend-lines backend))
-		    (setf line 0)
-		    (unless (page backend)
-		      (return-from print-in-columns nil))))
-		 (t 
-		  (setf pad (make-string (- width (length item)) 
-					 :initial-element #\space))))))
-    ;; needed for the return-from
-    (newline backend)))
+  (let ((max-col (truncate (backend-columns backend) width))
+	(col 0)
+	(line 0)
+	(pad nil))
+    (newline backend)
+    (dolist (item list)
+      (incf col)
+      ;; Padding
+      (when pad
+	(write-string pad)
+	(setf pad nil))
+      ;; Item
+      (write-string item)
+      ;; Maybe newline
+      (cond ((= col max-col)
+	     (newline backend)
+	     (setf col 0)
+	     (when (= (1+ (incf line)) (backend-lines backend))
+	       (setf line 0)
+	       (unless (page backend)
+		 (return-from print-in-columns nil))))
+	    (t 
+	     (setf pad (make-string (- width (length item)) 
+				    :initial-element #\space)))))
+    ;; Optional newline
+    (when pad
+      (newline backend))))
 
 (defmethod print-in-lines ((backend terminal) string)
   (newline backend)





More information about the linedit-cvs mailing list