diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-04 16:41:02 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-04 16:41:02 -0500 |
| commit | 797fa7a6f51211b1218a2c08ce57dbbab835610c (patch) | |
| tree | 0be7523e8473f29d0d76271450fd6aaab485e7b1 | |
| parent | 5463f104165185501be9cd6f7458d1b0cad856de (diff) | |
| download | emacs-wttrin-797fa7a6f51211b1218a2c08ce57dbbab835610c.tar.gz emacs-wttrin-797fa7a6f51211b1218a2c08ce57dbbab835610c.zip | |
fix: weather ASCII art wraps when window is narrow
Enable truncate-lines in wttrin-mode so the fixed-width weather art
clips at the window edge instead of wrapping and breaking the layout.
| -rw-r--r-- | tests/test-wttrin--display-weather.el | 12 | ||||
| -rw-r--r-- | wttrin.el | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-wttrin--display-weather.el b/tests/test-wttrin--display-weather.el index b30c5b5..bca6a6c 100644 --- a/tests/test-wttrin--display-weather.el +++ b/tests/test-wttrin--display-weather.el @@ -243,5 +243,17 @@ not the lowercase version that wttr.in returns." (should (string-match-p "Wind: 5 km/h" contents))))) (test-wttrin--display-weather-teardown))) +;;; Line Wrapping + +(ert-deftest test-wttrin--display-weather-normal-truncate-lines-enabled () + "Weather buffer should not wrap lines — the ASCII art breaks if it does." + (test-wttrin--display-weather-setup) + (unwind-protect + (testutil-wttrin-with-clean-weather-buffer + (wttrin--display-weather "Paris" test-wttrin--display-weather-sample-raw-data) + (with-current-buffer "*wttr.in*" + (should truncate-lines))) + (test-wttrin--display-weather-teardown))) + (provide 'test-wttrin--display-weather) ;;; test-wttrin--display-weather.el ends here @@ -370,6 +370,8 @@ Weather data is displayed in a read-only buffer with the following keybindings: \\{wttrin-mode-map}" (buffer-disable-undo) + ;; ASCII art breaks if lines wrap at the window edge + (setq truncate-lines t) ;; Use face-remap instead of buffer-face-mode to preserve xterm-color faces (face-remap-add-relative 'default :family wttrin-font-name |
