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


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: JD Smith <jdtsmith <at> gmail.com>
Cc: 66942 <at> debbugs.gnu.org
Subject: bug#66942: move-to-column behavior when newlines have a display property
Date: Sun, 05 Nov 2023 19:47:27 +0200
> From: JD Smith <jdtsmith <at> gmail.com>
> 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”.  

"Stay on this line" has one meaning when the text is displayed in some
window and move-to-column is used for positioning the cursors, and
another meaning when move-to-column is used as part of a Lisp program
where move-to-column is used to move point (where "this line" is
generally the line of buffer text).

In addition, what you suggest will cause the behavior to change
drastically when a newline is added to the display property.

Moreover, did you also consider what should current-column return in
those cases?  These two must work in sync, as much as possible.

And finally, when neither behavior is 100% correct, I think we should
generally prefer the behavior we had for some time, because any
changes in that could break someone's code.  Whereas if someone wants
the behavior you describe, they can have that for the price of
relatively simple changes in their Lisp programs.




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.