diff options
author | Vasilij Schneidermann <mail@vasilij.de> | 2024-04-07 14:07:25 +0200 |
---|---|---|
committer | Vasilij Schneidermann <mail@vasilij.de> | 2024-04-07 14:07:25 +0200 |
commit | 4e61316e6157a742eedac86eedcae0036c1cb80b (patch) | |
tree | 15a44f04432c64b5a8825498ef7c6bc7b5dee0cf /nov.el | |
parent | 6508a10afcf6a2c330c76319641a2c64f653b02c (diff) |
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".
Diffstat (limited to 'nov.el')
-rw-r--r-- | nov.el | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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)) |