branch: externals/window-commander commit f9f64e0559e14d36ecfe31278a505733f495f7c9 Author: Daniel Semyonov <cm...@dsemy.com> Commit: Daniel Semyonov <cm...@dsemy.com>
* swsw.el (swsw--get-id-length): Return 1 when there is one window tracked --- swsw.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/swsw.el b/swsw.el index 597f53ab28..1bfd882ecc 100644 --- a/swsw.el +++ b/swsw.el @@ -141,9 +141,13 @@ If set to ‘lighter’, use the mode line lighter of ‘swsw-mode’." (defun swsw--get-id-length () "Return the current length of a window ID." - (ceiling (log - (length (window-list-1 nil nil (swsw--get-scope))) - (length swsw-id-chars)))) + (let ((windows (length (window-list-1 nil nil (swsw--get-scope))))) + ;; If there is only one window, return 1. + (if (= windows 1) + 1 + (ceiling (log + windows + (length swsw-id-chars)))))) (defun swsw-update-window (window) "Update information for WINDOW."