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

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

[nongnu] elpa/swsw 5446df0f3e 059/146: * swsw.el (swsw--get-id-length):


From: ELPA Syncer
Subject: [nongnu] elpa/swsw 5446df0f3e 059/146: * swsw.el (swsw--get-id-length): Fix the calculation of the ID length
Date: Wed, 25 May 2022 02:59:44 -0400 (EDT)

branch: elpa/swsw
commit 5446df0f3ee4ab08bc3743a1c21d5476f86f8864
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@dsemy.com>

    * swsw.el (swsw--get-id-length): Fix the calculation of the ID length
---
 swsw.el | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/swsw.el b/swsw.el
index e9c836fc74..597f53ab28 100644
--- a/swsw.el
+++ b/swsw.el
@@ -141,13 +141,9 @@ 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."
-  (let* ((windows (length (window-list-1 nil nil (swsw--get-scope))))
-         (chars (length swsw-id-chars))
-         (div (/ windows chars)))
-    ;; Check the remainder to avoid returning a longer length than necessary.
-    (if (= 0 (mod windows chars))
-        div
-      (1+ div))))
+  (ceiling (log
+            (length (window-list-1 nil nil (swsw--get-scope)))
+            (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]