]> code.delx.au - gnu-emacs-elpa/commitdiff
Added scrolling.
authorNikolaj Schumacher <git@nschum.de>
Tue, 10 Mar 2009 08:48:42 +0000 (09:48 +0100)
committerNikolaj Schumacher <git@nschum.de>
Mon, 16 Mar 2009 17:04:34 +0000 (18:04 +0100)
company.el

index a5e5251e2580b045e9207e42d86882b01e8c43b8..7dc98e8763f45e3f353d9ab5e19d5c06c272bf3d 100644 (file)
 (defsubst company-strip-prefix (str)
   (substring str (length company-prefix)))
 
+(defsubst company-offset (display-limit)
+  (let ((offset (- company-selection display-limit -1)))
+    (max offset 0)))
+
 (defun company-begin ()
   (let ((completion-ignore-case nil) ;; TODO: make this optional
         prefix)
   (unless lines (error "No text provided"))
   (save-excursion
 
+    ;; Scroll to offset.
+    (let ((offset (company-offset company-tooltip-limit)))
+      (setq lines (nthcdr offset lines))
+      (decf selection offset))
+
     (setq lines (company-fill-propertize-lines column lines selection))