[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c280e64 01/78: company-safe-substring: Honor the current b
From: |
Dmitry Gutov |
Subject: |
[elpa] master c280e64 01/78: company-safe-substring: Honor the current buffer-invisibility-spec |
Date: |
Sun, 18 Feb 2018 07:40:09 -0500 (EST) |
branch: master
commit c280e6485a2a51eb18e75a8f6f2b074801b59ba2
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
company-safe-substring: Honor the current buffer-invisibility-spec
Fixes #693
---
company.el | 30 ++++++++++++++++--------------
test/frontends-tests.el | 8 ++++++++
2 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/company.el b/company.el
index 4f13dd1..233a1d1 100644
--- a/company.el
+++ b/company.el
@@ -2170,20 +2170,22 @@ character, stripping the modifiers. That character
must be a digit."
(make-string len ?\ )))
(defun company-safe-substring (str from &optional to)
- (if (> from (string-width str))
- ""
- (with-temp-buffer
- (insert str)
- (move-to-column from)
- (let ((beg (point)))
- (if to
- (progn
- (move-to-column to)
- (concat (buffer-substring beg (point))
- (let ((padding (- to (current-column))))
- (when (> padding 0)
- (company-space-string padding)))))
- (buffer-substring beg (point-max)))))))
+ (let ((bis buffer-invisibility-spec))
+ (if (> from (string-width str))
+ ""
+ (with-temp-buffer
+ (setq buffer-invisibility-spec bis)
+ (insert str)
+ (move-to-column from)
+ (let ((beg (point)))
+ (if to
+ (progn
+ (move-to-column to)
+ (concat (buffer-substring beg (point))
+ (let ((padding (- to (current-column))))
+ (when (> padding 0)
+ (company-space-string padding)))))
+ (buffer-substring beg (point-max))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/test/frontends-tests.el b/test/frontends-tests.el
index 0f7c19e..7212c3f 100644
--- a/test/frontends-tests.el
+++ b/test/frontends-tests.el
@@ -367,6 +367,14 @@
(company-modify-line str "zz" 10)
"-*-foobar zz"))))
+(ert-deftest company-modify-line-with-invisible-prop ()
+ (let ((str "-*-foobar")
+ (buffer-invisibility-spec '((outline . t) t)))
+ (put-text-property 1 2 'invisible 'foo str)
+ (should (equal
+ (company-modify-line str "zz" 4)
+ "-*-fzzbar"))))
+
(ert-deftest company-scrollbar-bounds ()
(should (equal nil (company--scrollbar-bounds 0 3 3)))
(should (equal nil (company--scrollbar-bounds 0 4 3)))
- [elpa] master updated (32f6323 -> e65aa3f), Dmitry Gutov, 2018/02/18
- [elpa] master c280e64 01/78: company-safe-substring: Honor the current buffer-invisibility-spec,
Dmitry Gutov <=
- [elpa] master ff295e8 02/78: add golang keywords, Dmitry Gutov, 2018/02/18
- [elpa] master ab2937a 04/78: Fix the warnings, Dmitry Gutov, 2018/02/18
- [elpa] master aefac09 05/78: Force the prefix call to synchronous everywhere, Dmitry Gutov, 2018/02/18
- [elpa] master 191fc01 03/78: Merge pull request #694 from ycz0926/master, Dmitry Gutov, 2018/02/18
- [elpa] master 5df6abf 12/78: company-tng: Usage instructions, Dmitry Gutov, 2018/02/18
- [elpa] master ec1e879 10/78: company-tng: Don't highlight tooltip when unselected, Dmitry Gutov, 2018/02/18
- [elpa] master 91fc865 07/78: Unread whole command instead of last input, Dmitry Gutov, 2018/02/18
- [elpa] master c0098af 06/78: Introduce company-tooltip-maximum-width, Dmitry Gutov, 2018/02/18
- [elpa] master fe20376 11/78: company-tng: Function to give sensible default configuration, Dmitry Gutov, 2018/02/18
- [elpa] master e27f0f4 13/78: NEWS: Entry for company-tng, Dmitry Gutov, 2018/02/18