[Linedit-cvs] CVS update: src/command-functions.lisp src/linedit.asd src/terminal-translations.lisp src/terminal.lisp src/terminal_glue.c src/terminfo.asd src/version.txt src/linedit.h

Nikodemus Siivola nsiivola at common-lisp.net
Mon Oct 20 12:28:57 UTC 2003


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

Modified Files:
	command-functions.lisp linedit.asd terminal-translations.lisp 
	terminal.lisp terminal_glue.c terminfo.asd version.txt 
Removed Files:
	linedit.h 
Log Message:
version 0.14.1

 * Terminfo integration (in a separate asdf-bundle)

 * DELETE-CHAR-FORWARDS

 * Handle meta key as a bitmask as well.

 * Better columnation.

 * Misc. fixes.


Date: Mon Oct 20 08:28:56 2003
Author: nsiivola

Index: src/command-functions.lisp
diff -u src/command-functions.lisp:1.4 src/command-functions.lisp:1.5
--- src/command-functions.lisp:1.4	Mon Sep 29 10:19:01 2003
+++ src/command-functions.lisp	Mon Oct 20 08:28:56 2003
@@ -46,13 +46,16 @@
 	    (concat (subseq string 0 (1- point)) (subseq string point))
 	    (editor-point editor) (1- point)))))
 
-(defun delete-char-forwards-or-eof (chord editor)
+(defun delete-char-forwards (chord editor)
   (declare (ignore chord))
+  (with-editor-point-and-string ((point string) editor)
+    (setf (editor-string editor)
+	  (concat (subseq string 0 point) (subseq string (1+ point))))))
+
+(defun delete-char-forwards-or-eof (chord editor)
   (if (equal "" (editor-string editor))
       (error 'end-of-file :stream *standard-input*)
-      (with-editor-point-and-string ((point string) editor)
-	(setf (editor-string editor)
-	      (concat (subseq string 0 point) (subseq string (1+ point)))))))
+      (delete-char-forwards chord editor)))
 
 (defun delete-word-backwards (chord editor)
   (declare (ignore chord))


Index: src/linedit.asd
diff -u src/linedit.asd:1.18 src/linedit.asd:1.19
--- src/linedit.asd:1.18	Sun Oct 19 19:38:23 2003
+++ src/linedit.asd	Mon Oct 20 08:28:56 2003
@@ -48,7 +48,7 @@
     (error 'operation-error :component c :operation o)))
 
 (defsystem :linedit
-    :depends-on (:uffi)
+    :depends-on (:uffi :terminfo)
     :components
   (;; Common
    (:file "packages")
@@ -58,11 +58,9 @@
    ;; Backend
    (:file "backend" :depends-on ("utility-macros"))
    (:c-source-file "terminal_glue")
-   (:file "terminal-translations")
+   (:file "terminal-translations" :depends-on ("packages"))
    (:file "terminal" :depends-on ("terminal-translations" "backend" "terminal_glue"))
-   (:file "dumb-terminal" :depends-on ("terminal"))
-   (:file "terminfo")
-   (:file "smart-terminal" :depends-on ("terminal" "terminfo"))
+   (:file "smart-terminal" :depends-on ("terminal"))
    (:file "dumb-terminal" :depends-on ("terminal"))
 
    ;; Editor


Index: src/terminal-translations.lisp
diff -u src/terminal-translations.lisp:1.1 src/terminal-translations.lisp:1.2
--- src/terminal-translations.lisp:1.1	Sun Oct 19 19:38:23 2003
+++ src/terminal-translations.lisp	Mon Oct 20 08:28:56 2003
@@ -23,8 +23,11 @@
 
 (defvar *terminal-translations* (make-hash-table :test #'equalp))
 
-(defmacro deftrans (name chord)
-  `(setf (gethash ,chord *terminal-translations*) ,name))
+(defmacro deftrans (name chord &optional alt)
+  `(progn 
+     (setf (gethash ,chord *terminal-translations*) ,name)
+     (when ,alt
+       (setf (gethash ,alt *terminal-translations*) ,name))))
 
 (deftrans "C-Space" 0)
 (deftrans "C-A" 1)
@@ -56,42 +59,42 @@
 (deftrans "C--" 31)
 (deftrans "Backspace" 127)
 
-(deftrans "M-A" '(#\Esc #\A))
-(deftrans "M-B" '(#\Esc #\B))
-(deftrans "M-C" '(#\Esc #\C))
-(deftrans "M-D" '(#\Esc #\D))
-(deftrans "M-E" '(#\Esc #\E))
-(deftrans "M-F" '(#\Esc #\F))
-(deftrans "M-G" '(#\Esc #\G))
-(deftrans "M-H" '(#\Esc #\H))
-(deftrans "M-I" '(#\Esc #\I))
-(deftrans "M-J" '(#\Esc #\J))
-(deftrans "M-K" '(#\Esc #\K))
-(deftrans "M-L" '(#\Esc #\L))
-(deftrans "M-M" '(#\Esc #\M))
-(deftrans "M-N" '(#\Esc #\N))
-(deftrans "M-O" '(#\Esc #\O))
-(deftrans "M-P" '(#\Esc #\P))
-(deftrans "M-Q" '(#\Esc #\Q))
-(deftrans "M-R" '(#\Esc #\R))
-(deftrans "M-S" '(#\Esc #\S))
-(deftrans "M-T" '(#\Esc #\T))
-(deftrans "M-U" '(#\Esc #\U))
-(deftrans "M-V" '(#\Esc #\V))
-(deftrans "M-W" '(#\Esc #\W))
-(deftrans "M-X" '(#\Esc #\X))
-(deftrans "M-Y" '(#\Esc #\Y))
-(deftrans "M-Z" '(#\Esc #\Z))
-(deftrans "M-1" '(#\Esc #\1))
-(deftrans "M-2" '(#\Esc #\2))
-(deftrans "M-3" '(#\Esc #\3))
-(deftrans "M-4" '(#\Esc #\4))
-(deftrans "M-5" '(#\Esc #\5))
-(deftrans "M-6" '(#\Esc #\6))
-(deftrans "M-7" '(#\Esc #\7))
-(deftrans "M-8" '(#\Esc #\8))
-(deftrans "M-9" '(#\Esc #\9))
-(deftrans "M-0" '(#\Esc #\0))
+(deftrans "M-A" '(#\Esc #\A) 225)
+(deftrans "M-B" '(#\Esc #\B) 226)
+(deftrans "M-C" '(#\Esc #\C) 227)
+(deftrans "M-D" '(#\Esc #\D) 228)
+(deftrans "M-E" '(#\Esc #\E) 229)
+(deftrans "M-F" '(#\Esc #\F) 230)
+(deftrans "M-G" '(#\Esc #\G) 231)
+(deftrans "M-H" '(#\Esc #\H) 232)
+(deftrans "M-I" '(#\Esc #\I) 233)
+(deftrans "M-J" '(#\Esc #\J) 234)
+(deftrans "M-K" '(#\Esc #\K) 235)
+(deftrans "M-L" '(#\Esc #\L) 236)
+(deftrans "M-M" '(#\Esc #\M) 237)
+(deftrans "M-N" '(#\Esc #\N) 238)
+(deftrans "M-O" '(#\Esc #\O) 239)
+(deftrans "M-P" '(#\Esc #\P) 240)
+(deftrans "M-Q" '(#\Esc #\Q) 241)
+(deftrans "M-R" '(#\Esc #\R) 242)
+(deftrans "M-S" '(#\Esc #\S) 243)
+(deftrans "M-T" '(#\Esc #\T) 244)
+(deftrans "M-U" '(#\Esc #\U) 245)
+(deftrans "M-V" '(#\Esc #\V) 246)
+(deftrans "M-W" '(#\Esc #\W) 247)
+(deftrans "M-X" '(#\Esc #\X) 248)
+(deftrans "M-Y" '(#\Esc #\Y) 249)
+(deftrans "M-Z" '(#\Esc #\Z) 250)
+(deftrans "M-0" '(#\Esc #\0) 176)
+(deftrans "M-1" '(#\Esc #\1) 177)
+(deftrans "M-2" '(#\Esc #\2) 178)
+(deftrans "M-3" '(#\Esc #\3) 179)
+(deftrans "M-4" '(#\Esc #\4) 180)
+(deftrans "M-5" '(#\Esc #\5) 181)
+(deftrans "M-6" '(#\Esc #\6) 182)
+(deftrans "M-7" '(#\Esc #\7) 183)
+(deftrans "M-8" '(#\Esc #\8) 184)
+(deftrans "M-9" '(#\Esc #\9) 185)
 
 (deftrans "Up-arrow"    '(#\Esc #\[ #\A))
 (deftrans "Down-arrow"  '(#\Esc #\[ #\B))


Index: src/terminal.lisp
diff -u src/terminal.lisp:1.1 src/terminal.lisp:1.2
--- src/terminal.lisp:1.1	Sun Oct 19 19:38:23 2003
+++ src/terminal.lisp	Mon Oct 20 08:28:56 2003
@@ -97,23 +97,32 @@
     (not (equal #\q q))))
 
 (defmethod print-in-columns ((backend terminal) list &key width)
-  (terpri)
-  (let ((cols (truncate (backend-columns backend) width)))
-    (do ((item #1=(pop list) #1#)
-	 (i 0 (1+ i))
-	 (line 0))
-	((null item))
-      (when (= i cols)
-	(terpri)
-	(setf i 0)
-	(when (= (1+ (incf line)) (backend-lines backend))
-	  (setf line 0)
-	  (unless (page backend)
-	    (return-from print-in-columns nil))))
-      (write-string item)
-      (loop repeat (- width (length item))
-	    do (write-char #\Space))))
-  (terpri))
+  (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)))
 
 (defmethod print-in-lines ((backend terminal) string)
   (terpri)
@@ -131,4 +140,5 @@
   (terpri))
 
 (defmethod newline ((backend terminal))
-  (terpri))
+  (write-char #\newline)
+  (write-char #\return))


Index: src/terminal_glue.c
diff -u src/terminal_glue.c:1.1 src/terminal_glue.c:1.2
--- src/terminal_glue.c:1.1	Sun Oct 19 19:38:23 2003
+++ src/terminal_glue.c	Mon Oct 20 08:28:56 2003
@@ -62,7 +62,6 @@
 
   cfmakeraw (&tmp);
   tmp.c_lflag &= ~ECHO;
-  tmp.c_oflag |= OPOST;
 
   if (0 > tcsetattr (STDIN_FILENO, TCSAFLUSH, &tmp))
     return linedit_TCSETATTR_ERROR;


Index: src/terminfo.asd
diff -u src/terminfo.asd:1.1 src/terminfo.asd:1.2
--- src/terminfo.asd:1.1	Mon Oct 20 03:49:24 2003
+++ src/terminfo.asd	Mon Oct 20 08:28:56 2003
@@ -23,8 +23,5 @@
 ;; file, not to terminfo.lisp, which has a "Verbatim use and
 ;; redistribution permitted." license.
 
-(in-package :asdf)
-
-(defsystem :terminfo 
-    :version "1.0"
-    :components (:file "terminfo"))
+(asdf:defsystem :terminfo 
+    :components ((:file "terminfo")))


Index: src/version.txt
diff -u src/version.txt:1.5 src/version.txt:1.6
--- src/version.txt:1.5	Thu Oct 16 11:52:20 2003
+++ src/version.txt	Mon Oct 20 08:28:56 2003
@@ -1 +1 @@
-0.13.2
+0.14.1







More information about the linedit-cvs mailing list