[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FEATURE SUGGESTED] Re: [BUG] ov property line height failed on lone len

From: Christopher Miles
Subject: [FEATURE SUGGESTED] Re: [BUG] ov property line height failed on lone length line when exceeded window width
Date: Wed, 27 Jan 2021 14:34:06 +0000

<#secure method=pgpmime mode=sign>

I tried to use text-property to implement this effect, but seems not working.

(with-current-buffer (get-buffer org-agenda-buffer)
  (let ((position 1084)
        (inhibit-read-only t))
    (goto-char position)
    (put-text-property (point-at-bol) (1+ (point-at-bol)) 'display " ")
    (let ((ov (make-overlay (point-at-bol) (1+ (point-at-bol)))))
      (overlay-put ov 'line-height 100))))

Eli Zaretskii <eliz@gnu.org> writes:

[Please use "Reply All" to keep the list CC'ed.]

From: "numbchild@gmail.com" <numbchild@gmail.com> Date: Wed, 3 Jun 2020 19:48:57 +0800

Can you please describe how you set the overlay, or better yet, show the code which does so?

The main functionality code set overlay on org-agenda is here:

(defun org-agenda-log-mode-colorize-block () "Set different line spacing based on clock time duration." (save-excursion (let* ((colors (cl-case (alist-get 'background-mode (frame-parameters)) ('light (list "#F6B1C3" "#FFFF9D" "#BEEB9F" "#ADD5F7")) ('dark (list "#aa557f" "DarkGreen" "DarkSlateGray" "DarkSlateBlue")))) pos duration) (nconc colors colors) (goto-char (point-min)) (while (setq pos (next-single-property-change (point) 'duration)) (goto-char pos) (when (and (not (equal pos (point-at-eol))) (setq duration (org-get-at-bol 'duration))) ;; larger duration bar height ;; FIXME (< duration 15) (let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30)))) (ov (make-overlay (point-at-bol) (1+ (point-at-eol))))) (overlay-put ov 'face `(:background ,(car colors) :foreground "black")) (setq colors (cdr colors)) (overlay-put ov 'line-height line-height) (overlay-put ov 'line-spacing (1- line-height))))))))

(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block)

And for a minimal example of setting overlay code is here:

(let ((line-height 20) (ov (make-overlay (point-at-bol) (1+ (point-at-eol))))) (overlay-put ov 'face '(:background "yellow")) (overlay-put ov 'line-height line-height) (overlay-put ov 'line-spacing (1- line-height)))

Did you per chance put the overlay on the part of the line that is not shown when you split the window?

About this problem, I suggest you check out my video link, it shows how the overlay line-height property failed when I split window with `split-window-right`. The line height property is gone. (I mean the visual effect is gone.)

In that case, this is the expected behavior: if the newline with the line-height property is not visible, the setting has no effect. It is conceptually the same as having a tall character or image displayed on a line: if you then truncate the line so that the tall element is not visible, the line's height will be decreased to reflect what is actually on display.

I review this message, does this means the 'line-height overlay property is only on the newline, not on whole line? Is this design for some purpose? This property sounds like should be work on current line instead of newline.

This is not a bug. You are trying to use this property in a way that it wasn't designed to support.

Attachment: ATT00001.txt
Description: ATT00001.txt

reply via email to

[Prev in Thread] Current Thread [Next in Thread]