@@ -76,15 +76,7 @@ Customize it to change the base properties of the text.")
7676 (interactive )
7777 (diff-hl-show-hunk-posframe--transient-mode -1 )
7878 (when (frame-live-p diff-hl-show-hunk--frame)
79- (make-frame-invisible diff-hl-show-hunk--frame))
80- (when diff-hl-show-hunk--original-frame
81- (when (frame-live-p diff-hl-show-hunk--original-frame)
82- (let ((frame diff-hl-show-hunk--original-frame))
83- (select-frame-set-input-focus frame)
84- ; ; In Gnome, sometimes the input focus is not restored to the
85- ; ; original frame, so we try harder in a while
86- (run-with-timer 0.1 nil (lambda () (select-frame-set-input-focus frame)))))
87- (setq diff-hl-show-hunk--original-frame nil )))
79+ (make-frame-invisible diff-hl-show-hunk--frame)))
8880
8981(defvar diff-hl-show-hunk-posframe--transient-mode-map
9082 (let ((map (make-sparse-keymap )))
@@ -179,7 +171,6 @@ The button calls an ACTION."
179171 (user-error
180172 " Package `posframe' is not workable. Please customize diff-hl-show-hunk-function" ))
181173
182- (diff-hl-show-hunk--posframe-hide)
183174 (setq diff-hl-show-hunk--hide-function #'diff-hl-show-hunk--posframe-hide )
184175
185176 ; ; put an overlay to override read-only-mode keymap
@@ -194,8 +185,12 @@ The button calls an ACTION."
194185 (setq posframe-mouse-banish nil )
195186 (setq diff-hl-show-hunk--original-frame (selected-frame ))
196187
197- (let* ((hunk-overlay diff-hl-show-hunk--original-overlay)
198- (position (overlay-end hunk-overlay)))
188+ (let* ((overlay diff-hl-show-hunk--original-overlay)
189+ (type (overlay-get overlay 'diff-hl-hunk-type ))
190+ (position (save-excursion
191+ (goto-char (overlay-end overlay))
192+ (forward-line -1 )
193+ (point ))))
199194 (setq
200195 diff-hl-show-hunk--frame
201196 (posframe-show buffer
@@ -207,12 +202,12 @@ The button calls an ACTION."
207202 :internal-border-color diff-hl-show-hunk-posframe-internal-border-color
208203 :hidehandler nil
209204 ; ; Sometimes, header-line is not taken into account, so put a min height and a min width
210- :min-height (when diff-hl-show-hunk-posframe-show-header-line 10 )
211205 :min-width (when diff-hl-show-hunk-posframe-show-header-line
212206 (length (diff-hl-show-hunk-posframe--header-line)))
213207 :respect-header-line diff-hl-show-hunk-posframe-show-header-line
214208 :respect-tab-line nil
215209 :respect-mode-line nil
210+ :y-pixel-offset (if (eq type 'delete ) (- (default-line-height )))
216211 :override-parameters diff-hl-show-hunk-posframe-parameters)))
217212
218213 (set-frame-parameter diff-hl-show-hunk--frame 'drag-internal-border t )
@@ -231,8 +226,7 @@ The button calls an ACTION."
231226 (setq cursor-type 'box )
232227
233228 ; ; Recenter around point
234- (recenter )))
235- (select-frame-set-input-focus diff-hl-show-hunk--frame))
229+ (recenter ))))
236230
237231(provide 'diff-hl-show-hunk-posframe )
238232; ;; diff-hl-show-hunk-posframe.el ends here
0 commit comments