* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
[not found] <4B80CB5A.8080306@yahoo.co.jp>
@ 2010-03-19 10:23 ` IRIE Shinsuke
2010-03-19 10:25 ` IRIE Shinsuke
2010-03-19 10:38 ` IRIE Shinsuke
2 siblings, 0 replies; 8+ messages in thread
From: IRIE Shinsuke @ 2010-03-19 10:23 UTC (permalink / raw)
To: 5615
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
[not found] <4B80CB5A.8080306@yahoo.co.jp>
2010-03-19 10:23 ` bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch) IRIE Shinsuke
@ 2010-03-19 10:25 ` IRIE Shinsuke
2016-02-28 6:06 ` Lars Ingebrigtsen
2010-03-19 10:38 ` IRIE Shinsuke
2 siblings, 1 reply; 8+ messages in thread
From: IRIE Shinsuke @ 2010-03-19 10:25 UTC (permalink / raw)
To: 5615
[-- Attachment #1: Type: text/plain, Size: 240 bytes --]
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
[-- Attachment #2: term-window-height-newpatch.patch --]
[-- Type: text/x-diff, Size: 2034 bytes --]
=== 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)))
\f
(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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
[not found] <4B80CB5A.8080306@yahoo.co.jp>
2010-03-19 10:23 ` bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch) IRIE Shinsuke
2010-03-19 10:25 ` IRIE Shinsuke
@ 2010-03-19 10:38 ` IRIE Shinsuke
2010-05-30 5:23 ` Ken Hori
2 siblings, 1 reply; 8+ messages in thread
From: IRIE Shinsuke @ 2010-03-19 10:38 UTC (permalink / raw)
To: 5615
Oops, I missed attaching the patch to the mail... Sorry.
IRIE Shinsuke
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
2010-03-19 10:38 ` IRIE Shinsuke
@ 2010-05-30 5:23 ` Ken Hori
0 siblings, 0 replies; 8+ messages in thread
From: Ken Hori @ 2010-05-30 5:23 UTC (permalink / raw)
To: IRIE Shinsuke; +Cc: 5615
Haven't tried yet, but thanks for the patch.
I'm sure this "off-by-2-lines" problem has been an annoyance to most
forks who use term.el off the bzr head.
2010/3/19 IRIE Shinsuke <irieshinsuke@yahoo.co.jp>:
> Oops, I missed attaching the patch to the mail... Sorry.
>
>
> IRIE Shinsuke
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
2010-03-19 10:25 ` IRIE Shinsuke
@ 2016-02-28 6:06 ` Lars Ingebrigtsen
2017-08-11 0:45 ` npostavs
0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-28 6:06 UTC (permalink / raw)
To: IRIE Shinsuke; +Cc: 5615
IRIE Shinsuke <irieshinsuke@yahoo.co.jp> writes:
> 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.
[...]
Is this still a problem in the current Emacs?
> + (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)))
> \f
> (put 'term-mode 'mode-class 'special)
[...]
> (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)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
2016-02-28 6:06 ` Lars Ingebrigtsen
@ 2017-08-11 0:45 ` npostavs
2017-08-11 6:32 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: npostavs @ 2017-08-11 0:45 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: IRIE Shinsuke, 5615
[-- Attachment #1: Type: text/plain, Size: 766 bytes --]
tags 5615 + patch
quit
Lars Ingebrigtsen <larsi@gnus.org> writes:
> IRIE Shinsuke <irieshinsuke@yahoo.co.jp> writes:
>
>> 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.
>
> [...]
>
> Is this still a problem in the current Emacs?
Current Emacs still uses the same (1- (window-height)) expression, but I
can't understand from the description when exactly this gives the wrong
result. Furthermore, I don't see any justification which would explain
why the new proposed significantly more complicated computation is more
correct. I think we should just use window-text-height.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 951 bytes --]
From b22407f5fedea77f34ca1efb5469e368164f9084 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Thu, 10 Aug 2017 20:43:13 -0400
Subject: [PATCH v2] * lisp/term.el (term-mode): Use `window-text-height'
(Bug#5615).
---
lisp/term.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/term.el b/lisp/term.el
index 5eb7b3e8ed..12a37cafbe 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1007,7 +1007,7 @@ term-mode
(setq indent-tabs-mode nil)
(setq buffer-display-table term-display-table)
(set (make-local-variable 'term-home-marker) (copy-marker 0))
- (set (make-local-variable 'term-height) (1- (window-height)))
+ (set (make-local-variable 'term-height) (window-text-height))
(set (make-local-variable 'term-width) (window-max-chars-per-line))
(set (make-local-variable 'term-last-input-start) (make-marker))
(set (make-local-variable 'term-last-input-end) (make-marker))
--
2.11.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
2017-08-11 0:45 ` npostavs
@ 2017-08-11 6:32 ` Eli Zaretskii
2017-08-20 3:34 ` npostavs
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2017-08-11 6:32 UTC (permalink / raw)
To: npostavs; +Cc: larsi, irieshinsuke, 5615
> From: npostavs@users.sourceforge.net
> Date: Thu, 10 Aug 2017 20:45:16 -0400
> Cc: IRIE Shinsuke <irieshinsuke@yahoo.co.jp>, 5615@debbugs.gnu.org
>
> Current Emacs still uses the same (1- (window-height)) expression, but I
> can't understand from the description when exactly this gives the wrong
> result. Furthermore, I don't see any justification which would explain
> why the new proposed significantly more complicated computation is more
> correct. I think we should just use window-text-height.
I think you are right. If no one objects in a few days, please push
your change.
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch)
2017-08-11 6:32 ` Eli Zaretskii
@ 2017-08-20 3:34 ` npostavs
0 siblings, 0 replies; 8+ messages in thread
From: npostavs @ 2017-08-20 3:34 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: larsi, irieshinsuke, 5615
tags 5615 fixed
close 5615 26.1
quit
Eli Zaretskii <eliz@gnu.org> writes:
>> From: npostavs@users.sourceforge.net
>> Date: Thu, 10 Aug 2017 20:45:16 -0400
>> Cc: IRIE Shinsuke <irieshinsuke@yahoo.co.jp>, 5615@debbugs.gnu.org
>>
>> Current Emacs still uses the same (1- (window-height)) expression, but I
>> can't understand from the description when exactly this gives the wrong
>> result. Furthermore, I don't see any justification which would explain
>> why the new proposed significantly more complicated computation is more
>> correct. I think we should just use window-text-height.
>
> I think you are right. If no one objects in a few days, please push
> your change.
Pushed to master.
[1: dbd3a17cb0]: 2017-08-19 23:29:28 -0400
* lisp/term.el (term-mode): Use `window-text-height' (Bug#5615).
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=dbd3a17cb068148bd49e288eb0b44ca7eb4a4e3c
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-08-20 3:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4B80CB5A.8080306@yahoo.co.jp>
2010-03-19 10:23 ` bug#5615: 23.1.92; [PATCH] term.el: Calculation of window height is bad (new patch) IRIE Shinsuke
2010-03-19 10:25 ` IRIE Shinsuke
2016-02-28 6:06 ` Lars Ingebrigtsen
2017-08-11 0:45 ` npostavs
2017-08-11 6:32 ` Eli Zaretskii
2017-08-20 3:34 ` npostavs
2010-03-19 10:38 ` IRIE Shinsuke
2010-05-30 5:23 ` Ken Hori
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).