From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [BUG] ov property line height failed on lone length line when exceeded window width Date: Wed, 03 Jun 2020 17:43:56 +0300 Message-ID: <835zc8ciqb.fsf@gnu.org> References: <8C0A9F18-AF7B-4C50-8625-229456BF40E4@gnu.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="22671"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: "numbchild@gmail.com" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 03 16:44:44 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgUdI-0005lq-Ia for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Jun 2020 16:44:44 +0200 Original-Received: from localhost ([::1]:60384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgUdH-0001TO-LP for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Jun 2020 10:44:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgUcn-0000zp-5n for emacs-devel@gnu.org; Wed, 03 Jun 2020 10:44:13 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42727) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgUcm-00071l-TM; Wed, 03 Jun 2020 10:44:12 -0400 Original-Received: from [176.228.60.248] (port=3749 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jgUcl-0007iY-I0; Wed, 03 Jun 2020 10:44:12 -0400 In-Reply-To: (numbchild@gmail.com) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251812 Archived-At: [Please use "Reply All" to keep the list CC'ed.] > From: "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. This is not a bug. You are trying to use this property in a way that it wasn't designed to support.