sebastiencs / company-box

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

Allow the use of default scrollbars, via new custom variable. #65

Closed andersjohansson closed 4 years ago

andersjohansson commented 5 years ago

I prefer very thin scrollbars (they are just for indicating position, I never click them) and have customized the toolkit scrollbars to my liking (compiling emacs with the lucid toolkit).

This change allows the use of the default scrollbars in the company-box childframe, which looks much better for me. screenshot with default scrollbar

This is a suggestion for how this could be implemented. Works well for me right now, but may need some testing. I'm not sure whether I've made the best choices about options either. Feel free to do whatever you like with it.

sergeyklay commented 5 years ago

@sebastiencs Could you please take a look

seagle0128 commented 5 years ago

It's really nice patch! Only one minor issue, the position of company-box-doc need to be adjusted accordingly.

andersjohansson commented 5 years ago

@seagle0128, I think something like the latest commit should do it, but please test it with your config (I’ve only tested with mine).

I’m not 100% sure about the calculations there either...

seagle0128 commented 5 years ago

@andersjohansson Nice! It works well for default scrollbars now. Thank you!

The doc position in customized scrollbars is not updated, I think.

Updated: I got some errors at the first startup.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  +(nil 0 2)
  company-box-doc--set-frame-position(#<frame  0x7fecd69f9fb0>)
  company-box-doc--show(0 #<frame Centaur Emacs - custom.el 0x7fecd10c4630>)
  #f(compiled-function () #<bytecode 0x1ffb35a87805>)()
  apply(#f(compiled-function () #<bytecode 0x1ffb35a87805>) nil)
  timer-event-handler([t 0 0 500000 nil #f(compiled-function () #<bytecode 0x1ffb35a87805>) nil idle 0])
  redisplay(t)
  company-box--point-bottom()
  company-box--set-frame-position(#<frame  0x7fecd6a1ee30>)
  company-box--display(#("  set\n  seqp\n  setf\n  setq\n  search\n  second..." 0 1 (display (space :width 0.75) company-box--len 3 company-box--color nil) 1 2 (rear-nonsticky t display (raise -0.06) font-lock-face (:family "FontAwesome" :height 1.02 :inherit all-the-icons-purple) face (:family "FontAwesome" :height 1.02 :inherit all-the-icons-purple) company-box--len 3 company-box--color nil) 2 3 (display (space :align-to (+ left-fringe 3)) company-box--len 3 company-box--color nil) 3 5 (face company-tooltip-common company-box--len 3 company-box--color nil) 5 6 (face company-box-candidate company-box--len 3 company-box--color nil) 7 8 (display (space :width 0.75) company-box--len 4 company-box--color nil) 8 9 (rear-nonsticky t display (raise -0.06) font-lock-face (:family "FontAwesome" :height 1.02 :inherit all-the-icons-purple) face (:family "FontAwesome" :height 1.02 :inherit all-the-icons-purple) company-box--len 4 company-box--color nil) 9 10 (display (space :align-to (+ left-fringe 3)) company-box--len 4 company-box--color nil) 10 12 (face company-tooltip-common company-box--len 4 company-box--color nil) 12 14 (face company-box-candidate company-box--len 4 company-box--color nil) 15 16 (display (space :width 0.75) company-box--len 4 company-box--color nil) 16 17 (rear-nonsticky t display (raise -0.06) font-lock-face (:family "FontAwesome" :height 1.02 :inherit all-the-icons-purple) face (:family "FontAwesome" :height 1.02 :inherit all-the-icons-purple) company-box--len 4 company-box--color nil) 17 18 (display (space :align-to (+ left-fringe 3)) company-box--len 4 company-box--color nil) 18 20 (face company-tooltip-common company-box--len 4 company-box--color nil) 20 22 (face company-box-candidate company-box--len 4 company-box--color nil) 23 24 (display (space :width 0.75) company-box--len 4 company-box--color nil) ...))
  company-box-show()
  company-box-frontend(update)
  company-call-frontends(update)
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer custom.el> #<window 3 on custom.el> 173 3727)
  apply(company-idle-begin (#<buffer custom.el> #<window 3 on custom.el> 173 3727))
  timer-event-handler([t 23800 63267 503236 nil company-idle-begin (#<buffer custom.el> #<window 3 on custom.el> 173 3727) nil 0])
sebastiencs commented 4 years ago

Merged. Thanks @andersjohansson !