emacs-devel
[Top][All Lists]
Advanced

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

Re: Line height issues with display-line-number-mode


From: Eli Zaretskii
Subject: Re: Line height issues with display-line-number-mode
Date: Wed, 08 May 2019 21:25:52 +0300

> Cc: address@hidden
> From: Clément Pit-Claudel <address@hidden>
> Date: Wed, 8 May 2019 14:04:17 -0400
> 
> (with-current-buffer (get-buffer-create "*test*")
>   (insert "test\ntest\ntest")
>   (let ((ov (make-overlay 1 6))
>         (str (concat (propertize " " 'display '(space :height (1) :align-to 
> right) 'face '(:underline t))
>                    "AAA\n"
>                    "BBB"
>                    (propertize " " 'display '(space :height (1) :align-to 
> right) 'face '(:underline t)))))
>     (overlay-put ov 'after-string str)
>     (overlay-put ov 'face '(:underline t)))
>   (pop-to-buffer (current-buffer)))
> 
> It works OK!  But it has a few problems:
> 
> * The underline is thicker under the first 'test' than under the rest of the 
> line.  It seems to work better if I don't put the :underline property on the 
> overlay itself… but then I don't understand why 'test' gets underlined at all.

You have "test" underlined because your overlay covers it.  Try the
variant below instead.

> * I need to override the underline that might be present on "BBB"
> * There's a line continuation indicator after each long line.  Maybe with a 
> more clever :align-to spec?

Probably.

(with-current-buffer (get-buffer-create "*test*")
  (insert "test\ntest\ntest")
  (let ((ov (make-overlay 6 7))
        (str (concat (propertize " " 'display '(space :height (1) :align-to 
right) 'face '(:underline t))
                     "AAA\n"
                     "BBB"
                     (propertize " " 'display '(space :height (1) :align-to 
right) 'face '(:underline t)))))
    (overlay-put ov 'before-string str)
    (overlay-put ov 'face '(:underline t)))
  (pop-to-buffer (current-buffer)))



reply via email to

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