emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swsw f9f64e0559 060/146: * swsw.el (swsw--get-id-length):


From: ELPA Syncer
Subject: [nongnu] elpa/swsw f9f64e0559 060/146: * swsw.el (swsw--get-id-length): Return 1 when there is one window tracked
Date: Wed, 25 May 2022 02:59:44 -0400 (EDT)

branch: elpa/swsw
commit f9f64e0559e14d36ecfe31278a505733f495f7c9
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]