bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19300: 24.4.51; visual-line-mode messes up after-string rendering wh


From: Dmitry Gutov
Subject: bug#19300: 24.4.51; visual-line-mode messes up after-string rendering when it spans all window columns
Date: Mon, 08 Dec 2014 01:50:34 +0200

...when a certain popular font is used. Visual line breaks are inserted,
and it can break the visuals quite badly. For some reason, it happens
not every time I try it in practice, but the test example below shows
this result quite reliably.

Enlarge Emacs so that its width is big enough for pop-to-buffer to
prefer horizontal splits, evaluate the code below and then `M-x test-1'
or `M-x test-2'. The propertizing with `face' below only serves to show
better how the string gets distorted.


;; https://github.com/mozilla/Fira/blob/master/ttf/FiraMono-Regular.ttf?raw=true
(set-face-attribute 'default nil :height 105 :family "Fira Mono")

(defun test-propertize-strings (strings)
  (concat "\n"
          (mapconcat (lambda (str) (propertize str 'face 'highlight))
                     strings
                     "\n")
          "\n"))

(defvar test-string-1 (test-propertize-strings
                       '(" ad-Advice-call-interactively     "
                         " ad-Advice-compilation-find-file  "
                         " ad-Advice-copy-region-as-kill    ")))

(defvar test-string-2 (test-propertize-strings
                       '(" ad-Advice-Info-read-node-name  "
                         " ad-Advice-add-to-history <f>   "
                         " ad-Advice-apropos <f>          "
                         " ad-Advice-beginning-of-buffer  "
                         " ad-Advice-delete-file <f>      "
                         " ad-Advice-delete-window <f>    ")))

(defun test-1 ()
  (interactive)
  (pop-to-buffer "test-1")
  (visual-line-mode 1)
  (enlarge-window-horizontally (- 34 (window-width)))
  (let ((ov (make-overlay (1+ (point)) (1+ (point)) nil t t)))
    (overlay-put ov 'invisible t)
    (overlay-put ov 'after-string test-string-1)
    (overlay-put ov 'window (selected-window))))

(defun test-2 ()
  (interactive)
  (pop-to-buffer "test-2")
  (visual-line-mode 1)
  (enlarge-window-horizontally (- 32 (window-width)))
  (let ((ov (make-overlay (1+ (point)) (1+ (point)) nil t t))
        (str test-string-2))
    (overlay-put ov 'invisible t)
    (overlay-put ov 'after-string str)
    (overlay-put ov 'window (selected-window))))


See attached screenshots for how the results look.

In GNU Emacs 24.4.51.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2014-11-28 on axl
Repository revision: 6b765b8facbdbb03f28028007885236601652515
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:     Ubuntu 14.04.1 LTS

(Also reproducible in 25.0.50.1).

Inspired by https://github.com/company-mode/company-mode/issues/249.

Attachment: test-1.png
Description: PNG image

Attachment: test-2.png
Description: PNG image


reply via email to

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