Skip to content

Commit

Permalink
fix: Calculate scroll-bars size in frame (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 authored Apr 24, 2024
1 parent b6d12dd commit a59fb5d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lsp-ui-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ We don't extract the string that `lps-line' is already displaying."
(lsp-ui-doc--with-buffer
(fill-region (point-min) (point-max)))))))

(defun lsp-ui-doc--mv-at-point (width height start-x start-y)
(defun lsp-ui-doc--mv-at-point (frame width height start-x start-y)
"Return position of FRAME to be where the point is.
WIDTH is the child frame width.
HEIGHT is the child frame height.
Expand All @@ -518,8 +518,8 @@ FRAME just below the symbol at point."
(posn-x-y (posn-at-point (1- (window-end))))))))
(char-width (frame-char-width))
(char-height (frame-char-height))
(sbw (or (window-scroll-bar-width) 0))
(sbh (or (window-scroll-bar-height) 0))
(sbw (with-selected-frame frame (or (window-scroll-bar-width) 0)))
(sbh (with-selected-frame frame (or (window-scroll-bar-height) 0)))
(frame-relative-symbol-x (+ start-x x (* char-width 2) sbw))
(frame-relative-symbol-y (+ start-y y (- 0 sbh)))
;; Make sure the frame is positioned horizontally such that
Expand Down Expand Up @@ -555,7 +555,7 @@ FRAME just below the symbol at point."
('frame (frame-pixel-width))
('window right)))
((left . top) (if (eq lsp-ui-doc-position 'at-point)
(lsp-ui-doc--mv-at-point width height left top)
(lsp-ui-doc--mv-at-point frame width height left top)
(cons (pcase lsp-ui-doc-side
('right (max (- frame-right width char-w) 10))
('left 10))
Expand Down
7 changes: 1 addition & 6 deletions lsp-ui-util.el
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
;;; lsp-ui-util.el --- Utility module for Lsp-Ui -*- lexical-binding: t -*-

;; Copyright (C) 2020 Shen, Jen-Chieh

;; Author: Jen-Chieh Shen <[email protected]>
;; URL: https://github.com/emacs-lsp/lsp-ui
;; Keywords: languages, tools
;; Version: 6.2
;; Copyright (C) 2020-2024 Shen, Jen-Chieh

;;; License
;;
Expand Down
1 change: 0 additions & 1 deletion lsp-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,5 @@ Both should have the form (FILENAME LINE COLUMN)."
(cons idx (length refs)))
(cons 0 0))))


(provide 'lsp-ui)
;;; lsp-ui.el ends here

0 comments on commit a59fb5d

Please sign in to comment.