nterm-mem-line-get returns line attribute
File modified: lisp/ivan/nterm.el
Change291 at Mon May 03 23:01:13 2010 +0200 by Ivan Kanis <ivan@tao>
diff -r 2ff53df95f93 -r 7d44039ea147 lisp/ivan/nterm.el
--- a/lisp/ivan/nterm.el Mon May 03 21:57:38 2010 +0200
+++ b/lisp/ivan/nterm.el Mon May 03 23:01:13 2010 +0200
@@ -213,7 +213,21 @@
(let ((line (count-lines (point-min) (point-max))))
(if (not (= line nterm-height))
(error "Number of lines is %d but nterm-height is %d"
- line nterm-height))))
+ line nterm-height))
+ (setq line 0)
+ (while (< line nterm-height)
+ (let ((assert-width
+ (progn
+ (goto-line (1+ line))
+ (- (line-end-position) (point))))
+ (assert-expected-width
+ (if (nterm-mem-line-dwl line)
+ (/ nterm-width 2) nterm-width)))
+ (if (not (= assert-width assert-expected-width))
+ (error "Line %d is not %d character long"
+ line assert-expected-width)))
+ (setq line (1+ line)))))
+
(defun nterm-blank-screen (&optional char)
"Blank screen and memory with CHAR.
If char is not specified fill with space.
@@ -1065,13 +1079,12 @@
"TBD document"
(nth (if (aref attribute nterm-vt100-char-special) 1 0)
(nth (if nterm-dwl-exist
- (cond ((nterm-mem-line-get
- nterm-vt100-line-decdwl) 1)
- ((nterm-mem-line-get
- nterm-vt100-line-decdwl-top) 2)
- ((nterm-mem-line-get
- nterm-vt100-line-decdwl-bottom) 3)
- (t 0)) 0)
+ (let ((i-t-attr
+ (nterm-mem-line-get (nterm-cursor-line-get))))
+ (cond ((aref i-t-attr nterm-vt100-line-decdwl) 1)
+ ((aref i-t-attr nterm-vt100-line-decdwl-top) 2)
+ ((aref i-t-attr nterm-vt100-line-decdwl-bottom) 3)
+ (t 0))) 0)
nterm-vt100-charset-table)))
(defun nterm-vt100-char-insert-blink (attribute line-attr)
@@ -2552,11 +2565,15 @@
"Return a blank line attribute vector."
(make-bool-vector 4 nil))
-(defun nterm-mem-line-dwl ()
- "Returns t if current line is double width."
- (or (nterm-mem-line-get nterm-vt100-line-decdwl)
- (nterm-mem-line-get nterm-vt100-line-decdwl-bottom)
- (nterm-mem-line-get nterm-vt100-line-decdwl-top)))
+(defun nterm-mem-line-dwl (&optional line)
+ "Returns t if LINE is double width.
+If LINE is not set use cursor line."
+ (if (not line)
+ (setq line (nterm-cursor-line-get)))
+ (let ((dwl-attr (nterm-mem-line-get line)))
+ (or (aref dwl-attr nterm-vt100-line-decdwl)
+ (aref dwl-attr nterm-vt100-line-decdwl-bottom )
+ (aref dwl-attr nterm-vt100-line-decdwl-top))))
(defun nterm-mem-line-set (attribute bool)
"Set BOOL in ATTRIBUTE of line memory at the cursor position."
@@ -2568,10 +2585,10 @@
(setcdr (assq 'line-attr (nth line nterm-memory))
(nterm-mem-line-blank-attr)))
-(defun nterm-mem-line-get (attribute)
- "Return ATTRIBUTE value of line memory at the cursor posiiton."
- (aref (cdr (assq 'line-attr (nth (nterm-cursor-line-get) nterm-memory)))
- attribute))
+(defun nterm-mem-line-get (line)
+ "Return attribute value at LINE"
+ (cdr (assq 'line-attr (nth line nterm-memory))))
+
(defun nterm-mem-vector-to-dec (vector)
(let ((vector-index 0)
(vector-base 1)