unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to Display a Zero Height Line
@ 2024-11-30  3:02 Psionic K
  2024-11-30  7:35 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Psionic K @ 2024-11-30  3:02 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Psionic K

Related dslide user issue:
https://github.com/positron-solutions/dslide/issues/15

If I use line height or line spacing to accomplish the slide-in
effect, text with any background color set have that background
stretched out.

To work around this, I was going to use a zero height line but could
not achieve the effect after a couple tries.

While I achieved vanishing line height in a fundamental mode buffer
using an actual newline with text properties, I could not reproduce
the effect in a fontified buffer, where I needed to use an overlay.  I
messed around a bit with 'before-string etc.

I'm aware this might be a display limitation and want to confirm
before labeling my user's issue accordingly.



^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: How to Display a Zero Height Line
@ 2024-12-01  1:04 Psionic K
  2024-12-01  6:41 ` Eli Zaretskii
  2024-12-03 13:30 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 12+ messages in thread
From: Psionic K @ 2024-12-01  1:04 UTC (permalink / raw)
  To: help-gnu-emacs

For motivating context, the Dslide package currently uses a
`line-height` modifying overlay to animate text below, achieving a
"slide-in" effect in graphical terminals.  The implementation is
visible around line 2699 in dslide.el, available on Non-GNU ELPA.

The problem with the use of `line-height` is that it interacts with
Emacs display to stretch out the `:inverse-video' background of TODO
tags from the org-modern package.  I expect text with a background
property will be similarly affected.

As I was saying in the title, I am looking for more ways to display a
zero-height line above a line of actual text.  This line can be real,
exist in an overlay, or be achieved through some kind of specified
vertical space or similar concept.  The design requirements are as
follows:

1. There is vertical space between a target line and the line above or
top of the buffer
2. This vertical space does not have a side effect of extending the
background or `:inverse-video' background of the target line or the
line above it
3. The vertical space can be drawn at zero height and at fractional
heights up to the distance content is slid in from

I have set these boundary conditions wide because I might not be aware
of all ways to achieve the desired effect.

Within a fontified buffer, I have been unable to make actual newlines
into fractional or zero height using overlays.  I have neither been
able to use `:before-string` or `:after-string` as properties or
overlays.  I have used what I believe are every combination of
`line-height' and `line-spacing'.  However, the vertical spacing I
have achieved either cannot be drawn all the way down to zero height
or stretches the background of the animated line or preceding line.

As I did not write the display, I am unfamiliar with any intersection
of conditions that is capable of achieving the desired effect.

To be clear, this email is not replying to any previous email in this thread.



^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: How to Display a Zero Height Line
@ 2024-12-04  5:08 Psionic K
  2024-12-04 13:10 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Psionic K @ 2024-12-04  5:08 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Stefan Monnier, Eli Zaretskii

> I think currently, you won't be able to get down to actual zero *except*
> by making that line `invisible`.

It is appropriate to merely get "pretty close" to zero, a pixel or so.
In animation, as long as the final height is quite small, it appears
to smoothly vanish on the final frame.

Regarding Eli's reply:
> What do you mean by "extending the background of :inverse-video
> background" of a line?  Can you show some simple Lisp which produces
> this effect on display?

    (let ((buffer (get-buffer-create "testorito")))
      (set-buffer buffer)
      (erase-buffer)
      (insert "* ")
      (insert (propertize  "TODO" 'face '(:inverse-video t)))
      (insert " Org Modern Uses Inverse Video")
      (insert "\n")
      (insert "* ")
      (insert (propertize  "TODO" 'face '(:inverse-video t :foreground
"#ff2222")))
      (insert " To Draw Fancy Todos")
      (setq-local p (point-max))
      (insert "\n")
      (setq-local o (make-overlay p (1+ p)))
      (overlay-put o 'line-height 4.0)
      (switch-to-buffer buffer))

This example re-creates the situation that exists in Dslide.  I need
to separate the two lines by some floating point multiple of lines in
order to "slide in" to a vanishing degree of separation between two
lines of content.  I use the same technique between list items and
sub-headings.  All text that has a background exhibits the behavior,
not just `:inverse-video`.



^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: How to Display a Zero Height Line
@ 2024-12-12  6:37 Psionic K
  2024-12-12  6:47 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Psionic K @ 2024-12-12  6:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

> And what is the problem with what the above snippet produces?  Is the
> problem that you _want_ the background color extended to EOL?  If so,
> you need to use (:extend t), and you need to make sure the face
> affects the entire line till the newline.

The background of TODO extends vertically in a graphical client.  I
want the space between the two lines.  I do not want the background of
the TODO to extend to the previous line.  Any and all intended
workarounds are acceptable.  I am merely choosing an implementation of
an effect in Dslide and it doesn't matter how it works.

Please CC me.  I don't subscribe to this list directly.



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

end of thread, other threads:[~2024-12-12 12:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-30  3:02 How to Display a Zero Height Line Psionic K
2024-11-30  7:35 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2024-12-01  1:04 Psionic K
2024-12-01  6:41 ` Eli Zaretskii
2024-12-03 13:30 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-12-04  5:08 Psionic K
2024-12-04 13:10 ` Eli Zaretskii
2024-12-12  6:37 Psionic K
2024-12-12  6:47 ` Eli Zaretskii
2024-12-12  9:00   ` Psionic K
2024-12-12  9:23     ` Eli Zaretskii
2024-12-12 12:25       ` Psionic K

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