[Linedit-cvs] CVS update: src/smart-terminal.lisp src/version.lisp-expr
Nikodemus Siivola
nsiivola at common-lisp.net
Sat Feb 28 15:13:56 UTC 2004
Update of /project/linedit/cvsroot/src
In directory common-lisp.net:/tmp/cvs-serv17472
Modified Files:
smart-terminal.lisp version.lisp-expr
Log Message:
Smart terminal should now work on darwin
Date: Sat Feb 28 10:13:56 2004
Author: nsiivola
Index: src/smart-terminal.lisp
diff -u src/smart-terminal.lisp:1.11 src/smart-terminal.lisp:1.12
--- src/smart-terminal.lisp:1.11 Sat Feb 28 07:11:16 2004
+++ src/smart-terminal.lisp Sat Feb 28 10:13:56 2004
@@ -23,15 +23,24 @@
(defclass smart-terminal (terminal)
((point-row :initform 1 :accessor point-row)
+ (point-col :initform 0 :accessor point-col)
(active-string :initform "" :accessor active-string)
(markup-start :initform 0 :accessor get-markup-start)))
+(defun set-column-address (n current)
+ (if nil
+ (ti:tputs ti:column-address n)
+ (cond ((< n current)
+ (loop repeat (- current n)
+ do (ti:tputs ti:cursor-left)))
+ ((> n current)
+ (loop repeat (- n current)
+ do (ti:tputs ti:cursor-right))))))
+
(defun smart-terminal-p ()
- (and (every 'identity
- (list ti:cursor-up ti:cursor-down
- ti:clr-eos ti:column-address ))
- (some 'identity
- (list ti:auto-right-margin ti:enter-am-mode))))
+ (and ti:cursor-up ti:cursor-down ti:clr-eos
+ (or ti:column-address (and ti:cursor-left ti:cursor-right))
+ (or ti:auto-right-margin ti:enter-am-mode)))
(defmethod backend-init ((backend smart-terminal))
(call-next-method)
@@ -45,8 +54,8 @@
(defun find-col (n columns)
(rem n columns))
-(defun move-up-in-column (&key col up clear-to-eos)
- (ti:tputs ti:column-address col)
+(defun move-up-in-column (&key col up clear-to-eos current-col)
+ (set-column-address col current-col)
(loop repeat up do (ti:tputs ti:cursor-up))
(when clear-to-eos
(ti:tputs ti:clr-eos)))
@@ -65,7 +74,8 @@
(defmethod display ((backend smart-terminal) &key prompt line point markup)
(let* ((*terminal-io* *standard-output*)
(columns (backend-columns backend))
- (old-markup-start (get-markup-start backend)))
+ (old-markup-start (get-markup-start backend))
+ (old-col (point-col backend)))
(multiple-value-bind (marked-line markup-start)
(if markup
(dwim-mark-parens line point
@@ -85,14 +95,17 @@
(move-up-in-column
:col start-col
:up (- (point-row backend) start-row)
- :clear-to-eos t)
+ :clear-to-eos t
+ :current-col old-col)
(write-string (subseq new start))
(fix-wraparound start end columns)
(move-up-in-column
- :col point-col
- :up (- rows point-row))
+ :col point-col
+ :up (- rows point-row)
+ :current-col (find-col end columns))
;; Save state
(setf (point-row backend) point-row
+ (point-col backend) point-col
(active-string backend) (concat prompt line)
(get-markup-start backend) markup-start)
(force-output *terminal-io*)))))
Index: src/version.lisp-expr
diff -u src/version.lisp-expr:1.6 src/version.lisp-expr:1.7
--- src/version.lisp-expr:1.6 Sat Feb 28 09:27:27 2004
+++ src/version.lisp-expr Sat Feb 28 10:13:56 2004
@@ -1 +1 @@
-0.15.2
+0.15.3
More information about the linedit-cvs
mailing list