From bf774a7b7e9b7155c57e7a07bbbd5c3c87024a81 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 30 Jul 2015 01:12:48 +0100 Subject: Display result in the echo if the edge of the overlay is off the screen --- cider-overlays.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cider-overlays.el') diff --git a/cider-overlays.el b/cider-overlays.el index ce71030a..e4e249e3 100644 --- a/cider-overlays.el +++ b/cider-overlays.el @@ -127,7 +127,13 @@ PROPS are passed to `cider--make-overlay' with a type of result." ((pred numberp) (run-at-time duration nil #'cider--delete-overlay o)) (`command (add-hook 'post-command-hook #'cider--remove-result-overlay nil 'local))) (-when-let (win (get-buffer-window buffer)) - (when (pos-visible-in-window-p (point) win) + ;; Left edge is visible. + (when (and (pos-visible-in-window-p (point) win) + ;; Right edge is visible. This is a little conservative + ;; if the overlay contains line breaks. + (or (< (+ (current-column) (string-width value)) + (window-width win)) + (not truncate-lines))) o))))) nil)) -- cgit v1.2.3