aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2014-01-05 11:23:35 +0100
committerLars Magne Ingebrigtsen2014-01-05 11:23:35 +0100
commit3d95a0f45aef361c8d22f14017a655a9f1131a81 (patch)
tree79d7617525966072dbfd21366e4892dddc93ac14
parent1a29adc25799d3ab210527252be7e3c496373925 (diff)
downloademacs-3d95a0f45aef361c8d22f14017a655a9f1131a81.tar.gz
emacs-3d95a0f45aef361c8d22f14017a655a9f1131a81.zip
Make shr do line filling better when encountering very long words
(shr-insert): If we have a word that's longer than `shr-width', break after it anyway. Otherwise we'll do no breaking once we get such a long word.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/net/shr.el8
2 files changed, 10 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 86064cecf98..3b1e0451d4e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,9 @@
2 2
3 * net/shr.el (shr-descend): Don't bug out if the anchor is empty 3 * net/shr.el (shr-descend): Don't bug out if the anchor is empty
4 (bug#16285). 4 (bug#16285).
5 (shr-insert): If we have a word that's longer than `shr-width',
6 break after it anyway. Otherwise we'll do no breaking once we get
7 such a long word.
5 8
62014-01-05 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> 92014-01-05 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
7 10
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 77ebf474bc1..32715b18397 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -475,7 +475,13 @@ size, and full-buffer size."
475 (when (> shr-indentation 0) 475 (when (> shr-indentation 0)
476 (shr-indent)) 476 (shr-indent))
477 (end-of-line)) 477 (end-of-line))
478 (insert " "))) 478 (if (<= (current-column) shr-width)
479 (insert " ")
480 ;; In case we couldn't get a valid break point (because of a
481 ;; word that's longer than `shr-width'), just break anyway.
482 (insert "\n")
483 (when (> shr-indentation 0)
484 (shr-indent)))))
479 (unless (string-match "[ \t\r\n ]\\'" text) 485 (unless (string-match "[ \t\r\n ]\\'" text)
480 (delete-char -1))))) 486 (delete-char -1)))))
481 487