fix: off by one when switching workspaces

This commit is contained in:
Jason Zhen 2025-11-04 19:52:57 -05:00
parent f9664ae058
commit 16da9ee1d6

View file

@ -30,10 +30,10 @@
(evil-define-command +workspace:switch-next (&optional count) (evil-define-command +workspace:switch-next (&optional count)
"Switch to next workspace. If COUNT, switch to COUNT-th workspace." "Switch to next workspace. If COUNT, switch to COUNT-th workspace."
(interactive "<c>") (interactive "<c>")
(if count (+workspace/switch-to count) (+workspace/cycle +1))) (if count (+workspace/switch-to (max (1- count) 0)) (+workspace/cycle +1)))
;;;###autoload (autoload '+workspace:switch-previous "ui/workspaces/autoload/evil" nil t) ;;;###autoload (autoload '+workspace:switch-previous "ui/workspaces/autoload/evil" nil t)
(evil-define-command +workspace:switch-previous (&optional count) (evil-define-command +workspace:switch-previous (&optional count)
"Switch to previous workspace. If COUNT, switch to COUNT-th workspace." "Switch to previous workspace. If COUNT, switch to COUNT-th workspace."
(interactive "<c>") (interactive "<c>")
(if count (+workspace/switch-to count) (+workspace/cycle -1))) (if count (+workspace/switch-to (max (1- count) 0)) (+workspace/cycle -1)))