Support max width/height to be functions
This commit is contained in:
		
							parent
							
								
									112afa1137
								
							
						
					
					
						commit
						1738ccae4c
					
				
							
								
								
									
										13
									
								
								eldoc-box.el
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								eldoc-box.el
									
									
									
									
									
								
							| @ -90,11 +90,15 @@ you moved the point to somewhere else (that doesn't have a doc to show)") | |||||||
| 
 | 
 | ||||||
| (defvar eldoc-box-max-pixel-width 800 | (defvar eldoc-box-max-pixel-width 800 | ||||||
|   "Maximum width of doc childframw in pixel. |   "Maximum width of doc childframw in pixel. | ||||||
| Consider your machine's screen's resolution when setting this variable.") | Consider your machine's screen's resolution when setting this variable. | ||||||
|  | Set it to a function with no argument | ||||||
|  | if you want to dynamically change the maximum width.") | ||||||
| 
 | 
 | ||||||
| (defvar eldoc-box-max-pixel-height 700 | (defvar eldoc-box-max-pixel-height 700 | ||||||
|   "Maximum height of doc childframw in pixel. |   "Maximum height of doc childframw in pixel. | ||||||
| Consider your machine's screen's resolution when setting this variable.") | Consider your machine's screen's resolution when setting this variable. | ||||||
|  | Set it to a function with no argument | ||||||
|  | if you want to dynamically change the maximum height.") | ||||||
| 
 | 
 | ||||||
| ;;;;; Function | ;;;;; Function | ||||||
| (defvar eldoc-box--frame nil ;; A backstage variable | (defvar eldoc-box--frame nil ;; A backstage variable | ||||||
| @ -172,8 +176,9 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'." | |||||||
|     (let* ((size |     (let* ((size | ||||||
|             (window-text-pixel-size |             (window-text-pixel-size | ||||||
|              window nil nil |              window nil nil | ||||||
|              eldoc-box-max-pixel-width |              (if (functionp eldoc-box-max-pixel-width) (funcall eldoc-box-max-pixel-width) eldoc-box-max-pixel-width) | ||||||
|              eldoc-box-max-pixel-height t)) |              (if (functionp eldoc-box-max-pixel-height) (funcall eldoc-box-max-pixel-height) eldoc-box-max-pixel-height) | ||||||
|  |              t)) | ||||||
|            (width (car size)) |            (width (car size)) | ||||||
|            (height (cdr size)) |            (height (cdr size)) | ||||||
|            (width (+ width (frame-char-width frame))) ; add margin |            (width (+ width (frame-char-width frame))) ; add margin | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Yuan Fu
						Yuan Fu