From 4e61316e6157a742eedac86eedcae0036c1cb80b Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Sun, 7 Apr 2024 14:07:25 +0200 Subject: Preserve `truncate-lines` to fix `visual-line-mode` When one disables wrapping and uses `visual-line-mode`, things like following an internal link ended up enabling `truncate-lines`. After jumping back to the original position, rendering was done with `truncate-lines` enabled, which breaks `visual-line-mode` until `truncate-lines` was disabled again. Therefore, the value of the variable is preserved whenever doing rendering to avoid this glitch. Bonus: The responsible shr.el code does that in its table rendering function and notes that it "probably won't work very well". --- nov.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nov.el') diff --git a/nov.el b/nov.el index f2b6385..c5b4a13 100644 --- a/nov.el +++ b/nov.el @@ -590,7 +590,10 @@ To be used when `nov-text-width' is set to t." (let (;; HACK: make buttons use our own commands (shr-map nov-button-map) (shr-external-rendering-functions nov-shr-rendering-functions) - (shr-use-fonts nov-variable-pitch)) + (shr-use-fonts nov-variable-pitch) + ;; HACK: preserve `truncate-lines' for `visual-line-mode' to + ;; work correctly after a table has been rendered... + (truncate-lines truncate-lines)) ;; HACK: `shr-external-rendering-functions' doesn't cover ;; every usage of `shr-tag-img' (cl-letf (((symbol-function 'shr-tag-img) 'nov-render-img)) -- cgit v1.2.3