nterm optimize nterm-vt100-width

 

File modified: lisp/ivan/nterm.el

Change287 at Sat May 01 22:42:23 2010 +0200 by Ivan Kanis <ivan@tao>

diff -r c6436d76655c -r 0f3308b55478 lisp/ivan/nterm.el
--- a/lisp/ivan/nterm.el	Sat May 01 17:39:01 2010 +0200
+++ b/lisp/ivan/nterm.el	Sat May 01 22:42:23 2010 +0200
@@ -169,6 +169,10 @@
 (defvar nterm-blink-time 1
   "Time in second for blinking.
 Set to nil if you want to disable blinking")
+
+(defvar nterm-dwl-exist nil
+  "True if double width line exists")
+
 ;;; core nterm functions
 (defmacro nterm-defdispatch (dispatch-list)
   "Create a dispatch table from DISPATCH-LIST."
@@ -778,6 +782,7 @@
 (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")
@@ -1171,6 +1176,7 @@
   (nterm-mem-line-set nterm-vt100-line-decdwl nil)
   (nterm-mem-line-set nterm-vt100-line-decdwl-top t)
   (nterm-mem-line-set nterm-vt100-line-decdwl-bottom nil)
+  (setq nterm-dwl-exist t)
   (nterm-vt100-line-draw)
   (nterm-vt100-escape-end char))
 
@@ -1181,6 +1187,7 @@
   (nterm-mem-line-set nterm-vt100-line-decdwl nil)
   (nterm-mem-line-set nterm-vt100-line-decdwl-top nil)
   (nterm-mem-line-set nterm-vt100-line-decdwl-bottom t)
+  (setq nterm-dwl-exist t)
   (nterm-vt100-line-draw)
   (nterm-vt100-escape-end char))
 
@@ -1191,6 +1198,7 @@
   (nterm-mem-line-set nterm-vt100-line-decdwl t)
   (nterm-mem-line-set nterm-vt100-line-decdwl-top nil)
   (nterm-mem-line-set nterm-vt100-line-decdwl-bottom nil)
+  (setq nterm-dwl-exist t)
   (nterm-vt100-line-draw)
   (nterm-vt100-escape-end char))
 
@@ -1848,7 +1856,9 @@
 (defun nterm-vt100-width ()
   "Return width of current line.
 It takes account of double width line"
-  (if (nterm-mem-line-dwl) (/ nterm-width 2) nterm-width))
+  (if nterm-dwl-exist
+      (if (nterm-mem-line-dwl) (/ nterm-width 2) nterm-width)
+    nterm-width))
 
 ;;; VT52 emulator
 (defvar nterm-vt52-state nil
@@ -2563,6 +2573,7 @@
   (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-set (attribute bool)
   "Set BOOL in ATTRIBUTE of line memory at the cursor position."
   (aset (cdr (assq 'line-attr (nth (nterm-cursor-line-get) nterm-memory)))


back