sebastiencs / company-box

A company front-end with icons
564 stars 64 forks source link

Scrollbar issue #8

Open jwintz opened 6 years ago

jwintz commented 6 years ago

Hi, huge fan of company-box and definitely wanna try sidebar.el.

However, I can't get icons-in-terminal working on High Sierra (maybe my fault, I hacked the CoreText stuff to get all-the-icons working).

Anyway, using:

(when (display-graphic-p)
  (def-package! company-box
    :hook (company-mode . company-box-mode)
    :init
    (setq company-box-icons-elisp
          (list
           (concat (all-the-icons-material "functions") " ")
           (concat (all-the-icons-material "check_circle") " ")
           (concat (all-the-icons-material "stars") " ")
           (concat (all-the-icons-material "format_paint") " ")))
    (setq company-box-icons-unknown (concat (all-the-icons-material "find_in_page") " "))
    (setq company-box-backends-colors nil)))

I've got a scroller issue, that is, all candidates cannot be visited.

Also, whenever the scrollbar is displayed, left hand side icons are cropped.

screen shot 2018-04-11 at 23 27 53
sebastiencs commented 6 years ago

Thanks :) You may also like https://github.com/sebastiencs/omnibox

However, I can't get icons-in-terminal working on High Sierra (maybe my fault, I hacked the CoreText stuff to get all-the-icons working).

This comment and the next one could probably help you to install it on mac os. It explains how to use icons-in-terminal in terminals, but if you just want to use the font on (emacs) GUI, you just need to install the font file like you would install any other font on your system (the ttf file in the build/ directory)

I've got a scroller issue, that is, all candidates cannot be visited.

What do you mean exactly ? You can't access some candidates ?

Also, whenever the scrollbar is displayed, left hand side icons are cropped.

Can you provide an image ?

jwintz commented 6 years ago

Ok, thanks for the comment, I have installed fonts I did not already have using all-the-icons, e.g. build/icons-in-terminal, and some fonts from icons-in-terminal fonts folder, and hacked /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist to be aware of them.

So far print-icons.sh fails on Mac:

screen shot 2018-04-12 at 21 40 21

But the python script from the thread works fine:

screen shot 2018-04-12 at 21 41 00

It should however work in both situations, and we, MacOS Users would very much like to avoid hacking a file that requires to disable System Integrity Protection.

However, back to company-box :-)

Starting with emacs-lisp-mode:

screen shot 2018-04-12 at 21 45 16

See the size of the scroll bar, and consider that I'm a the bottom of provided candidates.

Now for c++-mode:

screen shot 2018-04-12 at 21 48 42

I only have few candidates as opposed to thousands when I do not use company-box.

sebastiencs commented 6 years ago

On the first image you can see that there are 2 child frames for company (3 with the doc). Looks like you have both company-childframe and company-box enabled at the same time ? The child frame from company-childframe is overlapping on the one of company-box.

Is one front-end not enough ? :) You need to disable company-childframe.

Does it somehow solves the issue for the 2nd image too ?

ghost commented 6 years ago

I had a similar issue with Doom-Emacs and removing the default front-ends solved the overlap issue. However, using the Tab key to select elements still results in the scroll bar not following the selection. Also, I have C-d and C-u tied to ivy-scroll-up and ivy-scroll-down and company box's scrolling doesn't seem to respect that. Here's a screenshot: screenshot-2018-04-13_13-52-48

sebastiencs commented 6 years ago

@nealot What the tab key, ivy-scroll-up and ivy-scroll-down are supposed to do, exactly ? Do theses commands work with the built-in front-end ?

ghost commented 6 years ago

@sebastiencs Yeah, Tab is supposed to work as C-n essentially and ivy-scroll-up and ivy-scroll-down scroll the menu up or down by a large value. They actually still work but the scroll bar doesn't display their results if they leave the scroll area.

ghost commented 6 years ago

@jwintz With company box, the number of elements available is controlled by company-tooltip-limit so you'll have to add something like setq company-tooltip-limit 1000 to see 1000 results. That looks something like this: screenshot-2018-04-16_17-12-59 It would be better to have both a limit for the number of elements displayed and for the number of elements able to be selected via scrolling.

dgutov commented 6 years ago

you'll have to add something like setq company-tooltip-limit 1000 to see 1000 results

That's an odd use of this variable...

sebastiencs commented 6 years ago

@nealot I will rework the keymap of company-box and add commands to scroll by large value.

I see in your pictures that the start of candidates (after the icons) isn't aligned with the completion prefix in your current buffer (see the readme picture). Can you disable display-line-numbers-mode and see if it still occurs ?

There is a bug that is fixed in emacs master branch but I thought it happened only when the completion prefix is on the very beginning of line: http://lists.gnu.org/archive/html/bug-gnu-emacs/2018-03/msg00509.html

you'll have to add something like setq company-tooltip-limit 1000 to see 1000 results

That's an odd use of this variable...

Yes I misunderstood the variable, I will change that

ghost commented 6 years ago

The issue has been resolved for me with the recent commits.