Skip to content

Commit a59fb5d

Browse files
authored
fix: Calculate scroll-bars size in frame (#776)
1 parent b6d12dd commit a59fb5d

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

lsp-ui-doc.el

+4-4
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ We don't extract the string that `lps-line' is already displaying."
501501
(lsp-ui-doc--with-buffer
502502
(fill-region (point-min) (point-max)))))))
503503

504-
(defun lsp-ui-doc--mv-at-point (width height start-x start-y)
504+
(defun lsp-ui-doc--mv-at-point (frame width height start-x start-y)
505505
"Return position of FRAME to be where the point is.
506506
WIDTH is the child frame width.
507507
HEIGHT is the child frame height.
@@ -518,8 +518,8 @@ FRAME just below the symbol at point."
518518
(posn-x-y (posn-at-point (1- (window-end))))))))
519519
(char-width (frame-char-width))
520520
(char-height (frame-char-height))
521-
(sbw (or (window-scroll-bar-width) 0))
522-
(sbh (or (window-scroll-bar-height) 0))
521+
(sbw (with-selected-frame frame (or (window-scroll-bar-width) 0)))
522+
(sbh (with-selected-frame frame (or (window-scroll-bar-height) 0)))
523523
(frame-relative-symbol-x (+ start-x x (* char-width 2) sbw))
524524
(frame-relative-symbol-y (+ start-y y (- 0 sbh)))
525525
;; Make sure the frame is positioned horizontally such that
@@ -555,7 +555,7 @@ FRAME just below the symbol at point."
555555
('frame (frame-pixel-width))
556556
('window right)))
557557
((left . top) (if (eq lsp-ui-doc-position 'at-point)
558-
(lsp-ui-doc--mv-at-point width height left top)
558+
(lsp-ui-doc--mv-at-point frame width height left top)
559559
(cons (pcase lsp-ui-doc-side
560560
('right (max (- frame-right width char-w) 10))
561561
('left 10))

lsp-ui-util.el

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
;;; lsp-ui-util.el --- Utility module for Lsp-Ui -*- lexical-binding: t -*-
22

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

105
;;; License
116
;;

lsp-ui.el

-1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,5 @@ Both should have the form (FILENAME LINE COLUMN)."
172172
(cons idx (length refs)))
173173
(cons 0 0))))
174174

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

0 commit comments

Comments
 (0)