unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21012: 25.0.50; eww: last char of a line sometimes not fully visible
@ 2015-07-08 18:10 Michael Heerdegen
  2015-07-08 20:03 ` Eli Zaretskii
  2015-10-07  6:34 ` bug#21012: Close Michael Heerdegen
  0 siblings, 2 replies; 38+ messages in thread
From: Michael Heerdegen @ 2015-07-08 18:10 UTC (permalink / raw)
  To: 21012

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]


Hello!

in eww, using shr-use-fonts -> t, for some lines, the last character is
only partially visible.  Not a big deal, but distracting.

Here is a screenshot made with emacs -Q:


[-- Attachment #2: eww.png --]
[-- Type: image/png, Size: 61775 bytes --]

[-- Attachment #3: Type: text/plain, Size: 2693 bytes --]


The issue seems to happen more likely with larger fonts (e.g. with
text-scale-mode -- of course I had hitten g after rescaling), but it
also happens with the default font here.

While browsing through and playing with the code, I found two places
where I could improve things:

1.

--8<---------------cut here---------------start------------->8---
(defun shr-insert-document (dom)
  ...
  (setq shr-content-cache nil)
  (let ((start (point))
	(shr-start nil)
        ...
	(shr-internal-width (or (and shr-width..3..)
				(if (not shr-use-fonts)
				    (- (window-width) 2)
				  (- (window-pixel-width) ; <---- here
				     (* (frame-fringe-width) 2))))))
    (shr-descend dom)
    (shr-fill-lines start (point))
    (shr-remove-trailing-whitespace start (point))
    (when shr-warning..1..)))
--8<---------------cut here---------------end--------------->8---

AFAICT

  (- (window-pixel-width) (* (frame-fringe-width) 2))

is not the available width for text, it is a larger value including
scroll bars etc.  When I change it to

  (window-body-width nil t)

this improves things.  The issue still occurs with this change, though
much less often.


2.

--8<---------------cut here---------------start------------->8---
(defun shr-vertical-motion (column)
  (if (not shr-use-fonts)
      (move-to-column column)
    (unless (eolp)
      (forward-char 1))
    (vertical-motion (cons (/ column (frame-char-width)) 0)) ; <-- here
    (unless (eolp)
      (forward-char 1))))
--8<---------------cut here---------------end--------------->8---

This function is used, among other places, to decide where to break
lines in `shr-fill-line'.

Probably (/ column (frame-char-width)) can be too large if you are
unlucky.  For testing I tried with this version:

--8<---------------cut here---------------start------------->8---
(defun shr-vertical-motion (column)
  (if (not shr-use-fonts)
      (move-to-column column)
    (unless (eolp)
      (forward-char 1))
    (end-of-visual-line)))
--8<---------------cut here---------------end--------------->8---

This seems to fix this issue (together with the first change), though I
guess it's wrong when shr-vertical-motion is called with column <
window-width (dunno if this is done somewhere).


Thanks,

Michael.




In GNU Emacs 25.0.50.4 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.4)
 of 2015-07-07 on drachen
Repository revision: 0bfc94047da4960af55196242728a7a55120867f
Windowing system distributor `The X.Org Foundation', version 11.0.11702000
System Description:	Debian GNU/Linux testing (stretch)

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2015-10-07  6:34 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 18:10 bug#21012: 25.0.50; eww: last char of a line sometimes not fully visible Michael Heerdegen
2015-07-08 20:03 ` Eli Zaretskii
2015-07-08 20:24   ` Michael Heerdegen
2015-07-09  2:38     ` Eli Zaretskii
2015-07-09 11:01       ` Michael Heerdegen
2015-07-09 14:43         ` Eli Zaretskii
2015-07-09 19:42           ` Michael Heerdegen
2015-07-09 15:34       ` Eli Zaretskii
2015-07-09 20:06         ` Michael Heerdegen
2015-07-10  6:03           ` Eli Zaretskii
2015-07-10 12:55             ` Michael Heerdegen
2015-07-10 13:06               ` Eli Zaretskii
2015-07-10 14:16                 ` Michael Heerdegen
2015-07-10 14:43                   ` Eli Zaretskii
2015-07-10 18:04                     ` Michael Heerdegen
2015-07-10 18:45                       ` Eli Zaretskii
2015-07-10 19:19                         ` Michael Heerdegen
2015-07-10 19:31                           ` Eli Zaretskii
2015-07-11 12:02                             ` Michael Heerdegen
2015-07-11 13:45                               ` Eli Zaretskii
2015-07-20 16:33                                 ` Michael Heerdegen
2015-07-20 16:34                                   ` Eli Zaretskii
2015-07-21 18:49                                     ` Michael Heerdegen
2015-09-25  4:00                                       ` Katsumi Yamaoka
2015-09-25 14:45                                         ` Michael Heerdegen
2015-09-28 21:30                                           ` Michael Heerdegen
2015-09-29  5:37                                             ` Eli Zaretskii
2015-10-03  8:08                                               ` Michael Heerdegen
2015-10-03  9:42                                                 ` Eli Zaretskii
2015-10-03 12:41                                                   ` Michael Heerdegen
2015-10-04  6:31                                                     ` Michael Heerdegen
2015-10-04  7:09                                                       ` Eli Zaretskii
2015-10-04  7:11                                                       ` Michael Heerdegen
2015-10-04  7:39                                                         ` Michael Heerdegen
2015-10-04  8:49                                                           ` Eli Zaretskii
2015-10-04 10:18                                                             ` Michael Heerdegen
2015-07-08 20:31   ` Michael Heerdegen
2015-10-07  6:34 ` bug#21012: Close Michael Heerdegen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).