 
 When the source buffer is narrowed the trace buffer remains
 aligned but will not hide the part after the narrowing."
-  (let ((output-window (get-buffer-window live-py-trace-name))
-        (point-min-pos (point-min))
-        (point-min-line-nr 1))
-    (unless (= 1 point-min-pos)
-      ;; Compensate for narrowing.
-      (save-restriction
-        (widen)
-        (setq point-min-line-nr (line-number-at-pos point-min-pos))))
+  (let* ((output-window (get-buffer-window live-py-trace-name))
+         (point-min-pos (point-min))
+         (point-min-line-nr (if (= 1 point-min-pos)
+                                1
+                              ;; Compensate for narrowing.
+                              (save-restriction
+                                (widen)
+                                (line-number-at-pos point-min-pos)))))
     (unless output-window
       (live-py-create-output-window))
     (with-selected-window output-window

      (redisplay))
    (with-current-buffer live-py-trace-name
      (setq-local buffer-read-only 1)
      (unless reused-buffer (toggle-truncate-lines 1)))
    (live-py-update-scroll
     (line-number-at-pos (window-start)) (line-number-at-pos))))


  "Lighter during the plugin state \"failed\".")

;; Internal variables.
(defvar-local live-py-truncate-lines-original nil)
(defvar-local live-py-source-last-active-window nil
  "Window where the source buffer was active the last time.
Can be different to the current window showing the source buffer
