From nsiivola at common-lisp.net Thu Oct 16 15:52:21 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Thu, 16 Oct 2003 11:52:21 -0400 Subject: [Linedit-cvs] CVS update: src/command-keys.lisp src/linedit.asd src/pool.lisp src/version.txt Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv30924 Modified Files: command-keys.lisp linedit.asd pool.lisp version.txt Log Message: Added C-n and C-p as history bindings. Fixed building on Darwin. Fixed undo pool. Date: Thu Oct 16 11:52:20 2003 Author: nsiivola Index: src/command-keys.lisp diff -u src/command-keys.lisp:1.3 src/command-keys.lisp:1.4 --- src/command-keys.lisp:1.3 Mon Sep 29 10:19:01 2003 +++ src/command-keys.lisp Thu Oct 16 11:52:20 2003 @@ -41,9 +41,9 @@ (defcommand "C-K" 'kill-to-eol) (defcommand "C-L") (defcommand "Return" 'finish-input) -(defcommand "C-N") +(defcommand "C-N" 'history-next) (defcommand "C-O") -(defcommand "C-P") +(defcommand "C-P" 'history-previous) (defcommand "C-Q") (defcommand "C-R") (defcommand "C-S") Index: src/linedit.asd diff -u src/linedit.asd:1.15 src/linedit.asd:1.16 --- src/linedit.asd:1.15 Mon Sep 29 15:28:36 2003 +++ src/linedit.asd Thu Oct 16 11:52:20 2003 @@ -25,6 +25,10 @@ (defvar *gcc* "/usr/bin/gcc") +(defvar *gcc-options* '(#-darwin "-shared" + #+darwin "-bundle" + "-fPIC")) + (defmethod output-files ((o compile-op) (c c-source-file)) (list (make-pathname :name (component-name c) :type "so" @@ -36,9 +40,10 @@ (funcall loader f)))) (defmethod perform ((o compile-op) (c c-source-file)) - (unless (zerop (run-shell-command "~A ~A -shared -fPIC -o ~A" + (unless (zerop (run-shell-command "~A ~A ~{~A ~}-o ~A" *gcc* (namestring (component-pathname c)) + *gcc-options* (namestring (car (output-files o c))))) (error 'operation-error :component c :operation o))) Index: src/pool.lisp diff -u src/pool.lisp:1.2 src/pool.lisp:1.3 --- src/pool.lisp:1.2 Sun Sep 28 07:37:43 2003 +++ src/pool.lisp Thu Oct 16 11:52:20 2003 @@ -51,5 +51,5 @@ (vector-push-extend object store))) (defun rewind (pool) - (setf (%pool-index pool) (mod (1+ (%pool-index pool)) (pool-size pool))) + (setf (%pool-index pool) (mod (1+ (%pool-index pool)) (%pool-size pool))) (aref (%pool-store pool) (- (%pool-size pool) (%pool-index pool) 1))) Index: src/version.txt diff -u src/version.txt:1.4 src/version.txt:1.5 --- src/version.txt:1.4 Mon Sep 29 15:30:44 2003 +++ src/version.txt Thu Oct 16 11:52:20 2003 @@ -1 +1 @@ -0.13 +0.13.2 From nsiivola at common-lisp.net Sun Oct 19 22:49:58 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Sun, 19 Oct 2003 18:49:58 -0400 Subject: [Linedit-cvs] CVS update: src/smart-terminal.lisp src/linedit.asd src/packages.lisp Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv25818 Modified Files: linedit.asd packages.lisp Added Files: smart-terminal.lisp Log Message: Initial terminfo handling. Needs Paul Foley's terminfo.lisp. Date: Sun Oct 19 18:49:58 2003 Author: nsiivola Index: src/linedit.asd diff -u src/linedit.asd:1.16 src/linedit.asd:1.17 --- src/linedit.asd:1.16 Thu Oct 16 11:52:20 2003 +++ src/linedit.asd Sun Oct 19 18:49:58 2003 @@ -59,7 +59,8 @@ (:file "generic-backend" :depends-on ("utility-macros")) (:c-source-file "dumb_terminal") (:file "dumb-terminal-translations") - (:file "dumb-terminal" :depends-on ("generic-backend" + (:file "terminfo") + (:file "dumb-terminal" :depends-on ("generic-backend" "terminfo" "dumb-terminal-translations" "dumb_terminal")) ;; Editor Index: src/packages.lisp diff -u src/packages.lisp:1.10 src/packages.lisp:1.11 --- src/packages.lisp:1.10 Sun Sep 28 07:37:43 2003 +++ src/packages.lisp Sun Oct 19 18:49:58 2003 @@ -25,6 +25,6 @@ #:linedit #:formedit #:*default-columns* - #:*default-lines* + #:*default-lines* #+sbcl #:install-repl )) From nsiivola at common-lisp.net Sun Oct 19 23:38:24 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Sun, 19 Oct 2003 19:38:24 -0400 Subject: [Linedit-cvs] CVS update: src/backend.lisp src/terminal-translations.lisp src/terminal.lisp src/terminal_glue.c src/dumb-terminal.lisp src/linedit.asd src/utility-macros.lisp src/dumb-terminal-translations.lisp src/dumb_terminal.c src/generic-backend.lisp Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv19455 Modified Files: dumb-terminal.lisp linedit.asd utility-macros.lisp Added Files: backend.lisp terminal-translations.lisp terminal.lisp terminal_glue.c Removed Files: dumb-terminal-translations.lisp dumb_terminal.c generic-backend.lisp Log Message: Added more infra for terminfo support. terminfo.lisp still needed Date: Sun Oct 19 19:38:23 2003 Author: nsiivola Index: src/dumb-terminal.lisp diff -u src/dumb-terminal.lisp:1.4 src/dumb-terminal.lisp:1.5 --- src/dumb-terminal.lisp:1.4 Mon Sep 29 10:19:01 2003 +++ src/dumb-terminal.lisp Sun Oct 19 19:38:23 2003 @@ -24,44 +24,11 @@ ;;; The simplest Linedit backend, that copes only with single lines ;;; of limited length. -(defclass dumb-terminal (backend) - ((translations :initform *dumb-terminal-translations*))) - -(uffi:def-function ("linedit_dumb_terminal_columns" c-dumb-terminal-columns) - ((default :int)) - :returning :int) - -(defmethod backend-columns ((backend dumb-terminal)) - (c-dumb-terminal-columns *default-columns*)) +(defclass dumb-terminal (terminal) ()) (defmethod line-length-limit ((backend dumb-terminal)) (backend-columns backend)) -(uffi:def-function ("linedit_dumb_terminal_lines" c-dumb-terminal-lines) - ((default :int)) - :returning :int) - -(defmethod backend-lines ((backend dumb-terminal)) - (c-dumb-terminal-lines *default-lines*)) - -(uffi:def-function ("linedit_dumb_terminal_init" c-dumb-terminal-init) - () - :returning :int) - -(defmethod backend-init ((backend dumb-terminal)) - (assert (not (backend-ready-p backend))) - (assert (zerop (c-dumb-terminal-init))) - (setf (backend-ready-p backend) t)) - -(uffi:def-function ("linedit_dumb_terminal_close" c-dumb-terminal-close) - () - :returning :int) - -(defmethod backend-close ((backend dumb-terminal)) - (assert (backend-ready-p backend)) - (assert (zerop (c-dumb-terminal-close))) - (setf (backend-ready-p backend) nil)) - (defmethod display ((backend dumb-terminal) prompt line) (let ((string (line-string line))) (flet ((write-prompt () @@ -76,80 +43,3 @@ (write-prompt) (write-string (subseq string 0 (line-point line))) (force-output)))) - -(defmethod read-chord ((backend dumb-terminal)) - (assert (backend-ready-p backend)) - (flet ((read-open-chord () - (do ((chars nil) - (c #1=(read-char) #1#)) - ((member c '(#\- #\~ #\$)) (nconc (nreverse chars) (list c))) - (push c chars)))) - (let ((chord - (acase (read-char) - (#\Esc - (cons it (acase (read-char) - (#\[ (cons - it - (let ((char (read-char))) - (if (digit-char-p char) - (cons char - (read-open-chord)) - (list char))))) - (t (list it))))) - (t (if (graphic-char-p it) - it - (char-code it)))))) - (gethash chord - (backend-translations backend) - (if (characterp chord) - chord - (list 'untranslated chord)))))) - -(defmethod beep ((b dumb-terminal)) - (declare (ignore b)) - (and (write-char #\Bell *error-output*) - (force-output *error-output*))) - -(defmethod page ((backend dumb-terminal)) - (write-string "--more--") - (force-output) - (let ((q (read-chord backend))) - (write-char #\Return) - (not (equal #\q q)))) - -(defmethod print-in-columns ((backend dumb-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)) - -(defmethod print-in-lines ((backend dumb-terminal) string) - (terpri) - (do ((i 0 (1+ i)) - (lines 0)) - ((= i (length string))) - (let ((c (schar string i))) - (when (= lines (backend-lines backend)) - (setf lines 0) - (unless (page backend) - (return-from print-in-lines nil))) - (when (eql #\newline c) - (incf lines)) - (write-char c))) - (terpri)) - -(defmethod newline ((backend dumb-terminal)) - (terpri)) Index: src/linedit.asd diff -u src/linedit.asd:1.17 src/linedit.asd:1.18 --- src/linedit.asd:1.17 Sun Oct 19 18:49:58 2003 +++ src/linedit.asd Sun Oct 19 19:38:23 2003 @@ -56,25 +56,22 @@ (:file "utility-functions" :depends-on ("packages")) ;; Backend - (:file "generic-backend" :depends-on ("utility-macros")) - (:c-source-file "dumb_terminal") - (:file "dumb-terminal-translations") + (:file "backend" :depends-on ("utility-macros")) + (:c-source-file "terminal_glue") + (:file "terminal-translations") + (:file "terminal" :depends-on ("terminal-translations" "backend" "terminal_glue")) + (:file "dumb-terminal" :depends-on ("terminal")) (:file "terminfo") - (:file "dumb-terminal" :depends-on ("generic-backend" "terminfo" - "dumb-terminal-translations" - "dumb_terminal")) + (:file "smart-terminal" :depends-on ("terminal" "terminfo")) + (:file "dumb-terminal" :depends-on ("terminal")) + ;; Editor (:file "pool" :depends-on ("utility-macros")) (:file "line" :depends-on ("utility-macros")) (:file "buffer" :depends-on ("utility-macros")) (:file "command-keys" :depends-on ("packages")) (:c-source-file "signals") - (:file "editor" :depends-on ("generic-backend" - "pool" - "signals" - "line" - "buffer" - "command-keys")) + (:file "editor" :depends-on ("backend" "pool" "signals" "line" "buffer" "command-keys")) (:file "main" :depends-on ("editor")) (:file "complete" :depends-on ("utility-macros")) (:file "command-functions" :depends-on ("editor")) Index: src/utility-macros.lisp diff -u src/utility-macros.lisp:1.2 src/utility-macros.lisp:1.3 --- src/utility-macros.lisp:1.2 Sun Sep 28 07:37:43 2003 +++ src/utility-macros.lisp Sun Oct 19 19:38:23 2003 @@ -51,3 +51,12 @@ (find-symbol (symbol-name ,var) ,package) (when (eq ,state :internal) , at forms))))) + +(defmacro invariant (condition) + (with-unique-names (value) + `(let ((,value ,condition)) + (unless ,value + (error "BUG: You seem to have found a bug in Linedit. Please report this incident ~ + along with directions to reproduce and the following message to ~ + linedit-devel at common-lisp.net: `Invariant ~S violated.'" + ',condition))))) From nsiivola at common-lisp.net Sun Oct 19 23:47:22 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Sun, 19 Oct 2003 19:47:22 -0400 Subject: [Linedit-cvs] CVS update: src/editor.lisp src/smart-terminal.lisp Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv25100 Modified Files: editor.lisp smart-terminal.lisp Log Message: Automagic selection between terminal types. Date: Sun Oct 19 19:47:21 2003 Author: nsiivola Index: src/editor.lisp diff -u src/editor.lisp:1.4 src/editor.lisp:1.5 --- src/editor.lisp:1.4 Mon Sep 29 10:19:02 2003 +++ src/editor.lisp Sun Oct 19 19:47:21 2003 @@ -27,7 +27,9 @@ ((undo-pool :reader undo-pool :initform (make-instance 'pool)) (line :reader editor-line :initform (make-instance 'line)) (backend :reader editor-backend - :initform (make-instance 'dumb-terminal) + :initform (if (smart-terminal-p) + (make-instance 'smart-terminal) + (make-instance 'dumb-terminal)) :initarg :backend) (commands :reader editor-commands :initform *commands* Index: src/smart-terminal.lisp diff -u src/smart-terminal.lisp:1.1 src/smart-terminal.lisp:1.2 --- src/smart-terminal.lisp:1.1 Sun Oct 19 18:49:58 2003 +++ src/smart-terminal.lisp Sun Oct 19 19:47:21 2003 @@ -25,6 +25,11 @@ ((point-row :initform 1 :accessor point-row) (active-string :initform "" :accessor active-string))) +(defun smart-terminal-p () + (every (lambda (key) + (ti:capability key)) + '(:cursor-up :cursor-down :clr-eos :column-address))) + (defmethod display ((backend smart-terminal) prompt line) (let ((*terminal-io* *standard-output*) (columns (backend-columns backend))) From nsiivola at common-lisp.net Mon Oct 20 07:49:25 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 03:49:25 -0400 Subject: [Linedit-cvs] CVS update: src/terminfo.asd src/terminfo.lisp src/Makefile Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv15949 Modified Files: Makefile Added Files: terminfo.asd terminfo.lisp Log Message: Added terminfo as a separate system. Date: Mon Oct 20 03:49:25 2003 Author: nsiivola Index: src/terminfo.lisp diff -u /dev/null src/terminfo.lisp:1.4 --- /dev/null Mon Oct 20 03:49:25 2003 +++ src/terminfo.lisp Mon Oct 20 03:49:24 2003 @@ -0,0 +1,867 @@ +;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: TERMINFO -*- + +;;; $Revision: 1.4 $ +;;; Copyright ? 2001 Paul Foley (mycroft at actrix.gen.nz) +;;; All rights reserved. Use and verbatim redistribution permitted. +;;; +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +;;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +;;; OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +;;; USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +;;; DAMAGE. +#+CMU (ext:file-comment "$Header: /project/linedit/cvsroot/src/terminfo.lisp,v 1.4 2003/10/20 07:49:24 nsiivola Exp $") + +(in-package "CL-USER") + +;; DEFPACKAGE would warn here, since we export things outside the +;; definition. +(eval-when (:compile-toplevel :load-toplevel) + (unless (find-package "TERMINFO") + (make-package "TERMINFO" :nicknames '("TI") :use '("CL")))) + +(in-package "TERMINFO") + +(export '(*terminfo-directory* *terminfo* capability tparm + tputs set-terminal)) + +(defvar *terminfo-directory* "/usr/share/terminfo/") + +(defvar *terminfo* nil) + +(defvar *capabilities* (make-hash-table :size 494)) + +(flet ((required-argument () + (error "A required argument was not supplied."))) + (defstruct (terminfo + (:print-function + (lambda (object stream depth) + (declare (ignore depth)) + (print-unreadable-object (object stream :type t :identity t) + (format stream "~A" (first (terminfo-names object))))))) + (names (required-argument) :type list :read-only t) + (booleans (required-argument) :type (simple-array (member t nil) (*))) + (numbers (required-argument) :type (simple-array (signed-byte 16) (*))) + (strings (required-argument) :type (simple-array t (*))))) + +(defun capability (name &optional (terminfo *terminfo*)) + (let ((whatsit (gethash name *capabilities*))) + (if (or (null terminfo) (>= (cdr whatsit) + (length (funcall (car whatsit) terminfo)))) + nil #| default |# + (let ((value (aref (funcall (car whatsit) terminfo) (cdr whatsit)))) + (if (and (numberp value) (minusp value)) + nil + value))))) + +(defmacro defcap (name type index) + (let ((thing (ecase type + (boolean 'terminfo-booleans) + (integer 'terminfo-numbers) + (string 'terminfo-strings)))) + `(progn + (setf (gethash ,(intern (string name) "KEYWORD") *capabilities*) + (cons #',thing ,index)) + (define-symbol-macro ,name + (capability ,(intern (string name) "KEYWORD") *terminfo*)) + (export ',name "TERMINFO")))) + +(defcap auto-left-margin boolean 0) +(defcap auto-right-margin boolean 1) +(defcap no-esc-ctlc boolean 2) +(defcap ceol-standout-glitch boolean 3) +(defcap eat-newline-glitch boolean 4) +(defcap erase-overstrike boolean 5) +(defcap generic-type boolean 6) +(defcap hard-copy boolean 7) +(defcap has-meta-key boolean 8) +(defcap has-status-line boolean 9) +(defcap insert-null-glitch boolean 10) +(defcap memory-above boolean 11) +(defcap memory-below boolean 12) +(defcap move-insert-mode boolean 13) +(defcap move-standout-mode boolean 14) +(defcap over-strike boolean 15) +(defcap status-line-esc-ok boolean 16) +(defcap dest-tabs-magic-smso boolean 17) +(defcap tilde-glitch boolean 18) +(defcap transparent-underline boolean 19) +(defcap xon-xoff boolean 20) +(defcap needs-xon-xoff boolean 21) +(defcap prtr-silent boolean 22) +(defcap hard-cursor boolean 23) +(defcap non-rev-rmcup boolean 24) +(defcap no-pad-char boolean 25) +(defcap non-dest-scroll-region boolean 26) +(defcap can-change boolean 27) +(defcap back-color-erase boolean 28) +(defcap hue-lightness-saturation boolean 29) +(defcap col-addr-glitch boolean 30) +(defcap cr-cancels-micro-mode boolean 31) +(defcap has-print-wheel boolean 32) +(defcap row-addr-glitch boolean 33) +(defcap semi-auto-right-margin boolean 34) +(defcap cpi-changes-res boolean 35) +(defcap lpi-changes-res boolean 36) + +(defcap columns integer 0) +(defcap init-tabs integer 1) +(defcap lines integer 2) +(defcap lines-of-memory integer 3) +(defcap magic-cookie-glitch integer 4) +(defcap padding-baud-rate integer 5) +(defcap virtual-terminal integer 6) +(defcap width-status-line integer 7) +(defcap num-labels integer 8) +(defcap label-height integer 9) +(defcap label-width integer 10) +(defcap max-attributes integer 11) +(defcap maximum-windows integer 12) +(defcap max-colors integer 13) +(defcap max-pairs integer 14) +(defcap no-color-video integer 15) +(defcap buffer-capacity integer 16) +(defcap dot-vert-spacing integer 17) +(defcap dot-horz-spacing integer 18) +(defcap max-micro-address integer 19) +(defcap max-micro-jump integer 20) +(defcap micro-col-size integer 21) +(defcap micro-line-size integer 22) +(defcap number-of-pins integer 23) +(defcap output-res-char integer 24) +(defcap output-res-line integer 25) +(defcap output-res-horz-inch integer 26) +(defcap output-res-vert-inch integer 27) +(defcap print-rate integer 28) +(defcap wide-char-size integer 29) +(defcap buttons integer 30) +(defcap bit-image-entwining integer 31) +(defcap bit-image-type integer 32) + +(defcap back-tab string 0) +(defcap bell string 1) +(defcap carriage-return string 2) +(defcap change-scroll-region string 3) +(defcap clear-all-tabs string 4) +(defcap clear-screen string 5) +(defcap clr-eol string 6) +(defcap clr-eos string 7) +(defcap column-address string 8) +(defcap command-character string 9) +(defcap cursor-address string 10) +(defcap cursor-down string 11) +(defcap cursor-home string 12) +(defcap cursor-invisible string 13) +(defcap cursor-left string 14) +(defcap cursor-mem-address string 15) +(defcap cursor-normal string 16) +(defcap cursor-right string 17) +(defcap cursor-to-ll string 18) +(defcap cursor-up string 19) +(defcap cursor-visible string 20) +(defcap delete-character string 21) +(defcap delete-line string 22) +(defcap dis-status-line string 23) +(defcap down-half-line string 24) +(defcap enter-alt-charset-mode string 25) +(defcap enter-blink-mode string 26) +(defcap enter-bold-mode string 27) +(defcap enter-ca-mode string 28) +(defcap enter-delete-mode string 29) +(defcap enter-dim-mode string 30) +(defcap enter-insert-mode string 31) +(defcap enter-secure-mode string 32) +(defcap enter-protected-mode string 33) +(defcap enter-reverse-mode string 34) +(defcap enter-standout-mode string 35) +(defcap enter-underline-mode string 36) +(defcap erase-chars string 37) +(defcap exit-alt-charset-mode string 38) +(defcap exit-attribute-mode string 39) +(defcap exit-ca-mode string 40) +(defcap exit-delete-mode string 41) +(defcap exit-insert-mode string 42) +(defcap exit-standout-mode string 43) +(defcap exit-underline-mode string 44) +(defcap flash-screen string 45) +(defcap form-feed string 46) +(defcap from-status-line string 47) +(defcap init-1string string 48) +(defcap init-2string string 49) +(defcap init-3string string 50) +(defcap init-file string 51) +(defcap insert-character string 52) +(defcap insert-line string 53) +(defcap insert-padding string 54) +(defcap key-backspace string 55) +(defcap key-catab string 56) +(defcap key-clear string 57) +(defcap key-ctab string 58) +(defcap key-dc string 59) +(defcap key-dl string 60) +(defcap key-down string 61) +(defcap key-eic string 62) +(defcap key-eol string 63) +(defcap key-eos string 64) +(defcap key-f0 string 65) +(defcap key-f1 string 66) +(defcap key-f10 string 67) +(defcap key-f2 string 68) +(defcap key-f3 string 69) +(defcap key-f4 string 70) +(defcap key-f5 string 71) +(defcap key-f6 string 72) +(defcap key-f7 string 73) +(defcap key-f8 string 74) +(defcap key-f9 string 75) +(defcap key-home string 76) +(defcap key-ic string 77) +(defcap key-il string 78) +(defcap key-left string 79) +(defcap key-ll string 80) +(defcap key-npage string 81) +(defcap key-ppage string 82) +(defcap key-right string 83) +(defcap key-sf string 84) +(defcap key-sr string 85) +(defcap key-stab string 86) +(defcap key-up string 87) +(defcap keypad-local string 88) +(defcap keypad-xmit string 89) +(defcap lab-f0 string 90) +(defcap lab-f1 string 91) +(defcap lab-f10 string 92) +(defcap lab-f2 string 93) +(defcap lab-f3 string 94) +(defcap lab-f4 string 95) +(defcap lab-f5 string 96) +(defcap lab-f6 string 97) +(defcap lab-f7 string 98) +(defcap lab-f8 string 99) +(defcap lab-f9 string 100) +(defcap meta-off string 101) +(defcap meta-on string 102) +(defcap newline string 103) +(defcap pad-char string 104) +(defcap parm-dch string 105) +(defcap parm-delete-line string 106) +(defcap parm-down-cursor string 107) +(defcap parm-ich string 108) +(defcap parm-index string 109) +(defcap parm-insert-line string 110) +(defcap parm-left-cursor string 111) +(defcap parm-right-cursor string 112) +(defcap parm-rindex string 113) +(defcap parm-up-cursor string 114) +(defcap pkey-key string 115) +(defcap pkey-local string 116) +(defcap pkey-xmit string 117) +(defcap print-screen string 118) +(defcap prtr-off string 119) +(defcap prtr-on string 120) +(defcap repeat-char string 121) +(defcap reset-1string string 122) +(defcap reset-2string string 123) +(defcap reset-3string string 124) +(defcap reset-file string 125) +(defcap restore-cursor string 126) +(defcap row-address string 127) +(defcap save-cursor string 128) +(defcap scroll-forward string 129) +(defcap scroll-reverse string 130) +(defcap set-attributes string 131) +(defcap set-tab string 132) +(defcap set-window string 133) +(defcap tab string 134) +(defcap to-status-line string 135) +(defcap underline-char string 136) +(defcap up-half-line string 137) +(defcap init-prog string 138) +(defcap key-a1 string 139) +(defcap key-a3 string 140) +(defcap key-b2 string 141) +(defcap key-c1 string 142) +(defcap key-c3 string 143) +(defcap prtr-non string 144) +(defcap char-padding string 145) +(defcap acs-chars string 146) +(defcap plab-norm string 147) +(defcap key-btab string 148) +(defcap enter-xon-mode string 149) +(defcap exit-xon-mode string 150) +(defcap enter-am-mode string 151) +(defcap exit-am-mode string 152) +(defcap xon-character string 153) +(defcap xoff-character string 154) +(defcap ena-acs string 155) +(defcap label-on string 156) +(defcap label-off string 157) +(defcap key-beg string 158) +(defcap key-cancel string 159) +(defcap key-close string 160) +(defcap key-command string 161) +(defcap key-copy string 162) +(defcap key-create string 163) +(defcap key-end string 164) +(defcap key-enter string 165) +(defcap key-exit string 166) +(defcap key-find string 167) +(defcap key-help string 168) +(defcap key-mark string 169) +(defcap key-message string 170) +(defcap key-move string 171) +(defcap key-next string 172) +(defcap key-open string 173) +(defcap key-options string 174) +(defcap key-previous string 175) +(defcap key-print string 176) +(defcap key-redo string 177) +(defcap key-reference string 178) +(defcap key-refresh string 179) +(defcap key-replace string 180) +(defcap key-restart string 181) +(defcap key-resume string 182) +(defcap key-save string 183) +(defcap key-suspend string 184) +(defcap key-undo string 185) +(defcap key-sbeg string 186) +(defcap key-scancel string 187) +(defcap key-scommand string 188) +(defcap key-scopy string 189) +(defcap key-screate string 190) +(defcap key-sdc string 191) +(defcap key-sdl string 192) +(defcap key-select string 193) +(defcap key-send string 194) +(defcap key-seol string 195) +(defcap key-sexit string 196) +(defcap key-sfind string 197) +(defcap key-shelp string 198) +(defcap key-shome string 199) +(defcap key-sic string 200) +(defcap key-sleft string 201) +(defcap key-smessage string 202) +(defcap key-smove string 203) +(defcap key-snext string 204) +(defcap key-soptions string 205) +(defcap key-sprevious string 206) +(defcap key-sprint string 207) +(defcap key-sredo string 208) +(defcap key-sreplace string 209) +(defcap key-sright string 210) +(defcap key-srsume string 211) +(defcap key-ssave string 212) +(defcap key-ssuspend string 213) +(defcap key-sundo string 214) +(defcap req-for-input string 215) +(defcap key-f11 string 216) +(defcap key-f12 string 217) +(defcap key-f13 string 218) +(defcap key-f14 string 219) +(defcap key-f15 string 220) +(defcap key-f16 string 221) +(defcap key-f17 string 222) +(defcap key-f18 string 223) +(defcap key-f19 string 224) +(defcap key-f20 string 225) +(defcap key-f21 string 226) +(defcap key-f22 string 227) +(defcap key-f23 string 228) +(defcap key-f24 string 229) +(defcap key-f25 string 230) +(defcap key-f26 string 231) +(defcap key-f27 string 232) +(defcap key-f28 string 233) +(defcap key-f29 string 234) +(defcap key-f30 string 235) +(defcap key-f31 string 236) +(defcap key-f32 string 237) +(defcap key-f33 string 238) +(defcap key-f34 string 239) +(defcap key-f35 string 240) +(defcap key-f36 string 241) +(defcap key-f37 string 242) +(defcap key-f38 string 243) +(defcap key-f39 string 244) +(defcap key-f40 string 245) +(defcap key-f41 string 246) +(defcap key-f42 string 247) +(defcap key-f43 string 248) +(defcap key-f44 string 249) +(defcap key-f45 string 250) +(defcap key-f46 string 251) +(defcap key-f47 string 252) +(defcap key-f48 string 253) +(defcap key-f49 string 254) +(defcap key-f50 string 255) +(defcap key-f51 string 256) +(defcap key-f52 string 257) +(defcap key-f53 string 258) +(defcap key-f54 string 259) +(defcap key-f55 string 260) +(defcap key-f56 string 261) +(defcap key-f57 string 262) +(defcap key-f58 string 263) +(defcap key-f59 string 264) +(defcap key-f60 string 265) +(defcap key-f61 string 266) +(defcap key-f62 string 267) +(defcap key-f63 string 268) +(defcap clr-bol string 269) +(defcap clear-margins string 270) +(defcap set-left-margin string 271) +(defcap set-right-margin string 272) +(defcap label-format string 273) +(defcap set-clock string 274) +(defcap display-clock string 275) +(defcap remove-clock string 276) +(defcap create-window string 277) +(defcap goto-window string 278) +(defcap hangup string 279) +(defcap dial-phone string 280) +(defcap quick-dial string 281) +(defcap tone string 282) +(defcap pulse string 283) +(defcap flash-hook string 284) +(defcap fixed-pause string 285) +(defcap wait-tone string 286) +(defcap user0 string 287) +(defcap user1 string 288) +(defcap user2 string 289) +(defcap user3 string 290) +(defcap user4 string 291) +(defcap user5 string 292) +(defcap user6 string 293) +(defcap user7 string 294) +(defcap user8 string 295) +(defcap user9 string 296) +(defcap orig-pair string 297) +(defcap orig-colors string 298) +(defcap initialize-color string 299) +(defcap initialize-pair string 300) +(defcap set-color-pair string 301) +(defcap set-foreground string 302) +(defcap set-background string 303) +(defcap change-char-pitch string 304) +(defcap change-line-pitch string 305) +(defcap change-res-horz string 306) +(defcap change-res-vert string 307) +(defcap define-char string 308) +(defcap enter-doublewide-mode string 309) +(defcap enter-draft-quality string 310) +(defcap enter-italics-mode string 311) +(defcap enter-leftward-mode string 312) +(defcap enter-micro-mode string 313) +(defcap enter-near-letter-quality string 314) +(defcap enter-normal-quality string 315) +(defcap enter-shadow-mode string 316) +(defcap enter-subscript-mode string 317) +(defcap enter-superscript-mode string 318) +(defcap enter-upward-mode string 319) +(defcap exit-doublewide-mode string 320) +(defcap exit-italics-mode string 321) +(defcap exit-leftward-mode string 322) +(defcap exit-micro-mode string 323) +(defcap exit-shadow-mode string 324) +(defcap exit-subscript-mode string 325) +(defcap exit-superscript-mode string 326) +(defcap exit-upward-mode string 327) +(defcap micro-column-address string 328) +(defcap micro-down string 329) +(defcap micro-left string 330) +(defcap micro-right string 331) +(defcap micro-row-address string 332) +(defcap micro-up string 333) +(defcap order-of-pins string 334) +(defcap parm-down-micro string 335) +(defcap parm-left-micro string 336) +(defcap parm-right-micro string 337) +(defcap parm-up-micro string 338) +(defcap select-char-set string 339) +(defcap set-bottom-margin string 340) +(defcap set-bottom-margin-parm string 341) +(defcap set-left-margin-parm string 342) +(defcap set-right-margin-parm string 343) +(defcap set-top-margin string 344) +(defcap set-top-margin-parm string 345) +(defcap start-bit-image string 346) +(defcap start-char-set-def string 347) +(defcap stop-bit-image string 348) +(defcap stop-char-set-def string 349) +(defcap subscript-characters string 350) +(defcap superscript-characters string 351) +(defcap these-cause-cr string 352) +(defcap zero-motion string 353) +(defcap char-set-names string 354) +(defcap key-mouse string 355) +(defcap mouse-info string 356) +(defcap req-mouse-pos string 357) +(defcap get-mouse string 358) +(defcap set-a-foreground string 359) +(defcap set-a-background string 360) +(defcap pkey-plab string 361) +(defcap device-type string 362) +(defcap code-set-init string 363) +(defcap set0-des-seq string 364) +(defcap set1-des-seq string 365) +(defcap set2-des-seq string 366) +(defcap set3-des-seq string 367) +(defcap set-lr-margin string 368) +(defcap set-tb-margin string 369) +(defcap bit-image-repeat string 370) +(defcap bit-image-newline string 371) +(defcap bit-image-carriage-return string 372) +(defcap color-names string 373) +(defcap define-bit-image-region string 374) +(defcap end-bit-image-region string 375) +(defcap set-color-band string 376) +(defcap set-page-length string 377) +(defcap display-pc-char string 378) +(defcap enter-pc-charset-mode string 379) +(defcap exit-pc-charset-mode string 380) +(defcap enter-scancode-mode string 381) +(defcap exit-scancode-mode string 382) +(defcap pc-term-options string 383) +(defcap scancode-escape string 384) +(defcap alt-scancode-esc string 385) +(defcap enter-horizontal-hl-mode string 386) +(defcap enter-left-hl-mode string 387) +(defcap enter-low-hl-mode string 388) +(defcap enter-right-hl-mode string 389) +(defcap enter-top-hl-mode string 390) +(defcap enter-vertical-hl-mode string 391) +(defcap set-a-attributes string 392) +(defcap set-pglen-inch string 393) + +;;#+INTERNAL-CAPS-VISIBLE +(progn + (defcap termcap-init2 string 394) + (defcap termcap-reset string 395) + (defcap magic-cookie-glitch-ul integer 33) + (defcap backspaces-with-bs boolean 37) + (defcap crt-no-scrolling boolean 38) + (defcap no-correctly-working-cr boolean 39) + (defcap carriage-return-delay integer 34) + (defcap new-line-delay integer 35) + (defcap linefeed-if-not-lf string 396) + (defcap backspace-if-not-bs string 397) + (defcap gnu-has-meta-key boolean 40) + (defcap linefeed-is-newline boolean 41) + (defcap backspace-delay integer 36) + (defcap horizontal-tab-delay integer 37) + (defcap number-of-function-keys integer 38) + (defcap other-non-function-keys string 398) + (defcap arrow-key-map string 399) + (defcap has-hardware-tabs boolean 42) + (defcap return-does-clr-eol boolean 43) + (defcap acs-ulcorner string 400) + (defcap acs-llcorner string 401) + (defcap acs-urcorner string 402) + (defcap acs-lrcorner string 403) + (defcap acs-ltee string 404) + (defcap acs-rtee string 405) + (defcap acs-btee string 406) + (defcap acs-ttee string 407) + (defcap acs-hline string 408) + (defcap acs-vline string 409) + (defcap acs-plus string 410) + (defcap memory-lock string 411) + (defcap memory-unlock string 412) + (defcap box-chars-1 string 413)) + + +(defun load-terminfo (name) + (let ((name (concatenate 'string (list (char name 0) #\/) name))) + (dolist (path (list #+CMU "home:.terminfo/" + #+Allegro "~/.terminfo/" + *terminfo-directory*)) + (with-open-file (stream (merge-pathnames name path) + :direction :input + :element-type '(unsigned-byte 8) + :if-does-not-exist nil) + (when stream + (flet ((read-short (stream) + (let ((n (+ (read-byte stream) (* 256 (read-byte stream))))) + (if (> n 32767) + (- n 65536) + n))) + (read-string (stream) + (do ((c (read-byte stream) (read-byte stream)) + (s '())) + ((zerop c) (coerce (nreverse s) 'string)) + (push (code-char c) s)))) + (let* ((magic (read-short stream)) + (sznames (read-short stream)) + (szbooleans (read-short stream)) + (sznumbers (read-short stream)) + (szstrings (read-short stream)) + (szstringtable (read-short stream)) + (names (let ((string (read-string stream))) + (loop for i = 0 then (1+ j) + as j = (position #\| string :start i) + collect (subseq string i j) while j))) + (booleans (make-array szbooleans + :element-type '(or t nil) + :initial-element nil)) + (numbers (make-array sznumbers + :element-type '(signed-byte 16) + :initial-element -1)) + (strings (make-array szstrings + :element-type '(signed-byte 16) + :initial-element -1)) + (stringtable (make-string szstringtable)) + (count 0)) + (unless (= magic #o432) + (error "Invalid file format")) + (dotimes (i szbooleans) + (setf (aref booleans i) (not (zerop (read-byte stream))))) + (when (oddp (+ sznames szbooleans)) + (read-byte stream)) + (dotimes (i sznumbers) + (setf (aref numbers i) (read-short stream))) + (dotimes (i szstrings) + (unless (minusp (setf (aref strings i) (read-short stream))) + (incf count))) + #+CMU + (read-sequence stringtable stream) + #-CMU + (dotimes (i szstringtable) + (setf (char stringtable i) (code-char (read-byte stream)))) + (let ((xtrings (make-array szstrings :initial-element nil))) + (dotimes (i szstrings) + (unless (minusp (aref strings i)) + (setf (aref xtrings i) + (subseq stringtable (aref strings i) + (position #\Null stringtable + :start (aref strings i)))))) + (setq strings xtrings)) + (return (make-terminfo :names names :booleans booleans + :numbers numbers :strings strings))))))))) + +(defun tparm (string &rest args) + (when (null string) (return-from tparm "")) + (with-output-to-string (out) + (with-input-from-string (in string) + (do ((stack '()) (flags 0) (width 0) (precision 0) (number 0) + (dvars (make-array 26 :element-type '(unsigned-byte 8) + :initial-element 0)) + (svars (load-time-value + (make-array 26 :element-type '(unsigned-byte 8) + :initial-element 0))) + (c (read-char in nil) (read-char in nil))) + ((null c)) + (cond ((char= c #\%) + (setq c (read-char in) flags 0 width 0 precision 0) + (tagbody + state0 + (case c + (#\% (princ c out) (go terminal)) + (#\: (setq c (read-char in)) (go state2)) + (#\+ (go state1)) + (#\- (go state1)) + (#\# (go state2)) + (#\Space (go state2)) + ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9) (go state3)) + (#\d (go state5)) + (#\o (go state6)) + ((#\X #\x) (go state7)) + (#\s (go state8)) + (#\c (princ (code-char (pop stack)) out) (go terminal)) + (#\p (go state9)) + (#\P (go state10)) + (#\g (go state11)) + (#\' (go state12)) + (#\{ (go state13)) + (#\l (push (length (pop stack)) stack) (go terminal)) + (#\* (push (* (pop stack) (pop stack)) stack) + (go terminal)) + (#\/ (push (/ (pop stack) (pop stack)) stack) + (go terminal)) + (#\m (push (mod (pop stack) (pop stack)) stack) + (go terminal)) + (#\& (push (logand (pop stack) (pop stack)) stack) + (go terminal)) + (#\| (push (logior (pop stack) (pop stack)) stack) + (go terminal)) + (#\^ (push (logxor (pop stack) (pop stack)) stack) + (go terminal)) + (#\= (push (if (= (pop stack) (pop stack)) 1 0) stack) + (go terminal)) + (#\> (push (if (> (pop stack) (pop stack)) 1 0) stack) + (go terminal)) + (#\< (push (if (< (pop stack) (pop stack)) 1 0) stack) + (go terminal)) + (#\A (push (if (and (pop stack) (pop stack)) 1 0) stack) + (go terminal)) + (#\O (push (if (or (pop stack) (pop stack)) 1 0) stack) + (go terminal)) + (#\! (push (if (zerop (pop stack)) 1 0) stack) + (go terminal)) + (#\~ (push (logand #xFF (lognot (pop stack))) stack) + (go terminal)) + (#\i (when args + (incf (first args)) + (when (cdr args) + (incf (second args)))) + (go terminal)) + (#\? (go state14)) + (otherwise (error "Unknown %-control character: ~C" c))) + state1 + (let ((next (peek-char nil in nil))) + (when (position next "0123456789# +-doXxs") + (go state2))) + (if (char= c #\+) + (push (+ (pop stack) (pop stack)) stack) + (push (- (pop stack) (pop stack)) stack)) + (go terminal) + state2 + (case c + (#\# (setf flags (logior flags 1))) + (#\+ (setf flags (logior flags 2))) + (#\Space (setf flags (logior flags 4))) + (#\- (setf flags (logior flags 8))) + ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9) + (go state3)) + (t (go blah))) + (setf c (read-char in)) + (go state2) + state3 + (setf width (digit-char-p c)) + state3-loop + (setf c (read-char in)) + (case c + ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9) + (setf width (+ (* width 10) (digit-char-p c))) + (go state3-loop)) + (#\. (setf c (read-char in)) (go state4))) + (go blah) + state4 + (setf precision (digit-char-p c)) + state4-loop + (setf c (read-char in)) + (case c + ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9) + (setf precision (+ (* precision 10) (digit-char-p c))) + (go state4-loop))) + (go blah) + blah + (case c + (#\d (go state5)) + (#\o (go state6)) + ((#\X #\x) (go state7)) + (#\s (go state8)) + (otherwise (error "Unknown %-control character: ~C" c))) + state5 + (let ((value (pop stack))) + (format out (if (logbitp 3 flags) + "~@v<~:[~*~;~C~]~v,'0D~>" + "~v<~:[~*~;~C~]~v,'0D~>") + width + (or (minusp value) (logbitp 1 flags) + (logbitp 2 flags)) + (if (minusp value) + #\- + (if (logbitp 1 flags) + #\+ + #\Space)) + precision + (abs value))) + (go terminal) + state6 + (format out (if (logbitp 3 flags) + "~@v<~@[0~*~]~v,'0O~>" + "~v<~@[0~*~]~v,'0O~>") + width (logbitp 0 flags) precision + (pop stack)) + (go terminal) + state7 + (format out (if (logbitp 3 flags) + "~@v<~:[~*~;0~C~]~v,'0X~>" + "~v<~:[~*~;0~C~]~v,'0X~>") + width (logbitp 0 flags) c precision + (pop stack)) + (go terminal) + state8 + (format t "~&;; Width ~D, Precision ~D, flags=#x~X: string" + width precision flags) + (go terminal) + state9 + (let* ((i (digit-char-p (read-char in))) + (a (nth (1- i) args))) + (etypecase a + (character (push (char-code a) stack)) + (integer (push a stack)))) + (go terminal) + state10 + (let ((var (read-char in))) + (cond ((char<= #\a var #\z) + (setf (aref dvars (- (char-code var) + (char-code #\a))) + (pop stack))) + ((char<= #\A var #\Z) + (setf (aref svars (- (char-code var) + (char-code #\A))) + (pop stack))) + (t (error "Illegal variable name: ~C" var)))) + (go terminal) + state11 + (let ((var (read-char in))) + (cond ((char<= #\a var #\z) + (push (aref dvars (- (char-code var) + (char-code #\a))) + stack)) + ((char<= #\A var #\Z) + (push (aref svars (- (char-code var) + (char-code #\A))) + stack)) + (t (error "Illegal variable name: ~C" var)))) + (go terminal) + state12 + (push (char-code (read-char in)) stack) + (unless (char= (read-char in) #\') + (error "Invalid character constant")) + (go terminal) + state13 + (setq number 0) + state13-loop + (setq c (read-char in)) + (let ((n (digit-char-p c))) + (cond (n (setq number (+ (* 10 number) n)) + (go state13-loop)) + ((char= c #\}) + (push number stack) + (go terminal)))) + (error "Invalid integer constant") + state14 + (error "Conditional expression parser not yet written.") + terminal + #| that's all, folks |#)) + (t (princ c out))))))) + +(defun tputs (string &rest args) + (when string + (princ (apply #'tparm string args) *terminal-io*) + t)) + +(defun set-terminal (&optional name) + (setf *terminfo* (load-terminfo (or name + #+CMU + (cdr (assoc "TERM" ext:*environment-list* + :test #'string=)) + #+Allegro + (sys:getenv "TERM") + #+SBCL + (sb-ext:posix-getenv "TERM") + #| if all else fails |# + "dumb")))) + +(if (null *terminfo*) + (set-terminal)) + +(provide :terminfo) Index: src/Makefile diff -u src/Makefile:1.15 src/Makefile:1.16 --- src/Makefile:1.15 Mon Sep 29 14:06:13 2003 +++ src/Makefile Mon Oct 20 03:49:24 2003 @@ -76,3 +76,17 @@ public_html: $(RSYNC_HTML) && $(HTML_PERMS) + +TI_VERSION=1.0 +TI=terminfo_$(TI_VERSION) +TI_LINK=terminfo_latest.tar.gz + +terminfo: + mkdir -p $(TI) + cp terminfo.lisp terminfo.asd $(TI)/ + tar -czvf $(TI).tar.gz $(TI) + gpg -b -a $(TI).tar.gz + rm -rf $(TI) + ln -s $(TI).tar.gz.asc $(TI_LINK).asc + ln -s $(TI).tar.gz $(TI_LINK) + mv $(TI).tar.gz $(TI).tar.gz.asc $(TI_LINK) $(TI_LINK).asc $(HTML)/files/ From nsiivola at common-lisp.net Mon Oct 20 12:28:57 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 08:28:57 -0400 Subject: [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 Message-ID: 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 From nsiivola at common-lisp.net Mon Oct 20 12:30:06 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 08:30:06 -0400 Subject: [Linedit-cvs] CVS update: src/release.txt Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv9478 Modified Files: release.txt Log Message: cleanup Date: Mon Oct 20 08:30:04 2003 Author: nsiivola Index: src/release.txt diff -u src/release.txt:1.2 src/release.txt:1.3 --- src/release.txt:1.2 Sun Sep 28 07:37:43 2003 +++ src/release.txt Mon Oct 20 08:30:03 2003 @@ -1,5 +1,4 @@ LICENSE *.lisp *.c -*.h *.asd From nsiivola at common-lisp.net Mon Oct 20 15:34:04 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 11:34:04 -0400 Subject: [Linedit-cvs] CVS update: src/rewindable.lisp src/command-functions.lisp src/dumb-terminal.lisp src/editor.lisp src/line.lisp src/linedit.asd src/main.lisp src/sbcl-repl.lisp src/smart-terminal.lisp src/terminal.lisp src/version.txt src/pool.lisp Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv31798 Modified Files: command-functions.lisp dumb-terminal.lisp editor.lisp line.lisp linedit.asd main.lisp sbcl-repl.lisp smart-terminal.lisp terminal.lisp version.txt Added Files: rewindable.lisp Removed Files: pool.lisp Log Message: - Fixed killring so that it retains state between invocations. - Refactored internals. Date: Mon Oct 20 11:34:03 2003 Author: nsiivola Index: src/command-functions.lisp diff -u src/command-functions.lisp:1.5 src/command-functions.lisp:1.6 --- src/command-functions.lisp:1.5 Mon Oct 20 08:28:56 2003 +++ src/command-functions.lisp Mon Oct 20 11:34:02 2003 @@ -31,29 +31,28 @@ (defun add-char (char editor) (with-editor-point-and-string ((point string) editor) - (setf (editor-string editor) - (concat (subseq string 0 point) - (string char) - (subseq string point))) - (incf (editor-point editor)))) + (setf (get-string editor) (concat (subseq string 0 point) + (string char) + (subseq string point))) + (incf (get-point editor)))) (defun delete-char-backwards (chord editor) (declare (ignore chord)) (with-editor-point-and-string ((point string) editor) ;; Can't delegate to editor because of the SUBSEQ index calc. (unless (zerop point) - (setf (editor-string editor) - (concat (subseq string 0 (1- point)) (subseq string point)) - (editor-point editor) (1- point))))) + (setf (get-string editor) (concat (subseq string 0 (1- point)) + (subseq string point)) + (get-point editor) (1- point))))) (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)))))) + (setf (get-string editor) (concat (subseq string 0 point) + (subseq string (1+ point)))))) (defun delete-char-forwards-or-eof (chord editor) - (if (equal "" (editor-string editor)) + (if (equal "" (get-string editor)) (error 'end-of-file :stream *standard-input*) (delete-char-forwards chord editor))) @@ -61,9 +60,9 @@ (declare (ignore chord)) (with-editor-point-and-string ((point string) editor) (let ((i (editor-word-start editor))) - (setf (editor-string editor) - (concat (subseq string 0 i) (subseq string point)) - (editor-point editor) i)))) + (setf (get-string editor) (concat (subseq string 0 i) + (subseq string point)) + (get-point editor) i)))) (defun finish-input (chord editor) (declare (ignore chord editor)) @@ -73,47 +72,47 @@ (defun move-to-bol (chord editor) (declare (ignore chord)) - (setf (editor-point editor) 0)) + (setf (get-point editor) 0)) (defun move-to-eol (chord editor) (declare (ignore chord)) - (setf (editor-point editor) (length (editor-string editor)))) + (setf (get-point editor) (length (get-string editor)))) (defun move-char-right (chord editor) (declare (ignore chord)) - (incf (editor-point editor))) + (incf (get-point editor))) (defun move-char-left (chord editor) (declare (ignore chord)) - (decf (editor-point editor))) + (decf (get-point editor))) (defun move-word-backwards (chord editor) (declare (ignore chord)) - (setf (editor-point editor) (editor-word-start editor))) + (setf (get-point editor) (editor-word-start editor))) (defun move-word-forwards (chord editor) (declare (ignore chord)) - (setf (editor-point editor) (editor-word-end editor))) + (setf (get-point editor) (editor-word-end editor))) ;;; UNDO (defun undo (chord editor) (declare (ignore chord)) - (setf (editor-line editor) (copy (rewind (undo-pool editor)))) + (rewind-state editor) (throw 'linedit-loop t)) ;;; HISTORY (defun history-previous (chord editor) (declare (ignore chord)) - (aif (buffer-previous (editor-string editor) (editor-history editor)) - (setf (editor-string editor) it) + (aif (buffer-previous (get-string editor) (editor-history editor)) + (setf (get-string editor) it) (beep editor))) (defun history-next (chord editor) (declare (ignore chord)) - (aif (buffer-next (editor-string editor) (editor-history editor)) - (setf (editor-string editor) it) + (aif (buffer-next (get-string editor) (editor-history editor)) + (setf (get-string editor) it) (beep editor))) ;;; KILLING & YANKING @@ -121,11 +120,11 @@ (defun %yank (editor) (aif (buffer-peek (editor-killring editor)) (with-editor-point-and-string ((point string) editor) - (setf (editor-string editor) + (setf (get-string editor) (concat (subseq string 0 (editor-yank editor)) it (subseq string point)) - (editor-point editor) (+ (editor-yank editor) (length it)))) + (get-point editor) (+ (editor-yank editor) (length it)))) (beep editor))) (defun yank (chord editor) @@ -145,15 +144,15 @@ (declare (ignore chord)) (with-editor-point-and-string ((point string) editor) (buffer-push (subseq string point) (editor-killring editor)) - (setf (editor-string editor) (subseq string 0 point)))) + (setf (get-string editor) (subseq string 0 point)))) (defun kill-to-bol (chord editor) ;; Thanks to Andreas Fuchs (declare (ignore chord)) (with-editor-point-and-string ((point string) editor) (buffer-push (subseq string 0 point) (editor-killring editor)) - (setf (editor-string editor) (subseq string point) - (editor-point editor) 0))) + (setf (get-string editor) (subseq string point) + (get-point editor) 0))) (defun copy-region (chord editor) (declare (ignore chord)) @@ -171,15 +170,15 @@ (let ((start (min it point)) (end (max it point))) (copy-region t editor) - (setf (editor-string editor) - (concat (subseq string 0 start) (subseq string end)) - (editor-point editor) start))))) + (setf (get-string editor) (concat (subseq string 0 start) + (subseq string end)) + (get-point editor) start))))) (defun set-mark (chord editor) (declare (ignore chord)) ;; FIXME: this was (setf mark (unless mark point)) -- modulo correct ;; accessors. Why? Was I not thinking, or am I not thinking now? - (setf (editor-mark editor) (editor-point editor))) + (setf (editor-mark editor) (get-point editor))) ;;; SIGNALS @@ -216,9 +215,9 @@ :width (+ max-id max-f 2)))) (defun unknown-command (chord editor) - (format *error-output* - "~&Unknown command ~S.~%" - chord)) + (newline editor) + (format *standard-output* "Unknown command ~S." chord) + (newline editor)) (defun complete (chord editor) (declare (ignore chord)) Index: src/dumb-terminal.lisp diff -u src/dumb-terminal.lisp:1.5 src/dumb-terminal.lisp:1.6 --- src/dumb-terminal.lisp:1.5 Sun Oct 19 19:38:23 2003 +++ src/dumb-terminal.lisp Mon Oct 20 11:34:03 2003 @@ -30,7 +30,7 @@ (backend-columns backend)) (defmethod display ((backend dumb-terminal) prompt line) - (let ((string (line-string line))) + (let ((string (get-string line))) (flet ((write-prompt () (write-char #\Return) (write-string prompt))) @@ -41,5 +41,6 @@ (length string)) do (write-char #\Space)) (write-prompt) - (write-string (subseq string 0 (line-point line))) + (write-string (subseq string 0 (get-point line))) (force-output)))) + Index: src/editor.lisp diff -u src/editor.lisp:1.5 src/editor.lisp:1.6 --- src/editor.lisp:1.5 Sun Oct 19 19:47:21 2003 +++ src/editor.lisp Mon Oct 20 11:34:03 2003 @@ -22,16 +22,10 @@ (in-package :linedit) (defvar *history* nil) +(defvar *killring* nil) -(defclass editor () - ((undo-pool :reader undo-pool :initform (make-instance 'pool)) - (line :reader editor-line :initform (make-instance 'line)) - (backend :reader editor-backend - :initform (if (smart-terminal-p) - (make-instance 'smart-terminal) - (make-instance 'dumb-terminal)) - :initarg :backend) - (commands :reader editor-commands +(defclass editor (line rewindable) + ((commands :reader editor-commands :initform *commands* :initarg :commands) (completer :reader editor-completer @@ -41,7 +35,7 @@ :initform (or *history* (setf *history* (make-instance 'buffer))) :initarg :history) (killring :reader editor-killring - :initform (make-instance 'buffer) + :initform (or *killring* (setf *killring* (make-instance 'buffer))) :initarg :killring) (insert :reader editor-insert-mode :initform t @@ -56,75 +50,80 @@ :initform "" :initarg :prompt))) -(defun save-line-for-undo (editor) - (let ((pool (undo-pool editor)) - (line (editor-line editor))) - (unless (equal? line (last-insert pool)) - ;; Save only if different than last saved state. - (insert (copy line) pool)))) +(defmethod initialize-instance :after ((editor editor) &rest initargs) + (save-state editor)) + +(defclass smart-editor (editor smart-terminal) ()) +(defclass dumb-editor (editor dumb-terminal) ()) + +(defun make-editor (&rest args) + (apply 'make-instance + (if (smart-terminal-p) + 'smart-editor + 'dumb-editor) + args)) + +;;; undo + +(defun save-state (editor) + (let ((string (get-string editor)) + (last (last-state editor))) + (unless (and last (equal string (get-string last))) + ;; Save only if different than last saved state + (save-rewindable-state editor (make-instance 'line + :string (copy-seq string) + :point (get-point editor)))))) + +(defmethod rewind-state ((editor editor)) + (let ((line (call-next-method))) + (setf (get-string editor) (copy-seq (get-string line)) + (get-point editor) (get-point line)))) (defvar *debug-info* nil) (defun next-chord (editor) - (display (editor-backend editor) - (editor-prompt editor) - (editor-line editor)) + (display editor (editor-prompt editor) editor) ; Hmm... ick? (forget-yank editor) - (let* ((chord (read-chord (editor-backend editor))) + (let* ((chord (read-chord editor)) (command (gethash chord (editor-commands editor) (if (characterp chord) 'add-char 'unknown-command)))) (setf *debug-info* (list command chord editor)) (funcall command chord editor)) - (save-line-for-undo editor)) - -(defun editor-string (editor) - (line-string (editor-line editor))) + (save-state editor)) -(defun (setf editor-string) (string editor) - (let ((limit (line-length-limit (editor-backend editor)))) +(defmethod (setf get-string) (string editor) + (let ((limit (line-length-limit editor))) (if (and limit (>= (length string) limit)) (progn (beep editor) (throw 'linedit-loop t)) - (setf (line-string (editor-line editor)) string)))) - -(defun (setf editor-line) (line editor) - (setf (slot-value editor 'line) line)) - -(defun editor-point (editor) - (line-point (editor-line editor))) - -(defun (setf editor-point) (point editor) - (setf (line-point (editor-line editor)) point)) + (call-next-method)))) (defun get-finished-string (editor) - (buffer-push (editor-string editor) (editor-history editor)) - (newline (editor-backend editor)) - (editor-string editor)) + (buffer-push (get-string editor) (editor-history editor)) + (newline editor) + (get-string editor)) (defmacro with-editor-point-and-string (((point string) editor) &body forms) - `(let ((,point (editor-point ,editor)) - (,string (editor-string ,editor))) + `(let ((,point (get-point ,editor)) + (,string (get-string ,editor))) , at forms)) -(defmethod beep ((editor editor)) - (beep (editor-backend editor))) - (uffi:def-function ("linedit_interrupt" c-interrupt) () :returning :void) (defun editor-interrupt (editor) - (without-backend (editor-backend editor) (c-interrupt))) + (without-backend editor (c-interrupt))) (uffi:def-function ("linedit_stop" c-stop) () :returning :void) (defun editor-stop (editor) - (without-backend (editor-backend editor) (c-stop))) + (without-backend editor (c-stop))) (defun editor-word-start (editor) (with-editor-point-and-string ((point string) editor) @@ -159,13 +158,13 @@ (defun editor-word (editor) (let ((start (editor-word-start editor)) (end (editor-word-end editor))) - (subseq (editor-string editor) start end))) + (subseq (get-string editor) start end))) (defun editor-complete (editor) (funcall (editor-completer editor) (editor-word editor) editor)) (defun remember-yank (editor) - (setf (editor-yank editor) (editor-point editor))) + (setf (editor-yank editor) (get-point editor))) (defun forget-yank (editor) (shiftf (editor-last-yank editor) (editor-yank editor) nil)) @@ -178,16 +177,10 @@ (with-editor-point-and-string ((point string) editor) (let ((start (editor-word-start editor)) (end (editor-word-end editor))) - (setf (editor-string editor) + (setf (get-string editor) (concat (subseq string 0 start) word (subseq string end)) - (editor-point editor) (+ start (length word)))))) - -(defmethod print-in-columns ((editor editor) list &key width) - (print-in-columns (editor-backend editor) list :width width)) - -(defmethod print-in-lines ((editor editor) string) - (print-in-lines (editor-backend editor) string)) + (get-point editor) (+ start (length word)))))) (defun in-quoted-string-p (editor) (let ((i (editor-word-start editor))) - (and (plusp i) (eql #\" (schar (editor-string editor) (1- i)))))) + (and (plusp i) (eql #\" (schar (get-string editor) (1- i)))))) Index: src/line.lisp diff -u src/line.lisp:1.2 src/line.lisp:1.3 --- src/line.lisp:1.2 Sun Sep 28 07:37:43 2003 +++ src/line.lisp Mon Oct 20 11:34:03 2003 @@ -22,20 +22,9 @@ (in-package :linedit) (defclass line () - ((string :accessor line-string :initform "" :initarg :string) - (point :reader line-point :initform 0 :initarg :point))) + ((string :accessor get-string :initform "" :initarg :string) + (point :accessor get-point :initform 0 :initarg :point))) -(defun (setf line-point) (point line) - (when (<= 0 point (length (line-string line))) - (setf (slot-value line 'point) point))) - -(defmethod equal? ((a line) (b null)) - nil) - -(defmethod equal? ((a line) (b line)) - (equal (line-string a) (line-string b))) - -(defmethod copy ((line line)) - (make-instance 'line - :string (copy-seq (line-string line)) - :point (line-point line))) +(defmethod (setf get-point) :around (point line) + (when (<= 0 point (length (get-string line))) + (call-next-method))) Index: src/linedit.asd diff -u src/linedit.asd:1.19 src/linedit.asd:1.20 --- src/linedit.asd:1.19 Mon Oct 20 08:28:56 2003 +++ src/linedit.asd Mon Oct 20 11:34:03 2003 @@ -48,6 +48,7 @@ (error 'operation-error :component c :operation o))) (defsystem :linedit + :version "0.14.2" :depends-on (:uffi :terminfo) :components (;; Common @@ -64,12 +65,13 @@ (:file "dumb-terminal" :depends-on ("terminal")) ;; Editor - (:file "pool" :depends-on ("utility-macros")) + (:file "rewindable" :depends-on ("utility-macros")) (:file "line" :depends-on ("utility-macros")) (:file "buffer" :depends-on ("utility-macros")) (:file "command-keys" :depends-on ("packages")) (:c-source-file "signals") - (:file "editor" :depends-on ("backend" "pool" "signals" "line" "buffer" "command-keys")) + (:file "editor" :depends-on ("backend" "rewindable" "signals" + "line" "buffer" "command-keys")) (:file "main" :depends-on ("editor")) (:file "complete" :depends-on ("utility-macros")) (:file "command-functions" :depends-on ("editor")) Index: src/main.lisp diff -u src/main.lisp:1.5 src/main.lisp:1.6 --- src/main.lisp:1.5 Mon Sep 29 14:25:20 2003 +++ src/main.lisp Mon Oct 20 11:34:03 2003 @@ -22,9 +22,8 @@ (in-package :linedit) (defun linedit (&rest keyword-args) - (let* ((editor (apply 'make-instance 'editor keyword-args)) - (backend (editor-backend editor))) - (with-backend backend + (let ((editor (apply 'make-editor keyword-args))) + (with-backend editor (catch 'linedit-done (loop (catch 'linedit-loop Index: src/sbcl-repl.lisp diff -u src/sbcl-repl.lisp:1.2 src/sbcl-repl.lisp:1.3 --- src/sbcl-repl.lisp:1.2 Sun Sep 28 07:37:43 2003 +++ src/sbcl-repl.lisp Mon Oct 20 11:34:03 2003 @@ -46,7 +46,9 @@ (lambda (in out) (declare (type stream out in)) (with-input-from-string (in (repl-reader in out)) - (terpri) + ;; FIXME: Youch. + (write-char #\newline) + (write-char #\return) (funcall read-form-fun in out))) (lambda (in out) (declare (type stream out in)) Index: src/smart-terminal.lisp diff -u src/smart-terminal.lisp:1.2 src/smart-terminal.lisp:1.3 --- src/smart-terminal.lisp:1.2 Sun Oct 19 19:47:21 2003 +++ src/smart-terminal.lisp Mon Oct 20 11:34:03 2003 @@ -38,7 +38,7 @@ (ceiling (1+ n) columns)) (find-col (n) (rem n columns))) - (let* ((new (concat prompt (line-string line))) + (let* ((new (concat prompt (get-string line))) (old (active-string backend)) (end (length new)) (rows (find-row end)) @@ -55,7 +55,7 @@ (when (and (< start end) (zerop (find-col end))) (ti:tputs ti:cursor-down)) ;; Place point - (let* ((point (+ (length prompt) (line-point line))) + (let* ((point (+ (length prompt) (get-point line))) (point-row (find-row point)) (point-col (find-col point))) (loop repeat (- rows point-row) @@ -65,3 +65,4 @@ (setf (point-row backend) point-row (active-string backend) new)))) (force-output *terminal-io*))) + Index: src/terminal.lisp diff -u src/terminal.lisp:1.2 src/terminal.lisp:1.3 --- src/terminal.lisp:1.2 Mon Oct 20 08:28:56 2003 +++ src/terminal.lisp Mon Oct 20 11:34:03 2003 @@ -125,7 +125,7 @@ (newline backend))) (defmethod print-in-lines ((backend terminal) string) - (terpri) + (newline backend) (do ((i 0 (1+ i)) (lines 0)) ((= i (length string))) @@ -137,8 +137,9 @@ (when (eql #\newline c) (incf lines)) (write-char c))) - (terpri)) + (newline backend)) (defmethod newline ((backend terminal)) (write-char #\newline) - (write-char #\return)) + (write-char #\return) + (force-output)) Index: src/version.txt diff -u src/version.txt:1.6 src/version.txt:1.7 --- src/version.txt:1.6 Mon Oct 20 08:28:56 2003 +++ src/version.txt Mon Oct 20 11:34:03 2003 @@ -1 +1 @@ -0.14.1 +0.14.2 From nsiivola at common-lisp.net Mon Oct 20 16:25:42 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 12:25:42 -0400 Subject: [Linedit-cvs] CVS update: src/release.txt Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv2646 Modified Files: release.txt Log Message: explicit list Date: Mon Oct 20 12:25:42 2003 Author: nsiivola Index: src/release.txt diff -u src/release.txt:1.3 src/release.txt:1.4 --- src/release.txt:1.3 Mon Oct 20 08:30:03 2003 +++ src/release.txt Mon Oct 20 12:25:42 2003 @@ -1,4 +1,21 @@ LICENSE -*.lisp -*.c -*.asd +linedit.asd +backend.lisp +buffer.lisp +command-functions.lisp +command-keys.lisp +complete.lisp +dumb-terminal.lisp +editor.lisp +line.lisp +main.lisp +packages.lisp +rewindable.lisp +sbcl-repl.lisp +smart-terminal.lisp +terminal-translations.lisp +terminal.lisp +utility-functions.lisp +utility-macros.lisp +signals.c +terminal_glue.c From nsiivola at common-lisp.net Mon Oct 20 17:49:05 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 13:49:05 -0400 Subject: [Linedit-cvs] CVS update: src/command-keys.lisp src/main.lisp src/terminal.lisp Message-ID: 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) From nsiivola at common-lisp.net Mon Oct 20 18:14:32 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 14:14:32 -0400 Subject: [Linedit-cvs] CVS update: src/command-functions.lisp src/command-keys.lisp Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv5598 Modified Files: command-functions.lisp command-keys.lisp Log Message: Change describe-word to M-I, bind M-U and M-D to upcase-word and downcase-word. Date: Mon Oct 20 14:14:32 2003 Author: nsiivola Index: src/command-functions.lisp diff -u src/command-functions.lisp:1.6 src/command-functions.lisp:1.7 --- src/command-functions.lisp:1.6 Mon Oct 20 11:34:02 2003 +++ src/command-functions.lisp Mon Oct 20 14:14:31 2003 @@ -68,6 +68,24 @@ (declare (ignore chord editor)) (throw 'linedit-done t)) +;;; CASE CHANGES + +(flet ((frob-case (frob editor) + (with-editor-point-and-string ((point string) editor) + (let ((end (editor-word-end editor))) + (setf (get-string editor) (concat (subseq string 0 point) + (funcall frob (subseq string point end)) + (subseq string end)) + (get-point editor) end))))) + + (defun upcase-word (chord editor) + (declare (ignore chord)) + (funcall #'frob-case #'string-upcase editor)) + + (defun downcase-word (chord editor) + (declare (ignore chord)) + (funcall #'frob-case #'string-downcase editor))) + ;;; MOVEMENT (defun move-to-bol (chord editor) Index: src/command-keys.lisp diff -u src/command-keys.lisp:1.5 src/command-keys.lisp:1.6 --- src/command-keys.lisp:1.5 Mon Oct 20 13:49:05 2003 +++ src/command-keys.lisp Mon Oct 20 14:14:31 2003 @@ -55,12 +55,12 @@ (defcommand "M-A" 'apropos-word) (defcommand "M-B" 'move-word-backwards) (defcommand "M-C") -(defcommand "M-D" 'describe-word) +(defcommand "M-D" 'downcase-word) (defcommand "M-E") (defcommand "M-F" 'move-word-forwards) (defcommand "M-G") (defcommand "M-H" 'help) -(defcommand "M-I") +(defcommand "M-I" 'describe-word) (defcommand "M-J") (defcommand "M-K") (defcommand "M-L") @@ -72,7 +72,7 @@ (defcommand "M-R") (defcommand "M-S") (defcommand "M-T") -(defcommand "M-U") +(defcommand "M-U" 'upcase-word) (defcommand "M-V") (defcommand "M-W" 'copy-region) (defcommand "M-X") From nsiivola at common-lisp.net Mon Oct 20 18:20:53 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Mon, 20 Oct 2003 14:20:53 -0400 Subject: [Linedit-cvs] CVS update: src/terminal-translations.lisp Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv9297 Modified Files: terminal-translations.lisp Log Message: Use same translation for newline and return. Date: Mon Oct 20 14:20:53 2003 Author: nsiivola Index: src/terminal-translations.lisp diff -u src/terminal-translations.lisp:1.2 src/terminal-translations.lisp:1.3 --- src/terminal-translations.lisp:1.2 Mon Oct 20 08:28:56 2003 +++ src/terminal-translations.lisp Mon Oct 20 14:20:53 2003 @@ -39,10 +39,9 @@ (deftrans "C-G" 7) (deftrans "C-Backspace" 8) (deftrans "Tab" 9) -(deftrans "C-J" 10) (deftrans "C-K" 11) (deftrans "C-L" 12) -(deftrans "Return" 13) +(deftrans "Return" 10 13) ;; Newline and return (deftrans "C-N" 14) (deftrans "C-O" 15) (deftrans "C-P" 16) From nsiivola at common-lisp.net Thu Oct 23 15:07:10 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Thu, 23 Oct 2003 11:07:10 -0400 Subject: [Linedit-cvs] CVS update: src/backend.lisp src/dumb-terminal.lisp src/editor.lisp src/linedit.asd src/smart-terminal.lisp src/terminal.lisp src/terminal_glue.c src/utility-functions.lisp src/version.txt Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv2978 Modified Files: backend.lisp dumb-terminal.lisp editor.lisp linedit.asd smart-terminal.lisp terminal.lisp terminal_glue.c utility-functions.lisp version.txt Log Message: * Smarter dumb-terminal: scroll horizontally. * Added info-string for development time (makes used version and mode visible) * Nicer interface for DISPLAY * Robuster smart terminal. Date: Thu Oct 23 11:07:09 2003 Author: nsiivola Index: src/backend.lisp diff -u src/backend.lisp:1.1 src/backend.lisp:1.2 --- src/backend.lisp:1.1 Sun Oct 19 19:38:23 2003 +++ src/backend.lisp Thu Oct 23 11:07:08 2003 @@ -47,6 +47,3 @@ (backend-close ,backend) , at forms) (backend-init ,backend))) - -(defmethod line-length-limit ((backend backend)) - nil) Index: src/dumb-terminal.lisp diff -u src/dumb-terminal.lisp:1.6 src/dumb-terminal.lisp:1.7 --- src/dumb-terminal.lisp:1.6 Mon Oct 20 11:34:03 2003 +++ src/dumb-terminal.lisp Thu Oct 23 11:07:08 2003 @@ -26,21 +26,20 @@ (defclass dumb-terminal (terminal) ()) -(defmethod line-length-limit ((backend dumb-terminal)) - (backend-columns backend)) - -(defmethod display ((backend dumb-terminal) prompt line) - (let ((string (get-string line))) - (flet ((write-prompt () - (write-char #\Return) - (write-string prompt))) - (write-prompt) - (write-string string) - (loop repeat (- (backend-columns backend) - (length prompt) - (length string)) - do (write-char #\Space)) - (write-prompt) - (write-string (subseq string 0 (get-point line))) - (force-output)))) - +(defmethod display ((backend dumb-terminal) prompt line point) + (let* ((string (concat prompt line)) + (length (length string)) + (point (+ point (length prompt))) + (columns (backend-columns backend))) + (write-char #\return) + (cond ((< (1+ point) columns) + (write-string (subseq string 0 (min length columns))) + (when (< length columns) + (write-string (make-whitespace (- columns length)))) + (write-char #\return) + (write-string (subseq string 0 point))) + (t + (write-string (subseq string (- (1+ point) columns) point)) + (write-char #\return) + (write-string (subseq string (- (1+ point) columns) point))))) + (force-output)) Index: src/editor.lisp diff -u src/editor.lisp:1.6 src/editor.lisp:1.7 --- src/editor.lisp:1.6 Mon Oct 20 11:34:03 2003 +++ src/editor.lisp Thu Oct 23 11:07:08 2003 @@ -21,6 +21,7 @@ (in-package :linedit) +(defvar *version* "0.14.4") (defvar *history* nil) (defvar *killring* nil) @@ -56,12 +57,17 @@ (defclass smart-editor (editor smart-terminal) ()) (defclass dumb-editor (editor dumb-terminal) ()) -(defun make-editor (&rest args) - (apply 'make-instance - (if (smart-terminal-p) - 'smart-editor - 'dumb-editor) - args)) +(let ((ann nil)) + (defun make-editor (&rest args) + (let ((type (if (smart-terminal-p) + 'smart-editor + 'dumb-editor))) + (unless ann + (format t "~&Linedit version ~A [~A mode]~%" *version* (if (eq 'smart-editor type) + "smart" + "dumb"))) + (setf ann t) + (apply 'make-instance type args)))) ;;; undo @@ -82,7 +88,7 @@ (defvar *debug-info* nil) (defun next-chord (editor) - (display editor (editor-prompt editor) editor) ; Hmm... ick? + (display editor (editor-prompt editor) (get-string editor) (get-point editor)) (forget-yank editor) (let* ((chord (read-chord editor)) (command (gethash chord (editor-commands editor) @@ -92,14 +98,6 @@ (setf *debug-info* (list command chord editor)) (funcall command chord editor)) (save-state editor)) - -(defmethod (setf get-string) (string editor) - (let ((limit (line-length-limit editor))) - (if (and limit (>= (length string) limit)) - (progn - (beep editor) - (throw 'linedit-loop t)) - (call-next-method)))) (defun get-finished-string (editor) (buffer-push (get-string editor) (editor-history editor)) Index: src/linedit.asd diff -u src/linedit.asd:1.20 src/linedit.asd:1.21 --- src/linedit.asd:1.20 Mon Oct 20 11:34:03 2003 +++ src/linedit.asd Thu Oct 23 11:07:08 2003 @@ -48,7 +48,7 @@ (error 'operation-error :component c :operation o))) (defsystem :linedit - :version "0.14.2" + :version "0.14.4" :depends-on (:uffi :terminfo) :components (;; Common Index: src/smart-terminal.lisp diff -u src/smart-terminal.lisp:1.3 src/smart-terminal.lisp:1.4 --- src/smart-terminal.lisp:1.3 Mon Oct 20 11:34:03 2003 +++ src/smart-terminal.lisp Thu Oct 23 11:07:08 2003 @@ -27,10 +27,14 @@ (defun smart-terminal-p () (every (lambda (key) - (ti:capability key)) - '(:cursor-up :cursor-down :clr-eos :column-address))) + (ti:capability key)) '(:cursor-up :cursor-down :clr-eos + :column-address :auto-right-margin))) -(defmethod display ((backend smart-terminal) prompt line) +(defmethod backend-init ((backend smart-terminal)) + (call-next-method) + (ti:tputs ti:enter-am-mode)) + +(defmethod display ((backend smart-terminal) prompt line point) (let ((*terminal-io* *standard-output*) (columns (backend-columns backend))) (flet ((find-row (n) @@ -38,7 +42,7 @@ (ceiling (1+ n) columns)) (find-col (n) (rem n columns))) - (let* ((new (concat prompt (get-string line))) + (let* ((new (concat prompt line)) (old (active-string backend)) (end (length new)) (rows (find-row end)) @@ -55,7 +59,7 @@ (when (and (< start end) (zerop (find-col end))) (ti:tputs ti:cursor-down)) ;; Place point - (let* ((point (+ (length prompt) (get-point line))) + (let* ((point (+ (length prompt) point)) (point-row (find-row point)) (point-col (find-col point))) (loop repeat (- rows point-row) Index: src/terminal.lisp diff -u src/terminal.lisp:1.4 src/terminal.lisp:1.5 --- src/terminal.lisp:1.4 Mon Oct 20 13:49:05 2003 +++ src/terminal.lisp Thu Oct 23 11:07:08 2003 @@ -56,6 +56,8 @@ (invariant (zerop (c-terminal-close))) (setf (backend-ready-p backend) nil)) +;;; FIXME: Use read-char-no-hang to detect pastes, and set an +;;; apropriate flag, or something. (defmethod read-chord ((backend terminal)) (invariant (backend-ready-p backend)) (flet ((read-open-chord () @@ -96,6 +98,7 @@ (write-char #\Return) (not (equal #\q q)))) +;;; FIXME: Explicit line-wrap needed (defmethod print-in-columns ((backend terminal) list &key width) (let ((max-col (truncate (backend-columns backend) width)) (col 0) Index: src/terminal_glue.c diff -u src/terminal_glue.c:1.2 src/terminal_glue.c:1.3 --- src/terminal_glue.c:1.2 Mon Oct 20 08:28:56 2003 +++ src/terminal_glue.c Thu Oct 23 11:07:08 2003 @@ -68,7 +68,7 @@ return linedit_OK; } - + int linedit_terminal_close (void) { Index: src/utility-functions.lisp diff -u src/utility-functions.lisp:1.2 src/utility-functions.lisp:1.3 --- src/utility-functions.lisp:1.2 Sun Sep 28 07:37:43 2003 +++ src/utility-functions.lisp Thu Oct 23 11:07:08 2003 @@ -34,3 +34,7 @@ (declare (string *word-delimiters*) (character char)) (find char *word-delimiters*)) + +(defun make-whitespace (n) + (make-string n :initial-element #\space)) + Index: src/version.txt diff -u src/version.txt:1.7 src/version.txt:1.8 --- src/version.txt:1.7 Mon Oct 20 11:34:03 2003 +++ src/version.txt Thu Oct 23 11:07:08 2003 @@ -1 +1 @@ -0.14.2 +0.14.4 From nsiivola at common-lisp.net Fri Oct 24 13:13:00 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Fri, 24 Oct 2003 09:13:00 -0400 Subject: [Linedit-cvs] CVS update: src/smart-terminal.lisp src/terminal_glue.c Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv31359 Modified Files: smart-terminal.lisp terminal_glue.c Log Message: Fixed termios flags. Date: Fri Oct 24 09:13:00 2003 Author: nsiivola Index: src/smart-terminal.lisp diff -u src/smart-terminal.lisp:1.4 src/smart-terminal.lisp:1.5 --- src/smart-terminal.lisp:1.4 Thu Oct 23 11:07:08 2003 +++ src/smart-terminal.lisp Fri Oct 24 09:13:00 2003 @@ -29,7 +29,6 @@ (every (lambda (key) (ti:capability key)) '(:cursor-up :cursor-down :clr-eos :column-address :auto-right-margin))) - (defmethod backend-init ((backend smart-terminal)) (call-next-method) (ti:tputs ti:enter-am-mode)) Index: src/terminal_glue.c diff -u src/terminal_glue.c:1.3 src/terminal_glue.c:1.4 --- src/terminal_glue.c:1.3 Thu Oct 23 11:07:08 2003 +++ src/terminal_glue.c Fri Oct 24 09:13:00 2003 @@ -61,7 +61,7 @@ return linedit_TCGETATTR_ERROR; cfmakeraw (&tmp); - tmp.c_lflag &= ~ECHO; + tmp.c_oflag |= OPOST; if (0 > tcsetattr (STDIN_FILENO, TCSAFLUSH, &tmp)) return linedit_TCSETATTR_ERROR; From nsiivola at common-lisp.net Tue Oct 28 14:39:08 2003 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Tue, 28 Oct 2003 09:39:08 -0500 Subject: [Linedit-cvs] CVS update: src/backend.lisp Message-ID: Update of /project/linedit/cvsroot/src In directory common-lisp.net:/tmp/cvs-serv28494 Modified Files: backend.lisp Log Message: Explicit defgeneric for smoither updates. Date: Tue Oct 28 09:39:08 2003 Author: nsiivola Index: src/backend.lisp diff -u src/backend.lisp:1.2 src/backend.lisp:1.3 --- src/backend.lisp:1.2 Thu Oct 23 11:07:08 2003 +++ src/backend.lisp Tue Oct 28 09:39:08 2003 @@ -47,3 +47,5 @@ (backend-close ,backend) , at forms) (backend-init ,backend))) + + (defgeneric display (backend prompt line point))