[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 13/28: Use `posn-actual-col-row' to determine the current col and
From: |
Dmitry Gutov |
Subject: |
[elpa] 13/28: Use `posn-actual-col-row' to determine the current col and row |
Date: |
Wed, 27 Aug 2014 01:26:27 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 6468e89e00758abebc42477cc0df30a960546d78
Author: Dmitry Gutov <address@hidden>
Date: Mon Aug 18 04:49:19 2014 +0400
Use `posn-actual-col-row' to determine the current col and row
Issue #136 WIP.
Reverting d21bb454dcfacda8808b596e4bca85a53a99eabf, for the most part,
http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00361.html.
---
company.el | 40 +++++++++++++++-------------------------
1 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/company.el b/company.el
index 4b59655..f5598cc 100644
--- a/company.el
+++ b/company.el
@@ -778,22 +778,19 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(defun company-input-noop ()
(push 31415926 unread-command-events))
-(defun company--column (&optional pos)
- (save-excursion
- (when pos (goto-char pos))
- (save-restriction
- (+ (save-excursion
- (vertical-motion 0)
- (narrow-to-region (point) (point-max))
- (let ((prefix (get-text-property (point) 'line-prefix)))
- (if prefix (length prefix) 0)))
- (current-column)))))
+(defun company--posn-col-row (pos)
+ (let* ((col-row (posn-actual-col-row pos))
+ (col (car col-row))
+ (row (cdr col-row)))
+ (when header-line-format
+ (cl-decf row))
+ (cons (+ col (window-hscroll)) row)))
+
+(defun company--col-row (&optional pos)
+ (company--posn-col-row (posn-at-point pos)))
(defun company--row (&optional pos)
- (save-excursion
- (when pos (goto-char pos))
- (count-screen-lines (window-start)
- (progn (vertical-motion 0) (point)))))
+ (cdr (company--col-row pos)))
;;; backends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1813,14 +1810,7 @@ and invoke the normal binding."
(>= evt-row (+ row height)))))))
(defun company--event-col-row (event)
- (let* ((col-row (posn-actual-col-row (event-start event)))
- (col (car col-row))
- (row (cdr col-row)))
- (cl-incf col (window-hscroll))
- (and header-line-format
- (version< "24" emacs-version)
- (cl-decf row))
- (cons col row)))
+ (company--posn-col-row (event-start event)))
(defun company-select-mouse (event)
"Select the candidate picked by the mouse."
@@ -2426,10 +2416,10 @@ 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)
- (let ((row (company--row pos))
- (col (- (company--column pos) column-offset)))
+ (let* ((col-row (company--col-row pos))
+ (col (- (car col-row) column-offset)))
(when (< col 0) (setq col 0))
- (company-pseudo-tooltip-show (1+ row) col company-selection)))
+ (company-pseudo-tooltip-show (1+ (cdr col-row)) col company-selection)))
(defun company-pseudo-tooltip-edit (selection)
(let* ((height (overlay-get company-pseudo-tooltip-overlay 'company-height))
- [elpa] 06/28: Use `window-body-width' instead of the now-alias `window-width', (continued)
- [elpa] 06/28: Use `window-body-width' instead of the now-alias `window-width', Dmitry Gutov, 2014/08/26
- [elpa] 07/28: company--window-inner-height: remove, use `window-body-height', Dmitry Gutov, 2014/08/26
- [elpa] 02/28: company-dabbrev--search-buffer: Use `syntax-ppss' to get to the beg of str-or-cmt, Dmitry Gutov, 2014/08/26
- [elpa] 04/28: Remove the "download ERT" logic; should be unused at this point, Dmitry Gutov, 2014/08/26
- [elpa] 08/28: Assign a face for the tooltip search string, Dmitry Gutov, 2014/08/26
- [elpa] 09/28: Merge pull request #164 from holomorph/tooltip-search, Dmitry Gutov, 2014/08/26
- [elpa] 10/28: Mention company-tooltip-search in NEWS, Dmitry Gutov, 2014/08/26
- [elpa] 11/28: Use window-screen-lines when available, Dmitry Gutov, 2014/08/26
- [elpa] 05/28: company--show-inline-p: never ignore case, Dmitry Gutov, 2014/08/26
- [elpa] 12/28: Tweak wording, Dmitry Gutov, 2014/08/26
- [elpa] 13/28: Use `posn-actual-col-row' to determine the current col and row,
Dmitry Gutov <=
- [elpa] 14/28: Work around http://debbugs.gnu.org/18285, Dmitry Gutov, 2014/08/26
- [elpa] 16/28: company-buffer-lines: handle multiline display better, Dmitry Gutov, 2014/08/26
- [elpa] 17/28: company-input-noop still seems to be needed in the terminal, Dmitry Gutov, 2014/08/26
- [elpa] 18/28: Skip company-buffer-lines tests in terminal, Dmitry Gutov, 2014/08/26
- [elpa] 19/28: company-pseudo-tooltip-unhide: use local vars, Dmitry Gutov, 2014/08/26
- [elpa] 20/28: company-pseudo-tooltip-unhide: fix rendering at eob, Dmitry Gutov, 2014/08/26
- [elpa] 15/28: Fix the tests, Dmitry Gutov, 2014/08/26
- [elpa] 21/28: Add a comment, Dmitry Gutov, 2014/08/26
- [elpa] 22/28: company--capf-data: use caching, Dmitry Gutov, 2014/08/26
- [elpa] 24/28: Use `company-dabbrev-ignore-case' when searching for candidates, Dmitry Gutov, 2014/08/26