fix line drawing characters

 

File modified: lisp/ivan/nterm.el

Change282 at Sun Apr 25 17:54:42 2010 +0200 by Ivan Kanis <ivan@tao>

diff -r 989972100e7b -r 095a3a371413 lisp/ivan/nterm.el
--- a/lisp/ivan/nterm.el	Sun Apr 25 14:25:27 2010 +0200
+++ b/lisp/ivan/nterm.el	Sun Apr 25 17:54:42 2010 +0200
@@ -778,6 +778,7 @@
 (defconst nterm-vt100-char-blink 2)
 (defconst nterm-vt100-char-reverse 3)
 (defconst nterm-vt100-char-special 4)
+(defconst nterm-vt100-char-uk 5)
 ;;; Line attributes
 (defconst nterm-vt100-line-decdwl 0
   "Line is double width")
@@ -1067,7 +1068,7 @@
                   (cdr (assq 'background nterm-vt100-state))
                   (cdr (assq 'foreground nterm-vt100-state))))
                 ((characterp insert-char)
-                 (insert (char-to-string char))
+                 (insert (char-to-string insert-char))
                  (put-text-property (- (point) 1) (point) 'face
                                     (cdr (assq 'face nterm-vt100-state)))))
           (nterm-vt100-cuf ?\s)))
@@ -1504,6 +1505,7 @@
                (car (nth (nterm-vt100-mode-decscnm-0) nterm-vt100-color)))
          ;; cons of (g0 . g1)
          (cons 'charset (list 'normal 'normal))
+         (cons 'current-charset 0)
          (cons 'tab (make-bool-vector nterm-width nil))
          (cons 'top-margin 0)
          (cons 'bottom-margin (- nterm-height 1))
@@ -1559,15 +1561,17 @@
 
 (defun nterm-vt100-line-draw-attribute (line draw-index draw-dwl)
   "TBD document me."
-  (let ((draw-attribute
-         (aref (cdr (assq 'attr (nth line nterm-memory))) draw-index))
-        (draw-char
-         (aref (cdr (assq 'char (nth line nterm-memory))) draw-index))
-        (draw-face (nterm-vt100-face-default))
-        (draw-background
-         (car (nth (nterm-vt100-mode-decscnm-0) nterm-vt100-color)))
-        (draw-foreground
-         (car (nth (nterm-vt100-mode-decscnm-1) nterm-vt100-color))))
+  (let* ((draw-attribute
+          (aref (cdr (assq 'attr (nth line nterm-memory))) draw-index))
+         (draw-char-table (nterm-vt100-char-insert-table draw-attribute))
+         (char (aref (cdr (assq 'char (nth line nterm-memory))) draw-index))
+         (draw-char (if (< char (length draw-char-table))
+                        (aref draw-char-table char)))
+         (draw-face (nterm-vt100-face-default))
+         (draw-background
+          (car (nth (nterm-vt100-mode-decscnm-0) nterm-vt100-color)))
+         (draw-foreground
+          (car (nth (nterm-vt100-mode-decscnm-1) nterm-vt100-color))))
     (if (aref draw-attribute nterm-vt100-char-underline)
         (nterm-face-underline draw-face))
     (if (and (aref draw-attribute nterm-vt100-char-blink)
@@ -1692,6 +1696,7 @@
     ((eq char ?1) 'normal)
     ;; TBD Alternate Character ROM Special Graphics
     ((eq char ?2) 'special)))
+  (nterm-vt100-set-attribute)
   (nterm-vt100-escape-end char))
 
 (defun nterm-vt100-scs-g1 (char)
@@ -1708,8 +1713,17 @@
     ((eq char ?1) 'normal)
     ;; TBD Alternate Character ROM Special Graphics
     ((eq char ?2) 'special)))
+  (nterm-vt100-set-attribute)
   (nterm-vt100-escape-end char))
 
+(defun nterm-vt100-set-attribute ()
+  "Set attribute from selected G0 or G1 set"
+  (let ((charset (nth (cdr (assq 'current-charset nterm-vt100-state))
+                      (cdr (assq 'charset nterm-vt100-state))))
+        (attribute (cdr (assq 'attribute nterm-vt100-state))))
+    (aset attribute nterm-vt100-char-special (eq charset 'special))
+    (aset attribute nterm-vt100-char-uk (eq charset 'uk))))
+
 (defun nterm-vt100-set-mode (mode function flag)
   "Set FLAG to MODE call function if mode has changed.
 Functions are indexed in the vector FUNCTION.
@@ -1769,20 +1783,13 @@
 
 (defun nterm-vt100-si (char)
   "Set G0 char table."
-  (let ((si-table (cadr (assq 'charset nterm-vt100-state))))
-    (setcdr (assq 'char-table nterm-vt100-state) si-table)
-    (nterm-vt100-si-so-attribute si-table)))
-
-(defun nterm-vt100-si-so-attribute (table)
-  (aset (cdr (assq 'attribute nterm-vt100-state))
-        nterm-vt100-char-special
-        (eq table 'special)))
+  (setcdr (assq 'current-charset nterm-vt100-state) 0)
+  (nterm-vt100-set-attribute))
 
 (defun nterm-vt100-so (char)
-  "Set G1 char table"
-  (let ((so-table (nth 2 (assq 'charset nterm-vt100-state))))
-    (setcdr (assq 'char-table nterm-vt100-state) so-table)
-    (nterm-vt100-si-so-attribute so-table)))
+  "Set G0 char table."
+  (setcdr (assq 'current-charset nterm-vt100-state) 1)
+  (nterm-vt100-set-attribute))
 
 (defun nterm-vt100-sm (char)
   "SM -- Set Mode - host to vt100"
@@ -2529,7 +2536,7 @@
 
 (defun nterm-mem-attribute ()
   "Return a cell of attribute."
-  (make-bool-vector 5 nil))
+  (make-bool-vector 6 nil))
 
 (defun nterm-mem-display-timer ()
   (if (get-buffer nterm-mem-buffer)


back