all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: 14825@debbugs.gnu.org
Subject: bug#14825: 24.3.50; split-window-below miscounts window lines
Date: Sat, 13 Jul 2013 14:54:56 +0300	[thread overview]
Message-ID: <83sizi4qun.fsf@gnu.org> (raw)
In-Reply-To: <51E135B0.4@gmx.at>

> Date: Sat, 13 Jul 2013 13:10:40 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: 14825@debbugs.gnu.org
> 
>  > Does window-text-height still reports the actual number of text lines
>  > in a window?
> 
> What is "the actual number of text lines in a window"?

The number of glyph rows visible in the window.

>  >>  >> If OTOH the frame contains more than one window, we would have a
>  >>  >> hard time to relate the height of these windows to that of the
>  >>  >> frame.
>  >>  >
>  >>  > The only reliable way of doing that is in pixels anyway.
>  >>
>  >> Currently it's done in lines and columns.
>  >
>  > Which is why we don't need to bother that it will become unreliable,
>  > as it is already there.
> 
> You mean it's not reliable currently?

Yes.

>  >>  >> Lifting the present relationship without providing a viable alternative
>  >>  >> would be a misconception IMO.
>  >>  >
>  >>  > That's why I suggested to introduce a separate set of APIs.
>  >>
>  >> What would their specification look like?
>  >
>  > Similar to the ones we have now, except they will take the font and
>  > line-spacing into account.
> 
> But this is what I asked for here months ago: A function that tells me
> how much space a buffer text would occupy if displayed in a certain
> window

Well, you now have window-screen-lines ;-)

> and what I wrote `window-text-pixel-size' for.  But this is based
> on actual line heights, not necessarily those specified by the buffer's
> default face plus line spacing.  And I suppose moving by lines calls for
> actual line heights too.

Yes, of course.  If you need to count in units of the default face and
also take the line-spacing into consideration, window-screen-lines is
your friend.

>  >>  >  . Add a separate set of APIs for counting the number of default-face
>  >>  >    text lines and characters in a window.
>  >>
>  >> I don't understand: Would `window-text-height' be part of this set?  Or
>  >> would I have to write `window-default-text-height'?
>  >
>  > We would have one that counts in canonical lines, the other that
>  > counts in lines of the current default face.
> 
> The problem I mentioned earlier still stands.  Variables like
> `split-height-threshold' or `window-min-height' are not reasonably
> buffer local.  Users can bind these variables around `split-window'
> calls to express that the old and new window should not be smaller than
> a certain number of lines.  If these windows will end up to show
> different buffers as after calls of `display-buffer' they usually do,
> it's not clear which interpretation should prevail: `split-window'
> doesn't know which buffer to display in the new window (or, as with
> ispell, in the old window).

Which probably means that split-window should be told what is expected
of it: use canonical lines or lines the current window actually uses.

> Your inital bug report makes perfect sense considering the C-x 2 case
> for a window with a different buffer default face.  So we could handle
> interactive splitting to not produce an error in that case.  For
> non-interactive calls of `split-window-below' you should at least try to
> address the concerns I raise in the last paragraph.

I tried, see above.  But each such issue should be handled on a case
by case basis.  I don't see a one-fits-all kind of solution, because
these APIs are used in different contexts.





  reply	other threads:[~2013-07-13 11:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 17:52 bug#14825: 24.3.50; split-window-below miscounts window lines Eli Zaretskii
2013-07-09  9:09 ` martin rudalics
2013-07-09 16:12   ` Eli Zaretskii
2013-07-10  7:20     ` martin rudalics
2013-07-10 15:42       ` Eli Zaretskii
2013-07-11  6:27         ` martin rudalics
2013-07-11 16:52           ` Eli Zaretskii
2013-07-12  8:21             ` martin rudalics
2013-07-12  9:09               ` Eli Zaretskii
2013-07-12 10:12                 ` martin rudalics
2013-07-12 13:29                   ` Eli Zaretskii
2013-07-12 14:57                     ` Juanma Barranquero
2013-07-13 11:10                     ` martin rudalics
2013-07-13 11:54                       ` Eli Zaretskii [this message]
2013-07-13 13:56                         ` martin rudalics
2013-07-13 14:38                           ` Eli Zaretskii
2019-10-15 17:38 ` martin rudalics
2020-09-21 12:38   ` Lars Ingebrigtsen
2020-09-21 14:29     ` Eli Zaretskii
2020-09-21 17:46       ` martin rudalics
2020-09-21 17:48         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sizi4qun.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=14825@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.