diff options
| author | Samuel Freilich | 2017-08-23 13:40:45 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-08-30 20:10:36 -0400 |
| commit | cda26e64621d71c6a797f694418d844a621998be (patch) | |
| tree | 9ac729275eb1129bacb340ba849d84ffc4eb3a46 /test | |
| parent | 160295867de98241a16f2ede93da7e825ed4406b (diff) | |
| download | emacs-cda26e64621d71c6a797f694418d844a621998be.tar.gz emacs-cda26e64621d71c6a797f694418d844a621998be.zip | |
Do not split line before width of fill-prefix
When auto-filling a paragraph, don't split a line before the width of the
fill-prefix, creating a subsequent line that is as long or longer (Bug#20774).
* lisp/simple.el (do-auto-fill): Only consider break-points that are later in
the line than the width of the fill-prefix. This is a more general solution
than the previous logic, which only skipped over the exact fill-prefix. The
fill-prefix doesn't necessarily match the prefix of the first line of a
paragraph in adaptive-fill-mode.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/simple-tests.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index ad7aee1db17..729001bdf3a 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el | |||
| @@ -497,5 +497,19 @@ See Bug#21722." | |||
| 497 | (should (equal (line-number-at-pos 5) 3)) | 497 | (should (equal (line-number-at-pos 5) 3)) |
| 498 | (should (equal (line-number-at-pos 7) 4))))) | 498 | (should (equal (line-number-at-pos 7) 4))))) |
| 499 | 499 | ||
| 500 | |||
| 501 | ;;; Auto fill. | ||
| 502 | |||
| 503 | (ert-deftest auto-fill-mode-no-break-before-length-of-fill-prefix () | ||
| 504 | (with-temp-buffer | ||
| 505 | (setq-local fill-prefix " ") | ||
| 506 | (set-fill-column 5) | ||
| 507 | ;; Shouldn't break after 'foo' (3 characters) when the next | ||
| 508 | ;; line is indented >= to that, that woudln't result in shorter | ||
| 509 | ;; lines. | ||
| 510 | (insert "foo bar") | ||
| 511 | (do-auto-fill) | ||
| 512 | (should (string-equal (buffer-string) "foo bar")))) | ||
| 513 | |||
| 500 | (provide 'simple-test) | 514 | (provide 'simple-test) |
| 501 | ;;; simple-test.el ends here | 515 | ;;; simple-test.el ends here |