branch: externals/company
commit 161ce7d279856cfc0c9f607220e952da7948fcf2
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Don't try to make the overlay based popup work in minibuffer
It's almost functional, but the caveats probably make it not the best
experience
for most people. Suggest using a frontend from `company-childframe`.
---
NEWS.md | 3 ++-
company.el | 16 +++++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 877948649d..6452909054 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,7 +3,8 @@
# Next
* New option `company-global-minibuffer` for completion during
`eval-expression`
- (`M-:`).
+ (`M-:`). The "pseudo-tooltip" frontend is not supported by this feature,
+ `company-childframe` is recommended instead.
* `C-M-i` is bound to `company-complete-common` when completion is active.
* New built-in frontend using "real graphical" widget for the popup
([#1525](https://github.com/company-mode/company-mode/pull/1525)).
diff --git a/company.el b/company.el
index 4574f20f4b..2fc715b7ed 100644
--- a/company.el
+++ b/company.el
@@ -1057,7 +1057,10 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(defcustom company-global-minibuffer t
"Non-nil to enable `company-mode' in the minibuffer.
The value can be t (meaning only enable if the minibuffer has a local
-`completion-at-point-functions' value) or a custom predicate function."
+`completion-at-point-functions' value) or a custom predicate function.
+
+The overlay based popup is not supported, completion won't start in
+minibuffer if it's in configured frontends: use `company-childframe'."
:type 'boolean)
;;;###autoload
@@ -1076,8 +1079,7 @@ The value can be t (meaning only enable if the minibuffer
has a local
(company-mode 1)))
(defun company--minibuffer-on ()
- (when (and (or resize-mini-windows
- (not (try-completion "company-pseudo-tooltip"
company-frontends)))
+ (when (and (not (try-completion "company-pseudo-tooltip" company-frontends))
(if (eq company-global-minibuffer t)
(local-variable-p 'completion-at-point-functions)
(funcall company-global-minibuffer)))
@@ -4343,20 +4345,12 @@ Returns a negative number if the tooltip should be
displayed above point."
(overlay-put ov 'company-height height))))
(defun company-pseudo-tooltip-show-at-point (pos column-offset)
- (when (and (= (window-size) 1)
- (minibufferp))
- (add-hook 'window-size-change-functions #'company-pseudo-tooltip-refresh
nil t))
(let* ((col-row (company--col-row pos))
(col (- (car col-row) column-offset)))
(when (< col 0) (setq col 0))
(company--with-face-remappings
(company-pseudo-tooltip-show (1+ (cdr col-row)) col company-selection))))
-(defun company-pseudo-tooltip-refresh (_window)
- (when company-pseudo-tooltip-overlay
- (overlay-put company-pseudo-tooltip-overlay 'company-guard nil))
- (company-pseudo-tooltip-frontend 'post-command))
-
(defun company-pseudo-tooltip-edit (selection)
(let* ((height (overlay-get company-pseudo-tooltip-overlay 'company-height))
(lines-and-offset (company--create-lines selection (abs height)))