GNU bug report logs -
#68688
30.0.50; next-line-completion doesn't work with multiline completions
Previous Next
Reported by: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Wed, 24 Jan 2024 14:45:02 UTC
Severity: normal
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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.
[0001-Fix-next-line-completion-for-multi-line-completions.patch (text/x-patch, inline)]
From ffe03b3fe8fb805f5e4eb0a2ea956d573272e74a Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
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
This bug report was last modified 1 year and 104 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.