Use shr because string-pixel-width

This commit is contained in:
MitchMarq42 2023-08-06 18:27:46 -08:00
parent ab4a8e7fb1
commit c96b27452d

View File

@ -31,6 +31,7 @@
(require 'posframe) (require 'posframe)
(require 'alert) (require 'alert)
(require 'shr) ;for `shr-string-pixel-width'
(defvar notibox-width 40) ; characters (defvar notibox-width 40) ; characters
(defvar notibox-height 4) ; characters (defvar notibox-height 4) ; characters
@ -48,7 +49,7 @@
(defun notibox--get-position () (defun notibox--get-position ()
"Return the starting coordinate at which to place the notibox, as cons." "Return the starting coordinate at which to place the notibox, as cons."
(let* ((parent-width (frame-pixel-width)) (let* ((parent-width (frame-pixel-width))
(child-width (* notibox-width (string-pixel-width " "))) (child-width (* notibox-width (shr-string-pixel-width " ")))
(parent-height (frame-pixel-height)) (parent-height (frame-pixel-height))
(child-height (* notibox-height (line-pixel-height)))) (child-height (* notibox-height (line-pixel-height))))
(pcase notibox-corner (pcase notibox-corner