Subject: bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)

From: IRIE Shinsuke <[email-masked]>
Date: Fri, 19 Mar 2010 19:25:06 +0900

Sorry, the patch I sent with previous mail is bad, because the previous
patch was made without considering `line-spacing' specified by a
floating point number or frame-parameter.

So I wrote the new patch. Please check it.

IRIE Shinsuke

=== modified file 'lisp/term.el'
*** old/lisp/term.el	2010-03-16 14:48:29 +0000
--- new/lisp/term.el	2010-03-19 09:53:36 +0000
***************
*** 942,947 ****
--- 942,958 ----
  	(window-width)
        (1- (window-width)))))
  
+ (defun term-window-height ()
+   (if (display-graphic-p)
+       (let ((e (window-inside-pixel-edges))
+ 	    (s (or (with-current-buffer (window-buffer) line-spacing)
+ 		   (frame-parameter nil 'line-spacing)
+ 		   0)))
+ 	(if (floatp s)
+ 	    (setq s (truncate (* (frame-char-height) s))))
+ 	(/ (+ (- (nth 3 e) (cadr e)) s)
+ 	   (+ (frame-char-height) s)))
+     (window-text-height)))
  
  (put 'term-mode 'mode-class 'special)
  
***************
*** 1039,1045 ****
    (make-local-variable 'term-height)
    (make-local-variable 'term-width)
    (setq term-width (term-window-width))
!   (setq term-height (1- (window-height)))
    (make-local-variable 'term-terminal-parameter)
    (make-local-variable 'term-saved-cursor)
    (make-local-variable 'term-last-input-start)
--- 1050,1056 ----
    (make-local-variable 'term-height)
    (make-local-variable 'term-width)
    (setq term-width (term-window-width))
!   (setq term-height (term-window-height))
    (make-local-variable 'term-terminal-parameter)
    (make-local-variable 'term-saved-cursor)
    (make-local-variable 'term-last-input-start)
***************
*** 1182,1190 ****
      found))
  
  (defun term-check-size (process)
!   (when (or (/= term-height (1- (window-height)))
  	    (/= term-width (term-window-width)))
!     (term-reset-size (1- (window-height)) (term-window-width))
      (set-process-window-size process term-height term-width)))
  
  (defun term-send-raw-string (chars)
--- 1193,1201 ----
      found))
  
  (defun term-check-size (process)
!   (when (or (/= term-height (term-window-height))
  	    (/= term-width (term-window-width)))
!     (term-reset-size (term-window-height) (term-window-width))
      (set-process-window-size process term-height term-width)))
  
  (defun term-send-raw-string (chars)