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

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

[elpa] externals/hydra d071278fcc 20/46: hydra.el (hydra--format): Fix o


From: Stefan Monnier
Subject: [elpa] externals/hydra d071278fcc 20/46: hydra.el (hydra--format): Fix off-by-one
Date: Tue, 25 Oct 2022 22:27:21 -0400 (EDT)

branch: externals/hydra
commit d071278fcc0a62d10c3a3d8a1adf33461a90a0aa
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    hydra.el (hydra--format): Fix off-by-one
    
    * hydra.el (hydra--hint): Don't add an extra newline.
    
    * hydra-test.el (hydra-column-order): One newline less in expected string.
    Also, re-indent the test code.
    
    Fixes #303
---
 hydra-test.el | 97 +++++++++++++++++++++++++++++------------------------------
 hydra.el      |  4 +--
 2 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 42ea3a2acf..7d9d90887e 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1478,39 +1478,38 @@ t: info-to"
                         (nth 3
                              (macroexpand
                               '(defhydra hydra-rectangle (:body-pre 
(rectangle-mark-mode 1)
-                                                                    :color pink
-                                                                    :post 
(deactivate-mark))
-                                 "
+                                                          :color pink
+                                                          :post 
(deactivate-mark))
+                                "
   ^_k_^         ()()
 _h_   _l_       (O)(o)
   ^_j_^         (  O )
 ^^^^            (’’)(’’)
 ^^^^
 "
-                                 ("h" backward-char nil)
-                                 ("l" forward-char nil)
-                                 ("k" previous-line nil)
-                                 ("j" next-line nil)
-                                 ("Of" 5x5 "outside of table 1")
-                                 ("e" exchange-point-and-mark "exchange" 
:column "firstcol")
-                                 ("n" copy-rectangle-as-kill "new-copy")
-                                 ("d" delete-rectangle "delete")
-                                 ("r" (if (region-active-p)
-                                          (deactivate-mark)
-                                        (rectangle-mark-mode 1)) "reset" 
:column "secondcol")
-                                 ("y" yank-rectangle "yank")
-                                 ("u" undo "undo")
-                                 ("s" string-rectangle "string")
-                                 ("p" kill-rectangle "paste")
-                                 ("o" nil "ok" :column "firstcol")
-                                 ("Os" 5x5-bol "outside of table 2" :column 
nil)
-                                 ("Ot" 5x5-eol "outside of table 3")))))))
+                                ("h" backward-char nil)
+                                ("l" forward-char nil)
+                                ("k" previous-line nil)
+                                ("j" next-line nil)
+                                ("Of" 5x5 "outside of table 1")
+                                ("e" exchange-point-and-mark "exchange" 
:column "firstcol")
+                                ("n" copy-rectangle-as-kill "new-copy")
+                                ("d" delete-rectangle "delete")
+                                ("r" (if (region-active-p)
+                                         (deactivate-mark)
+                                       (rectangle-mark-mode 1)) "reset" 
:column "secondcol")
+                                ("y" yank-rectangle "yank")
+                                ("u" undo "undo")
+                                ("s" string-rectangle "string")
+                                ("p" kill-rectangle "paste")
+                                ("o" nil "ok" :column "firstcol")
+                                ("Os" 5x5-bol "outside of table 2" :column nil)
+                                ("Ot" 5x5-eol "outside of table 3")))))))
                  #("  k         ()()
 h   l       (O)(o)
   j         (  O )
             (’’)(’’)
 
-
 firstcol    | secondcol
 ----------- | ------------
 e: exchange | r: reset
@@ -1523,18 +1522,18 @@ o: ok       | s: string
                    17 18 (face hydra-face-pink)
                    21 22 (face hydra-face-pink)
                    38 39 (face hydra-face-pink)
-                   129 130 (face hydra-face-pink)
-                   143 144 (face hydra-face-pink)
-                   152 153 (face hydra-face-pink)
-                   166 167 (face hydra-face-pink)
-                   174 175 (face hydra-face-pink)
-                   188 189 (face hydra-face-pink)
-                   196 197 (face hydra-face-blue)
-                   210 211 (face hydra-face-pink)
-                   234 235 (face hydra-face-pink)
-                   244 246 (face hydra-face-pink)
-                   270 272 (face hydra-face-pink)
-                   296 298 (face hydra-face-pink)))))
+                   128 129 (face hydra-face-pink)
+                   142 143 (face hydra-face-pink)
+                   151 152 (face hydra-face-pink)
+                   165 166 (face hydra-face-pink)
+                   173 174 (face hydra-face-pink)
+                   187 188 (face hydra-face-pink)
+                   195 196 (face hydra-face-blue)
+                   209 210 (face hydra-face-pink)
+                   233 234 (face hydra-face-pink)
+                   243 245 (face hydra-face-pink)
+                   269 271 (face hydra-face-pink)
+                   295 297 (face hydra-face-pink)))))
 
 ;; check column order is the same as they appear in defhydra
 (ert-deftest hydra-column-order ()
@@ -1544,21 +1543,21 @@ o: ok       | s: string
                         (nth 3
                              (macroexpand
                               '(defhydra hydra-window-order
-                                 (:color red :timeout 4)
-                                 ("z" ace-window "ace" :color blue :column 
"Switch")
-                                 ("h" windmove-left "← window")
-                                 ("j" windmove-down "↓ window")
-                                 ("l" windmove-right "→ window")
-                                 ("s" split-window-below "split window" :color 
blue :column "Split Management")
-                                 ("v" split-window-right "split window 
vertically" :color blue)
-                                 ("d" delete-window "delete current window")
-                                 ("f" follow-mode "toogle follow mode")
-                                 ("u" winner-undo "undo window conf" :column 
"Undo/Redo")
-                                 ("r" winner-redo "redo window conf")
-                                 ("b" balance-windows "balance window height" 
:column "1-Sizing")
-                                 ("m" maximize-window "maximize current 
window")
-                                 ("k" windmove-up "↑ window" :column "Switch")
-                                 ("M" minimize-window "minimize current 
window" :column "1-Sizing")
+                                (:color red :timeout 4)
+                                ("z" ace-window "ace" :color blue :column 
"Switch")
+                                ("h" windmove-left "← window")
+                                ("j" windmove-down "↓ window")
+                                ("l" windmove-right "→ window")
+                                ("s" split-window-below "split window" :color 
blue :column "Split Management")
+                                ("v" split-window-right "split window 
vertically" :color blue)
+                                ("d" delete-window "delete current window")
+                                ("f" follow-mode "toogle follow mode")
+                                ("u" winner-undo "undo window conf" :column 
"Undo/Redo")
+                                ("r" winner-redo "redo window conf")
+                                ("b" balance-windows "balance window height" 
:column "1-Sizing")
+                                ("m" maximize-window "maximize current window")
+                                ("k" windmove-up "↑ window" :column "Switch")
+                                ("M" minimize-window "minimize current window" 
:column "1-Sizing")
                                 ("q" nil "quit menu" :color blue :column 
nil)))))))
                  #("Switch      | Split Management           | Undo/Redo       
    | 1-Sizing
 ----------- | -------------------------- | ------------------- | 
--------------------------
diff --git a/hydra.el b/hydra.el
index febfcb1950..e738b18d70 100644
--- a/hydra.el
+++ b/hydra.el
@@ -559,7 +559,7 @@ BODY, and HEADS are parameters to `defhydra'."
          (heads-w-col (cl-remove-if-not (lambda (heads) (hydra--head-property 
(nth 0 heads) :column)) sorted-heads))
          (heads-wo-col (cl-remove-if (lambda (heads) (hydra--head-property 
(nth 0 heads) :column)) sorted-heads)))
     (concat (when heads-w-col
-              (concat "\n" (hydra--hint-from-matrix body 
(hydra--generate-matrix heads-w-col))))
+              (hydra--hint-from-matrix body (hydra--generate-matrix 
heads-w-col)))
             (when heads-wo-col
               (hydra--hint-heads-wocol body (car heads-wo-col))))))
 
@@ -717,7 +717,7 @@ The expressions can be auto-expanded according to NAME."
                         (substring docstring (+ start offset 1 lspec 
varp))))))))
       (cond
         ((string= docstring "")
-         (substring rest 1))
+         rest)
         ((eq ?\n (aref docstring 0))
          `(concat (format ,(substring docstring 1) ,@(nreverse varlist))
                   ,rest))



reply via email to

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