Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks auto-complete interface #32

Open
renatofdds opened this issue Jan 30, 2015 · 8 comments
Open

Breaks auto-complete interface #32

renatofdds opened this issue Jan 30, 2015 · 8 comments

Comments

@renatofdds
Copy link

Indent-guide breaks auto-complete displaying of completions.

@renatofdds
Copy link
Author

Just an example:

Screenshot

@zk-phi
Copy link
Owner

zk-phi commented Jan 31, 2015

thanks.
it seems that indent-guide and popup (internally used by auto-complete) both put overlays at the same place and the popup glitches.
to fix this we probably need to look into popup.el and learn how that library shows popup.

@renatofdds
Copy link
Author

i did a little digging on the problem and what happens is that when popup.el it's making the popup (popup-create) and drawing it (popup-draw) it gets all the overlays which are set on all the lines contained in the popup height and set its 'display property to "", it saves the old property value on the popup (which is a cl-defstruct) by the key of invis-overlays so it can restore it later on (popup-hide). This shouldn't be a huge problem but i believe the glitches comes from the fact that both indent-guides and auto-complete hooks on pre/post-command-hook.

That behavior should be correct i believe for other things which i don't have the time to check, so i don't know exactly which of the libraries should be patched.

What is definitely wrong is popup.el hiding all the overlays from beginning-of-line till end-of-line. It should only hide those beneath the popup actual area.

Anyway, for a workaround i did a monkey patch on overlay-put so it can safely ignore indent-guides, it works perfectly fine for my setup, i don't know if it breaks neither did i tested it with other uses of indent-guide or auto-complete/popup:

(defadvice overlay-put (around ignore-indent-guides first activate)
  (unless (and (equal (overlay-get (ad-get-arg 0) 'category) 'indent-guide)
               (equal (ad-get-arg 1) 'display)
               (equal (ad-get-arg 2) ""))
    ad-do-it))

Hope that helps.

@renatofdds
Copy link
Author

Further testing showed that a problem persists:
Apparently popup.el creates empty lines by prepending whitespaces and dragging the overlayed guides forward. I'm still digging through it.

@renatofdds
Copy link
Author

The problem seems to be that both packages uses overlays before/after-strings. It happens only on empty lines (or lines that are to short to display the indentation) because both overlays get set to the same point and therefore those properties concatenate, there's no overlap possible. I think the only way out is to completely disable those lines when popup.el is being used.

@otijhuis
Copy link

I don't know if auto-complete has the hooks for this but I ran into the same problem with company-mode.
Managed to solve it using the hooks to disable/enable the guides while completion is active.

;; disable indent guide while completion is active
(add-hook 'company-mode-hook
          (lambda ()
            (add-hook 'company-completion-started-hook (lambda (&optional arg)
                                                         (indent-guide-mode -1)) nil 'make-it-local)))

(add-hook 'company-mode-hook
          (lambda ()
            (add-hook 'company-completion-cancelled-hook (lambda (&optional arg)
                                                           (indent-guide-mode 1)) nil 'make-it-local)))

(add-hook 'company-mode-hook
          (lambda ()
            (add-hook 'company-completion-finished-hook (lambda (&optional arg)
                                                          (indent-guide-mode 1)) nil 'make-it-local)))

@zk-phi
Copy link
Owner

zk-phi commented Oct 12, 2015

hmm, auto-complete does not provide such hooks and we need to use advices to do the same for auto-complete.
i'll inspect more later.
thanks.

@jxy
Copy link

jxy commented Feb 17, 2016

Setting indent-guide-delay to a value larger than the popup-delay resolve this issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants