GNU bug report logs - #66942
move-to-column behavior when newlines have a display property

Previous Next

Package: emacs;

Reported by: Sebastian Wålinder <s.walinder <at> gmail.com>

Date: Sun, 5 Nov 2023 05:45:03 UTC

Severity: normal

Tags: notabug, wontfix

Merged with 64988

Found in version 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 66942 <at> debbugs.gnu.org (full text, mbox):

From: JD Smith <jdtsmith <at> gmail.com>
To: 66942 <at> debbugs.gnu.org
Subject: bug#66942: move-to-column behavior when newlines have a display
 property
Date: Sun, 5 Nov 2023 12:18:12 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:

> ...unless someone comes with an idea for how to handle these situations in a sensible way (and I thought long and hard about it, but couldn't find such ideas), this will remain a limitation of move-to-column, and one of the complications introduced by display strings with embedded newlines in general.

Would it not make more sense to place the cursor _before_ the first character with a `\n` in its replacing-display property, if move-to-column attempts to move past it?  It is true that neither that position nor a position on a subsequent line is “correct”, but the former at least preserves the expected move-to-column semantics of “stay on this line”.  

The final newline is the only place to add display on blank lines, so this will be a general problem for any package attempting to do that.  Here’s a simple test of this for people wanting to investigate:

(progn
  (insert "\n>>>>\n" (propertize "\n" 'display "xxxxx\n") "SHOULD NOT MOVE HERE\n<<<<")
  (forward-line -2) ; at beginning of xxxxx\n line
  (move-to-column 10)) ; should not move past the line



This bug report was last modified 1 year and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.