[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 84b111f266: company--multi-prefix: Make sure no
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 84b111f266: company--multi-prefix: Make sure not to shorten the computed prefix length |
Date: |
Thu, 25 Jan 2024 15:57:35 -0500 (EST) |
branch: externals/company
commit 84b111f26663c65cb9e465a028c9558332b4951b
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>
company--multi-prefix: Make sure not to shorten the computed prefix length
https://github.com/company-mode/company-mode/discussions/1448
---
company.el | 7 +++----
test/core-tests.el | 11 ++++++++++-
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/company.el b/company.el
index 26e73671be..325c44d46c 100644
--- a/company.el
+++ b/company.el
@@ -1,6 +1,6 @@
;;; company.el --- Modular text completion framework -*- lexical-binding: t
-*-
-;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2024 Free Software Foundation, Inc.
;; Author: Nikolaj Schumacher
;; Maintainer: Dmitry Gutov <dmitry@gutov.dev>
@@ -1311,9 +1311,8 @@ be recomputed when this value changes."
((and prefix-len
(not (eq len t))
(equal str (company--prefix-str prefix))
- (or (null len)
- (eq prefix-len t)
- (> prefix-len len)))
+ (or (eq prefix-len t)
+ (> prefix-len (or len (length str)))))
(setq len prefix-len))))))
(if (and str len)
(cons str len)
diff --git a/test/core-tests.el b/test/core-tests.el
index be3dbee60d..1f356fb9b5 100644
--- a/test/core-tests.el
+++ b/test/core-tests.el
@@ -1,6 +1,6 @@
;;; core-tests.el --- company-mode tests -*- lexical-binding: t -*-
-;; Copyright (C) 2015-2018, 2020-2023 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2018, 2020-2024 Free Software Foundation, Inc.
;; Author: Dmitry Gutov
@@ -271,6 +271,10 @@
(cl-case command
(prefix (cons "aa" 3))
(candidates (list "aac")))))
+ (fiv (lambda (command &optional _)
+ (cl-case command
+ (prefix (cons "aa" 1))
+ (candidates (list "aac")))))
(company--multi-uncached-backends (list one tri)))
(let ((company-backend (list one tri fur)))
(should
@@ -281,6 +285,11 @@
(should
(equal
'("aa" . t)
+ (company-call-backend 'prefix))))
+ (let ((company-backend (list one fiv)))
+ (should
+ (equal
+ "aa"
(company-call-backend 'prefix))))))
(ert-deftest company-begin-backend-failure-doesnt-break-company-backends ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/company 84b111f266: company--multi-prefix: Make sure not to shorten the computed prefix length,
ELPA Syncer <=