From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#68688: 30.0.50; next-line-completion doesn't work with multiline completions Date: Wed, 24 Jan 2024 10:55:37 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3221"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Juri Linkov To: 68688@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 24 16:56:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rSfbv-0000ab-Ou for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Jan 2024 16:56:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSfba-0005T7-Qv; Wed, 24 Jan 2024 10:55:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSfbZ-0005Kd-IT for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 10:55:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSfbZ-0002pF-A1 for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 10:55:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rSfbe-0006Tm-0b for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 10:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Jan 2024 15:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68688 X-GNU-PR-Package: emacs Original-Received: via spool by 68688-submit@debbugs.gnu.org id=B68688.170611175124884 (code B ref 68688); Wed, 24 Jan 2024 15:56:01 +0000 Original-Received: (at 68688) by debbugs.gnu.org; 24 Jan 2024 15:55:51 +0000 Original-Received: from localhost ([127.0.0.1]:46340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSfbS-0006TF-JE for submit@debbugs.gnu.org; Wed, 24 Jan 2024 10:55:51 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:33855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSfbR-0006T0-0D for 68688@debbugs.gnu.org; Wed, 24 Jan 2024 10:55:49 -0500 In-Reply-To: (Spencer Baugh's message of "Wed, 24 Jan 2024 09:44:10 -0500") DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1706111737; bh=Go1TLPv9Dtbzdk7N8Undjm+h70GIXvDKFxbcnxne/aw=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=IyzJBfWaB2pkmKEd9pKlJMowQUSjlWfVZI7qvXtpBKyMmLI2+NTjRr66EB3F9S5N+ ebr0ctAeDdeDXuQ1lA71IumXQKBDguvif6bU7HgMMn5OzeezdL4AVaFEWNeLvHGKAa 9igrigbSEv3htC8c23+4P8Y0wOZngtmd9Rb5vcv4EkjC/4eAqYVIdjiYaIQT3GIfOq ts9SQWskqhr0c+TWeHNB0CUTF/lpo6Q0nQ93ibaZKmsYP8yAYkMJJJCrcj6/rZFc1c ZlSbOtvD/7Q5kX6eNDcCiot8e8m8KHvI6whcOhlFIC82J0lJP9N8sX/WZYpWzdv3yW H/cUCgcbkeAJg== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:278790 Archived-At: --=-=-= Content-Type: text/plain Patch which fixes this attached. It simply adds an additional loop around forward-line which runs until we leave the completion at point. BTW, I think we should have some helper functions for "get start of completion candidate or point-min" and "get end of completion candidate or point-max", or possibly "move to start of candidate" and "move to end of candidate"; it's pretty hard to get right. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-next-line-completion-for-multi-line-completions.patch >From ffe03b3fe8fb805f5e4eb0a2ea956d573272e74a Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Wed, 24 Jan 2024 10:52:40 -0500 Subject: [PATCH] Fix next-line-completion for multi-line completions Previously it would not move out of a multi-line completion, and now it will. * lisp/simple.el (next-line-completion): Move out of the completion before going forward lines. (bug#68688) --- lisp/simple.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lisp/simple.el b/lisp/simple.el index 313241a7d34..35fd76b8d1a 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9937,6 +9937,17 @@ next-line-completion (while (> n 0) (setq found nil pos nil column (current-column) line (line-number-at-pos)) + ;; If in a completion and not at the end, move lines forward + ;; until we leave it or reach the end. + (when (and (get-text-property (point) 'mouse-face) + (not (eobp)) + (get-text-property (1+ (point)) 'mouse-face)) + (let ((end (or (next-single-property-change (point) 'mouse-face) (point-max)))) + (while (and + (< (point) end) + (eq (forward-line 1) 0) + (not (eobp)) + (eq (move-to-column column) column))))) (while (and (not found) (eq (forward-line 1) 0) (not (eobp)) @@ -9961,6 +9972,15 @@ next-line-completion (while (< n 0) (setq found nil pos nil column (current-column) line (line-number-at-pos)) + ;; If in a completion and not at the start, move lines backward + ;; until we leave it or reach the start. + (when (and (get-text-property (point) 'mouse-face) + (not (bobp)) + (get-text-property (1- (point)) 'mouse-face)) + (let ((start (previous-single-property-change (point) 'mouse-face))) + (while (and (> (point) start) + (eq (forward-line -1) 0) + (eq (move-to-column column) column))))) (while (and (not found) (eq (forward-line -1) 0) (eq (move-to-column column) column)) -- 2.39.3 --=-=-=--