[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 07d1c41f83 7/7: Merge pull request #1425 from c
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/company 07d1c41f83 7/7: Merge pull request #1425 from company-mode/fractional-scrollbar |
|
Date: |
Thu, 9 Nov 2023 21:57:31 -0500 (EST) |
branch: externals/company
commit 07d1c41f83d5ad5f6263e726283a05ad12cd37a5
Merge: bd79ad6678 1fdba51490
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: GitHub <noreply@github.com>
Merge pull request #1425 from company-mode/fractional-scrollbar
Make scrollbar narrower; move into the right margin
---
NEWS.md | 1 +
company.el | 31 ++++++++++++++++++++++++++-----
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 1be87e0106..c5964e9057 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
# Next
+* New user option `company-tooltip-scrollbar-width` with default 0.4.
* The tooltip uses a more complex rendering approach, supporting double
width/CJK characters, as well as buffer text of different sizes
([#1394](https://github.com/company-mode/company-mode/pull/1394)).
diff --git a/company.el b/company.el
index de357e9868..00bdd930bf 100644
--- a/company.el
+++ b/company.el
@@ -299,6 +299,10 @@ This doesn't include the margins and the scroll bar."
:type '(choice (const :tag "Scrollbar" scrollbar)
(const :tag "Two lines" lines)))
+(defcustom company-tooltip-scrollbar-width 0.4
+ "Width of the scrollbar thumb, in columns."
+ :type 'number)
+
(defcustom company-tooltip-align-annotations nil
"When non-nil, align annotations to the right tooltip border."
:type 'boolean
@@ -3697,7 +3701,7 @@ but adjust the expected values appropriately."
(str (car item))
(annotation (cadr item))
(left (nth 2 item))
- (right (company-space-string company-tooltip-margin))
+ (right (company--right-margin))
(width width)
(selected (equal selection i)))
(when company-show-quick-access
@@ -3733,10 +3737,27 @@ but adjust the expected values appropriately."
(cons lower upper))))
(defun company--scrollbar (i bounds)
- (propertize " " 'face
- (if (and (>= i (car bounds)) (<= i (cdr bounds)))
- 'company-tooltip-scrollbar-thumb
- 'company-tooltip-scrollbar-track)))
+ (let* ((scroll-width (ceiling (* (default-font-width)
+ company-tooltip-scrollbar-width))))
+ (propertize " "
+ 'display `(space . (:width (,scroll-width)))
+ 'face
+ (if (and (>= i (car bounds)) (<= i (cdr bounds)))
+ 'company-tooltip-scrollbar-thumb
+ 'company-tooltip-scrollbar-track))))
+
+(defun company--right-margin ()
+ (if (or (not (eq company-tooltip-offset-display 'scrollbar))
+ (not (display-graphic-p))
+ (= company-tooltip-scrollbar-width 1))
+ (company-space-string company-tooltip-margin)
+ (let* ((scroll-width (ceiling (* (default-font-width)
+ company-tooltip-scrollbar-width)))
+ (rest-width (- (* (default-font-width) company-tooltip-margin)
+ scroll-width)))
+ (propertize
+ (company-space-string company-tooltip-margin)
+ 'display `(space . (:width (,rest-width)))))))
(defun company--scrollpos-line (text width fancy-margin-width)
(propertize (concat (company-space-string company-tooltip-margin)
- [elpa] externals/company updated (cba2bb8929 -> 07d1c41f83), ELPA Syncer, 2023/11/09
- [elpa] externals/company 81f43040d1 4/7: Fix CI try #2, ELPA Syncer, 2023/11/09
- [elpa] externals/company 07d1c41f83 7/7: Merge pull request #1425 from company-mode/fractional-scrollbar,
ELPA Syncer <=
- [elpa] externals/company d923b58357 3/7: Fix CI failure, ELPA Syncer, 2023/11/09
- [elpa] externals/company 125179d0a1 2/7: Fix: add cmake-ts-mode to company-cmake-modes, ELPA Syncer, 2023/11/09
- [elpa] externals/company 17367ee86f 5/7: Update NEWS, ELPA Syncer, 2023/11/09
- [elpa] externals/company 1fdba51490 1/7: Make scrollbar narrower; move into the right margin, ELPA Syncer, 2023/11/09
- [elpa] externals/company bd79ad6678 6/7: Merge pull request #1426 from nverno/fix/add-cmake-ts-mode, ELPA Syncer, 2023/11/09