branch: elpa/flamegraph
commit 5406067f4d560a7c35b2d882f3e297316cfc5bec
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>

    Fix extra empty line after snippet
---
 docs/img/describe-dark.png    | Bin 192815 -> 198565 bytes
 docs/img/describe-light.png   | Bin 158433 -> 163434 bytes
 docs/img/flamegraph-dark.png  | Bin 173760 -> 207057 bytes
 docs/img/flamegraph-light.png | Bin 169928 -> 146361 bytes
 flamegraph.el                 |  13 ++++++++-----
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/docs/img/describe-dark.png b/docs/img/describe-dark.png
index a88cc20868..2ee2cb0ff6 100644
Binary files a/docs/img/describe-dark.png and b/docs/img/describe-dark.png 
differ
diff --git a/docs/img/describe-light.png b/docs/img/describe-light.png
index cb6ad8f883..944aeb909f 100644
Binary files a/docs/img/describe-light.png and b/docs/img/describe-light.png 
differ
diff --git a/docs/img/flamegraph-dark.png b/docs/img/flamegraph-dark.png
index f0b181f589..81221b3b98 100644
Binary files a/docs/img/flamegraph-dark.png and b/docs/img/flamegraph-dark.png 
differ
diff --git a/docs/img/flamegraph-light.png b/docs/img/flamegraph-light.png
index aab43232eb..e01e143c03 100644
Binary files a/docs/img/flamegraph-light.png and 
b/docs/img/flamegraph-light.png differ
diff --git a/flamegraph.el b/flamegraph.el
index bb0bf0ef08..3bad38fe71 100644
--- a/flamegraph.el
+++ b/flamegraph.el
@@ -891,7 +891,11 @@ frames, with Help-style back/forward navigation."
                                       (profiler-calltree-count b)))))
          (self (- count (apply #'+ 0 (mapcar #'profiler-calltree-count kids))))
          (parent (profiler-calltree-parent node))
-         (shown (make-hash-table :test 'eq)))
+         (shown (make-hash-table :test 'eq))
+         (snippet (when loc
+                    (flamegraph--source-snippet
+                     path (cdr loc) node
+                     (and profiler-el-calls shown)))))
     (with-help-window (help-buffer)
       (with-current-buffer standard-output
         (if (and (symbolp entry) (fboundp entry))
@@ -910,11 +914,10 @@ frames, with Help-style back/forward navigation."
                                 (abbreviate-file-name path))))
            'follow-link t
            'help-echo "mouse-1, RET: visit this line")
-          (when-let* ((snippet (flamegraph--source-snippet
-                                path (cdr loc) node
-                                (and profiler-el-calls shown))))
+          (when snippet
             (insert "\n\n" snippet)))
-        (insert (format "\n\nSamples  %s (%s of total)    self  %s (%s)\n"
+        (insert (format "%sSamples  %s (%s of total)    self  %s (%s)\n"
+                        (if snippet "\n" "\n\n")
                         (profiler-format-number count)
                         (flamegraph--percent count total)
                         (profiler-format-number self)

Reply via email to