diff options
| author | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2014-01-05 11:23:35 +0100 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen <larsi@gnus.org> | 2014-01-05 11:23:35 +0100 |
| commit | 3d95a0f45aef361c8d22f14017a655a9f1131a81 (patch) | |
| tree | 79d7617525966072dbfd21366e4892dddc93ac14 | |
| parent | 1a29adc25799d3ab210527252be7e3c496373925 (diff) | |
| download | emacs-3d95a0f45aef361c8d22f14017a655a9f1131a81.tar.gz | |
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/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/net/shr.el | 8 |
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 @@ * net/shr.el (shr-descend): Don't bug out if the anchor is empty (bug#16285). + (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. 2014-01-05 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com> 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." (when (> shr-indentation 0) (shr-indent)) (end-of-line)) - (insert " "))) + (if (<= (current-column) shr-width) + (insert " ") + ;; In case we couldn't get a valid break point (because of a + ;; word that's longer than `shr-width'), just break anyway. + (insert "\n") + (when (> shr-indentation 0) + (shr-indent))))) (unless (string-match "[ \t\r\n ]\\'" text) (delete-char -1))))) |
