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

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

[elpa] externals/posframe b3028b0 2/6: Add posframe-poshandler-point-bot


From: Feng Shu
Subject: [elpa] externals/posframe b3028b0 2/6: Add posframe-poshandler-point-bottom-left-corner-upward
Date: Mon, 3 Aug 2020 03:35:28 -0400 (EDT)

branch: externals/posframe
commit b3028b01a96699b1dfc9b2b5f4e3ba2bc1aa8317
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Add posframe-poshandler-point-bottom-left-corner-upward
    
    * posframe.el (posframe-show): Add 
`posframe-poshandler-point-bottom-left-corner-upward' info to docstring.
    (posframe-poshandler-point-bottom-left-corner): Add upward argument.
    (posframe-poshandler-point-bottom-left-corner-upward): New function.
---
 posframe.el | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/posframe.el b/posframe.el
index bb1c0bf..dd19b4d 100644
--- a/posframe.el
+++ b/posframe.el
@@ -451,6 +451,7 @@ The builtin poshandler functions are listed below:
 14. `posframe-poshandler-window-bottom-right-corner'
 15. `posframe-poshandler-point-top-left-corner'
 16. `posframe-poshandler-point-bottom-left-corner'
+17. `posframe-poshandler-point-bottom-left-corner-upward'
 
 This posframe's buffer is BUFFER-OR-NAME, which can be a buffer
 or a name of a (possibly nonexistent) buffer.
@@ -896,7 +897,7 @@ of `posframe-show'."
     (cons (+ (car position) x-pixel-offset)
           (+ (cdr position) y-pixel-offset))))
 
-(defun posframe-poshandler-point-bottom-left-corner (info &optional 
font-height)
+(defun posframe-poshandler-point-bottom-left-corner (info &optional 
font-height upward)
   "Posframe's position hanlder.
 
 Get bottom-left-corner pixel position of a point,
@@ -929,10 +930,22 @@ Optional argument FONT-HEIGHT ."
          (font-height (or font-height (plist-get info :font-height)))
          (y-bottom (+ y-top font-height)))
     (cons (max 0 (min x (- xmax (or posframe-width 0))))
-          (max 0 (if (> (+ y-bottom (or posframe-height 0)) ymax)
+          (max 0 (if (if upward
+                         (> (- y-bottom (or posframe-height 0)) 0)
+                       (> (+ y-bottom (or posframe-height 0)) ymax))
                      (- y-top (or posframe-height 0))
                    y-bottom)))))
 
+(defun posframe-poshandler-point-bottom-left-corner-upward (info)
+  "Posframe's position hanlder.
+
+Get a position of a point, by which posframe can put above it,
+the structure of INFO can be found in docstring
+of `posframe-show'.
+
+Optional argument FONT-HEIGHT ."
+  (posframe-poshandler-point-bottom-left-corner info nil t))
+
 (defun posframe-poshandler-point-top-left-corner (info)
   "Posframe's position hanlder.
 
@@ -955,7 +968,6 @@ be found in docstring of `posframe-show'."
               (plist-get info :posframe-height))
            2)))
 
-
 (defun posframe-poshandler-frame-top-center (info)
   "Posframe's position handler.
 



reply via email to

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