Fix at-point position calculation
This commit is contained in:
		
							parent
							
								
									f7b4806694
								
							
						
					
					
						commit
						bbc1139e95
					
				
							
								
								
									
										25
									
								
								eldoc-box.el
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								eldoc-box.el
									
									
									
									
									
								
							| @ -178,13 +178,24 @@ Position is calculated base on WIDTH and HEIGHT of chilframe text window" | |||||||
| (defun eldoc-box--default-at-point-position-function (width height) | (defun eldoc-box--default-at-point-position-function (width height) | ||||||
|   "Set `eldoc-box-position-function' to this function to have childframe appear under point. |   "Set `eldoc-box-position-function' to this function to have childframe appear under point. | ||||||
| Position is calculated base on WIDTH and HEIGHT of chilframe text window" | Position is calculated base on WIDTH and HEIGHT of chilframe text window" | ||||||
|   (let ((point-pos (window-absolute-pixel-position))) |   ;; (window-absolute-pixel-position) | ||||||
|     (cons (- (min (car point-pos) |   ;; (posn-x-y (posn-at-point)) | ||||||
|                   (- (frame-outer-width (selected-frame)) width)) |   (let* ((point-pos (window-absolute-pixel-position)) | ||||||
|              50) |          (frame-pos (frame-edges nil 'native-edges)) | ||||||
|           (if (< (- (frame-outer-height (selected-frame)) height) (cdr point-pos)) |          (x (- (car point-pos) (car frame-pos))) ; relative to native frame | ||||||
|               (- (cdr point-pos) height 60) |          (y (- (cdr point-pos) (nth 1 frame-pos))) | ||||||
|             (- (cdr point-pos) 20))))) |          (en (frame-char-width)) | ||||||
|  |          (em (frame-char-height))) | ||||||
|  |     (cons (if (< (- (frame-inner-width) width) x) | ||||||
|  |               ;; space on the right of the pos is not enough | ||||||
|  |               ;; put to left | ||||||
|  |               (- x width) | ||||||
|  |             (+ x en)) | ||||||
|  |           (if (< (- (frame-inner-height) height) y) | ||||||
|  |               ;; space under the pos is not enough | ||||||
|  |               ;; put above | ||||||
|  |               (- y height) | ||||||
|  |             (+ y em))))) | ||||||
| 
 | 
 | ||||||
| (defun eldoc-box--get-frame (buffer) | (defun eldoc-box--get-frame (buffer) | ||||||
|   "Return a childframe displaying BUFFER. |   "Return a childframe displaying BUFFER. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Yuan Fu
						Yuan Fu