unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* using window-screen-lines in window-adjust-process-window-size
@ 2018-10-14 14:54 John Shahid
  2019-01-16 14:10 ` John Shahid
  0 siblings, 1 reply; 8+ messages in thread
From: John Shahid @ 2018-10-14 14:54 UTC (permalink / raw)
  To: Emacs developers

Hi all,

I noticed with line-spacing turned on (i.e. larger than 0) that
`ansi-term' doesn't report the right number of text rows to the shell.
This causes scrolling to get messed up.  It is the result of using
`window-body-height' instead of `window-screen-lines' in
`window-adjust-process-window-size'.  Can anyone think of a reason for
not using `window-screen-lines' ?

Thanks,

JS



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: using window-screen-lines in window-adjust-process-window-size
  2018-10-14 14:54 using window-screen-lines in window-adjust-process-window-size John Shahid
@ 2019-01-16 14:10 ` John Shahid
  2019-04-27 10:43   ` Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size) John Shahid
  0 siblings, 1 reply; 8+ messages in thread
From: John Shahid @ 2019-01-16 14:10 UTC (permalink / raw)
  To: Emacs developers


ping

John Shahid <jvshahid@gmail.com> writes:

> Hi all,
>
> I noticed with line-spacing turned on (i.e. larger than 0) that
> `ansi-term' doesn't report the right number of text rows to the shell.
> This causes scrolling to get messed up.  It is the result of using
> `window-body-height' instead of `window-screen-lines' in
> `window-adjust-process-window-size'.  Can anyone think of a reason for
> not using `window-screen-lines' ?
>
> Thanks,
>
> JS




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
  2019-01-16 14:10 ` John Shahid
@ 2019-04-27 10:43   ` John Shahid
  2019-04-27 10:50     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: John Shahid @ 2019-04-27 10:43 UTC (permalink / raw)
  To: Emacs developers


It has been a while and I haven't heard from anyone.  I am not sure if
that's because no one can answer my question or if my previous two
emails were lost in the ether.

I decided to ask a more direct question.  Does anyone object if I
changed window-adjust-process-window-size to use window-screen-lines
instead of window-body-height ?

Cheers,

JS

John Shahid <jvshahid@gmail.com> writes:

> ping
>
> John Shahid <jvshahid@gmail.com> writes:
>
>> Hi all,
>>
>> I noticed with line-spacing turned on (i.e. larger than 0) that
>> `ansi-term' doesn't report the right number of text rows to the shell.
>> This causes scrolling to get messed up.  It is the result of using
>> `window-body-height' instead of `window-screen-lines' in
>> `window-adjust-process-window-size'.  Can anyone think of a reason for
>> not using `window-screen-lines' ?
>>
>> Thanks,
>>
>> JS



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
  2019-04-27 10:43   ` Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size) John Shahid
@ 2019-04-27 10:50     ` Eli Zaretskii
  2019-04-29 19:45       ` John Shahid
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2019-04-27 10:50 UTC (permalink / raw)
  To: John Shahid; +Cc: emacs-devel

> From: John Shahid <jvshahid@gmail.com>
> Date: Sat, 27 Apr 2019 06:43:08 -0400
> 
> It has been a while and I haven't heard from anyone.

That might actually mean no one objects to your proposal ;-)

> I decided to ask a more direct question.  Does anyone object if I
> changed window-adjust-process-window-size to use window-screen-lines
> instead of window-body-height ?

I think you are on the right track, so please show a patch to do that,
and let's take it from there.

Thanks.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
  2019-04-27 10:50     ` Eli Zaretskii
@ 2019-04-29 19:45       ` John Shahid
  2019-04-30 22:26         ` John Shahid
  0 siblings, 1 reply; 8+ messages in thread
From: John Shahid @ 2019-04-29 19:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

[...]

> I think you are on the right track, so please show a patch to do that,
> and let's take it from there.

Thanks for getting back to me.  I attached the patch below.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Consider-line-spacing-and-font-height-when-deriving-.patch --]
[-- Type: text/x-patch, Size: 2081 bytes --]

From e9cefa049b6c709e728109eb07cfb186024ef581 Mon Sep 17 00:00:00 2001
From: John Shahid <jvshahid@gmail.com>
Date: Sat, 27 Apr 2019 12:21:38 -0400
Subject: [PATCH] Consider line spacing and font height when deriving proc
 window size

* lisp/window.el (window-adjust-process-window-size): Use
  window-screen-lines instead of window-body-height.
* lisp/term.el (term-mode): Use window-screen-lines to set the initial
  window height.
---
 lisp/term.el   | 2 +-
 lisp/window.el | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index 586a887a29..b5949c4600 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1024,7 +1024,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) (window-text-height))
+  (set (make-local-variable 'term-height) (window-screen-lines))
   (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))
diff --git a/lisp/window.el b/lisp/window.el
index b4f5ac5cc4..c8fc1248ab 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9425,10 +9425,12 @@ window-adjust-process-window-size
 the given windows."
   (when windows
     (let ((width (window-max-chars-per-line (car windows)))
-          (height (window-body-height (car windows))))
+          (height (with-selected-window (car windows)
+                    (floor (window-screen-lines)))))
       (dolist (window (cdr windows))
         (setf width (funcall reducer width (window-max-chars-per-line window)))
-        (setf height (funcall reducer height (window-body-height window))))
+        (setf height (funcall reducer height (with-selected-window window
+                                               (floor (window-screen-lines))))))
       (cons width height))))
 
 (defun window-adjust-process-window-size-smallest (_process windows)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
  2019-04-29 19:45       ` John Shahid
@ 2019-04-30 22:26         ` John Shahid
  2019-05-13 12:03           ` John Shahid
  0 siblings, 1 reply; 8+ messages in thread
From: John Shahid @ 2019-04-30 22:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]


I just realized that the initial term-height didn't use floor to round
down the value of window-text-height.  This was masked by a hook I have
in my configuration.  I attached another patch that fixes the issue.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Consider-line-spacing-and-font-height-when-deriving-.patch --]
[-- Type: text/x-patch, Size: 2089 bytes --]

From 92825356ddf320a480c1dd4068cac3f995043faf Mon Sep 17 00:00:00 2001
From: John Shahid <jvshahid@gmail.com>
Date: Sat, 27 Apr 2019 12:21:38 -0400
Subject: [PATCH] Consider line spacing and font height when deriving proc
 window size

* lisp/window.el (window-adjust-process-window-size): Use
  window-screen-lines instead of window-body-height.
* lisp/term.el (term-mode): Use window-screen-lines to set the initial
  window height.
---
 lisp/term.el   | 2 +-
 lisp/window.el | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index 586a887a29..8a28e6df28 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1024,7 +1024,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) (window-text-height))
+  (set (make-local-variable 'term-height) (floor (window-screen-lines)))
   (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))
diff --git a/lisp/window.el b/lisp/window.el
index b4f5ac5cc4..c8fc1248ab 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9425,10 +9425,12 @@ window-adjust-process-window-size
 the given windows."
   (when windows
     (let ((width (window-max-chars-per-line (car windows)))
-          (height (window-body-height (car windows))))
+          (height (with-selected-window (car windows)
+                    (floor (window-screen-lines)))))
       (dolist (window (cdr windows))
         (setf width (funcall reducer width (window-max-chars-per-line window)))
-        (setf height (funcall reducer height (window-body-height window))))
+        (setf height (funcall reducer height (with-selected-window window
+                                               (floor (window-screen-lines))))))
       (cons width height))))
 
 (defun window-adjust-process-window-size-smallest (_process windows)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
  2019-04-30 22:26         ` John Shahid
@ 2019-05-13 12:03           ` John Shahid
  2019-06-07  9:10             ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: John Shahid @ 2019-05-13 12:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


It looks like no one objects to my earlier patch.  If that is the case,
can you push the change to master.  I don't have commit access.

Thanks,

JS

John Shahid <jvshahid@gmail.com> writes:

> I just realized that the initial term-height didn't use floor to round
> down the value of window-text-height.  This was masked by a hook I have
> in my configuration.  I attached another patch that fixes the issue.
>
> From 92825356ddf320a480c1dd4068cac3f995043faf Mon Sep 17 00:00:00 2001
> From: John Shahid <jvshahid@gmail.com>
> Date: Sat, 27 Apr 2019 12:21:38 -0400
> Subject: [PATCH] Consider line spacing and font height when deriving proc
>  window size
>
> * lisp/window.el (window-adjust-process-window-size): Use
>   window-screen-lines instead of window-body-height.
> * lisp/term.el (term-mode): Use window-screen-lines to set the initial
>   window height.
> ---
>  lisp/term.el   | 2 +-
>  lisp/window.el | 6 ++++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/term.el b/lisp/term.el
> index 586a887a29..8a28e6df28 100644
> --- a/lisp/term.el
> +++ b/lisp/term.el
> @@ -1024,7 +1024,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) (window-text-height))
> +  (set (make-local-variable 'term-height) (floor (window-screen-lines)))
>    (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))
> diff --git a/lisp/window.el b/lisp/window.el
> index b4f5ac5cc4..c8fc1248ab 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -9425,10 +9425,12 @@ window-adjust-process-window-size
>  the given windows."
>    (when windows
>      (let ((width (window-max-chars-per-line (car windows)))
> -          (height (window-body-height (car windows))))
> +          (height (with-selected-window (car windows)
> +                    (floor (window-screen-lines)))))
>        (dolist (window (cdr windows))
>          (setf width (funcall reducer width (window-max-chars-per-line window)))
> -        (setf height (funcall reducer height (window-body-height window))))
> +        (setf height (funcall reducer height (with-selected-window window
> +                                               (floor (window-screen-lines))))))
>        (cons width height))))
>
>  (defun window-adjust-process-window-size-smallest (_process windows)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
  2019-05-13 12:03           ` John Shahid
@ 2019-06-07  9:10             ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-06-07  9:10 UTC (permalink / raw)
  To: John Shahid; +Cc: emacs-devel

> From: John Shahid <jvshahid@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Mon, 13 May 2019 08:03:19 -0400
> 
> It looks like no one objects to my earlier patch.  If that is the case,
> can you push the change to master.  I don't have commit access.

Thanks, and sorry for the long delay.

I've now pushed your changes to the master branch.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-06-07  9:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-14 14:54 using window-screen-lines in window-adjust-process-window-size John Shahid
2019-01-16 14:10 ` John Shahid
2019-04-27 10:43   ` Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size) John Shahid
2019-04-27 10:50     ` Eli Zaretskii
2019-04-29 19:45       ` John Shahid
2019-04-30 22:26         ` John Shahid
2019-05-13 12:03           ` John Shahid
2019-06-07  9:10             ` Eli Zaretskii

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).